diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..b3a0f5e7d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.github +.git +dist +.cache +node_modules diff --git a/.eslintrc b/.eslintrc index ec4710566..fd626b5ea 100644 --- a/.eslintrc +++ b/.eslintrc @@ -25,7 +25,7 @@ "plugins": ["standard", "react-hooks"], "rules": { "linebreak-style": [2, "unix"], - "semi": [2, "never"], + "indent": ["error", "tab"], "no-unused-vars": [0], "unicode-bom": ["error", "never"], "react-hooks/rules-of-hooks": 2, @@ -33,5 +33,13 @@ "no-console": 1, "react/prop-types": 0, "no-case-declarations": 0 - } + }, + "overrides": [ + { + "files": ["build/**/*.js"], + "env": { + "node": true + } + } + ] } diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..94a6829bb --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +# Fix end-of-lines in Git versions older than 2.10 +# https://github.com/git/git/blob/master/Documentation/RelNotes/2.10.0.txt#L248 +* text=auto eol=lf diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 8c2dcbf01..000000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,37 +0,0 @@ -# This is a comment. -# Each line is a file pattern followed by one or more owners. - -# These owners will be the default owners for everything in -# the repo. Unless a later match takes precedence, -# @FWirtz and @Atyanar will be requested for review when someone -# opens a pull request. -* @FWirtz @Atyanar @MrSerth - -# Order is important; the last matching pattern takes the most -# precedence. When someone opens a pull request that only -# modifies JS files, only @js-owner and not the global -# owner(s) will be requested for a review. -# *.js @js-owner - -# You can also use email addresses if you prefer. They'll be -# used to look up users just like we do for commit author -# emails. -# *.go docs@example.com - -# In this example, @doctocat owns any files in the build/logs -# directory at the root of the repository and any of its -# subdirectories. -# /build/logs/ @doctocat - -# The `docs/*` pattern will match files like -# `docs/getting-started.md` but not further nested files like -# `docs/build-app/troubleshooting.md`. -# docs/* docs@example.com - -# In this example, @octocat owns any file in an apps directory -# anywhere in your repository. -# apps/ @octocat - -# In this example, @doctocat owns any file in the `/docs` -# directory in the root of your repository. -# /docs/ @doctocat diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 04226183f..000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,13 +0,0 @@ - - -## Proposed Changes - - - - - - - -## ToDos -- [ ] this PR targets `base:development` -- [ ] referenced corresponding issue (if any) -- [ ] ... - -Fixes # diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml deleted file mode 100644 index 6570ee053..000000000 --- a/.github/release-drafter.yml +++ /dev/null @@ -1,5 +0,0 @@ -template: | - ## What's Changed - - $CHANGES - diff --git a/.gitignore b/.gitignore index e997ed0fe..3af23f88c 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,6 @@ yarn.lock # production **/*/build - # misc .DS_Store .env.local diff --git a/.parcelrc b/.parcelrc index 64de6bef5..aa9971d48 100644 --- a/.parcelrc +++ b/.parcelrc @@ -1,6 +1,6 @@ { "url-loader": { - "exts": ["jpg", "jpeg", "png", "gif", "svg"], + "exts": ["jpg", "jpeg", "png", "gif"], "limit": 1024000 } } \ No newline at end of file diff --git a/.prettierrc b/.prettierrc index ba4477b61..727f59245 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,9 +1,17 @@ { - "singleQuote": false, - "trailingComma": "all", - "semi": false, "tabWidth": 4, - "jsxBracketSameLine": true, - "bracketSpacing": true, - "arrowParens": "avoid" + "printWidth": 80, + "useTabs": true, + "trailingComma": "es5", + "bracketSpacing": true, + "jsxBracketSameLine": false, + "arrowParens": "always", + "proseWrap": "never", + "htmlWhitespaceSensitivity": "strict", + "endOfLine": "lf", + "semi": true, + "singleQuote": false } + + + \ No newline at end of file diff --git a/.storybook/stories/Action.jsx b/.storybook/stories/Action.jsx index 7782a226f..7a7654e61 100644 --- a/.storybook/stories/Action.jsx +++ b/.storybook/stories/Action.jsx @@ -23,7 +23,7 @@ stories disabled={boolean("disabled", false)} block={boolean("block", false)} noMargin={boolean("noMargin", false)} - onClick={() => console.log("Yess!")}> + onClick={() => console.info("Yess!")}> Interactive Action Placeholder @@ -47,7 +47,7 @@ stories This will only trigger an event, not change the browser location. - console.log("clicked")}> + console.info("clicked")}> Click me @@ -59,7 +59,7 @@ stories console.log("clicked")} + onClick={() => console.info("clicked")} style={{ backgroundColor: "#DDBDD5" }}> default inline Action @@ -76,7 +76,7 @@ stories console.log("clicked")} + onClick={() => console.info("clicked")} style={{ backgroundColor: "#DDBDD5" }}> block Action @@ -94,7 +94,7 @@ stories block noMargin clickable - onClick={() => console.log("clicked")} + onClick={() => console.info("clicked")} style={{ backgroundColor: "#DDBDD5" }}> block Action without Margin diff --git a/.storybook/stories/Button.jsx b/.storybook/stories/Button.jsx index 6bc748127..37827fd9b 100644 --- a/.storybook/stories/Button.jsx +++ b/.storybook/stories/Button.jsx @@ -23,7 +23,7 @@ stories.add("Interactive", () => { block={boolean("block", false)} full={boolean("full", false)} noMargin={boolean("noMargin", false)} - onClick={() => console.log("Yess!")}> + onClick={() => console.info("Yess!")}> Click me! diff --git a/.svgo.yml b/.svgo.yml new file mode 100644 index 000000000..eb0d5ce67 --- /dev/null +++ b/.svgo.yml @@ -0,0 +1,50 @@ +multipass: true + +plugins: + - addAttributesToSVGElement: false + - addClassesToSVGElement: false + - cleanupAttrs: true + - cleanupEnableBackground: true + - cleanupIDs: true + - cleanupListOfValues: true + - cleanupNumericValues: + floatPrecision: 2 + - collapseGroups: true + - convertColors: true + - convertPathData: true + - convertShapeToPath: true + - convertStyleToAttrs: true + - convertTransform: true + - mergePaths: true + - minifyStyles: true + - moveElemsAttrsToGroup: true + - moveGroupAttrsToElems: true + - removeAttrs: true + - removeComments: true + - removeDesc: true + - removeDimensions: true + - removeDoctype: true + - removeEditorsNSData: true + - removeElementsByAttr: true + - removeEmptyAttrs: true + - removeEmptyContainers: true + - removeEmptyText: true + - removeHiddenElems: true + - removeMetadata: true + - removeNonInheritableGroupAttrs: true + - removeRasterImages + - removeStyleElement: true + - removeTitle: true + - removeUnknownsAndDefaults: true + - removeUnusedNS: true + - removeUselessDefs: true + - removeUselessStrokeAndFill: true + - removeViewBox: true + - removeXMLNS: false + - removeXMLProcInst: true + - sortAttrs: true + - transformsWithOnePath: true + +js2svg: + pretty: false + indent: ' ' \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..0c9c4a5b3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,58 @@ +branches: + only: + - develop + - master + - /^(?i:release|hotfix).*$/ +language: node_js +node_js: + - lts/* +dist: xenial + +env: + global: + - TZ=Europe/Berlin + - GIT_SHA=$( git rev-parse HEAD ) + - DOCKERTAG="$( echo $TRAVIS_BRANCH | tr -s '[:punct:]' '-' | tr -s '[:upper:]' '[:lower:]' )_v$( jq -r '.version' package.json )_$TRAVIS_COMMIT" + +# do not run on develop if it is just a dependency update from dependabot to preserve resources +if: (not branch = develop) or (branch = develop and not commit_message ~= /^Bump.*from.*to.*$/) + +stages: + - test + - name: build + if: type = push && (branch = master || branch = develop || branch ~= /^(?i:release|hotfix).*$/) + - name: deploy + if: type = push && (branch = master || branch = develop || branch ~= /^(?i:release|hotfix).*$/) + +jobs: + include: + # Build & Test + - stage: test + script: npm run build:standalone + name: "build:react:standalone" + - script: npm run build + name: "build:react" + - script: npm run test + name: "mocha" + services: + - mongodb + + # Build Docker Images + - stage: build + name: build + language: generic + script: bash ./deploy/build.sh + + # Deploy + - stage: deploy + name: deploy + language: generic + script: bash ./deploy/deploy.sh + + +cache: npm +before_cache: + # delete all .cache folders before actually storing the cache. + # nuxt, storybook and vuepress stores some build artefacts here which invalidates the cache. + - cd node_modules && find . -name .cache -type d -exec rm -rf {} + && cd .. + - cd node_modules && find . -name .temp -type d -exec rm -rf {} + && cd .. diff --git a/README.md b/README.md index 7d06bbdf0..6aa81111c 100644 --- a/README.md +++ b/README.md @@ -176,6 +176,21 @@ Internal plugins will lie in `src/plugins` and should be mostly isolated, althou To build the editor, simply run `npm run build`. +##### ENV variables + +there exist a script called `deploy/env.sh` which you can run to build a file which makes all used process.env variables available in the window object. This allows you to change configuration parameters without rebuilding the Docker Container. +**If you want to use this feature, you need to import the `dist/env.js` before `dist/index.js` in your HTML code.** + +`bash ./deploy/env.sh dist/env.js` (`dist/env.js` is the output file) + +The generated file will look like similar to this: + +```js +window.EDITOR_API_URL = "Content of process.env.EDITOR_API_URL"; +window.SERVER_API_URL = "Content of process.env.SERVER_API_URL"; +// ... +``` + #### Integration in schulcloud-client Once built, push your build to github. Then, copy the commit hash and use jsdelivr to generate a static link to the script, for example: `https://cdn.jsdelivr.net/gh/schul-cloud/edtrio@COMMIT_HASH/dist/index.js`. You can then pass this url to the schulcloud-editor as `process.env.EDTR_SOURCE`. When you go to the current topic editor, you can now add the query `?edtr=true` to load the new editor. diff --git a/build/index.js b/build/index.js deleted file mode 100644 index 438756c3b..000000000 --- a/build/index.js +++ /dev/null @@ -1,7 +0,0 @@ -const fs = require("fs") -const fse = require("fs-extra") -const path = require("path") - -const distPath = path.join(__dirname, "../dist") - -fse.removeSync(distPath) diff --git a/deploy/Dockerfile b/deploy/Dockerfile new file mode 100644 index 000000000..9190b19ef --- /dev/null +++ b/deploy/Dockerfile @@ -0,0 +1,21 @@ +FROM node:lts as builder + +WORKDIR '/app' +COPY ./package.json ./ +COPY ./package-lock.json ./ +RUN npm ci +COPY . . +RUN npm run build +RUN cd dist && gzip -k index.js + +FROM nginx:alpine +RUN apk update && apk add bash +COPY --from=builder /app/dist /usr/share/nginx/html/ +COPY --from=builder /app/deploy/env.sh ./ +COPY --from=builder /app/deploy/nginx.conf.template /etc/nginx/ +COPY --from=builder /app/deploy/docker-entrypoint.sh ./ +RUN chmod 550 docker-entrypoint.sh +EXPOSE 80 + +# read envs and start nginx +CMD ./docker-entrypoint.sh \ No newline at end of file diff --git a/deploy/build.sh b/deploy/build.sh new file mode 100644 index 000000000..48953ad17 --- /dev/null +++ b/deploy/build.sh @@ -0,0 +1,53 @@ +#! /bin/bash + +# ---------------- +# DECLERATIONS +# ---------------- + +set -e # fail with exit 1 on any error + +echo "DOCKERTAG" $DOCKERTAG +echo "GITSHA" $GIT_SHA + +# ---------------- +# SCRIPTS +# ---------------- + +dockerPush(){ + # $1: Project Name + # $2: docker tag to use + + # Log in to the docker CLI + echo "$MY_DOCKER_PASSWORD" | docker login -u "$DOCKER_ID" --password-stdin + + # Push Image + docker push schulcloud/edtrio:$1 +} + +# BUILD SCRIPTS + +buildEdtrio(){ + docker build \ + -t schulcloud/edtrio:$DOCKERTAG \ + -t schulcloud/edtrio:$GIT_SHA \ + -f Dockerfile \ + ../ + + dockerPush $DOCKERTAG + dockerPush $GIT_SHA +} + +# ---------------- +# MAIN SCRIPT +# ---------------- + +cd deploy + +source ./buildAndDeployFilter.sh +buildAndDeployFilter + +bash ./decryptSecrets.sh + +buildEdtrio + +exit 0 diff --git a/deploy/buildAndDeployFilter.sh b/deploy/buildAndDeployFilter.sh new file mode 100644 index 000000000..3da50fa51 --- /dev/null +++ b/deploy/buildAndDeployFilter.sh @@ -0,0 +1,15 @@ +#! /bin/bash + +buildAndDeployFilter () { + if [ "$TRAVIS_PULL_REQUEST" != "false" ] + then + echo "Pull Requests are not build/deployed. (Pull #$TRAVIS_PULL_REQUEST)" + exit 0 + fi + + if ! [[ $TRAVIS_BRANCH = master || $TRAVIS_BRANCH = develop || $TRAVIS_BRANCH = release* || $TRAVIS_BRANCH = hotfix* ]] + then + echo "Branch $TRAVIS_BRANCH is not supposed to be build/deployed.". + exit 0 + fi +} diff --git a/deploy/decryptSecrets.sh b/deploy/decryptSecrets.sh new file mode 100644 index 000000000..0cfa50bd1 --- /dev/null +++ b/deploy/decryptSecrets.sh @@ -0,0 +1,4 @@ +echo "decrypt secrets" + +openssl aes-256-cbc -K $encrypted_b7bca0b0406c_key -iv $encrypted_b7bca0b0406c_iv -in travis_rsa.enc -out travis_rsa -d +chmod 600 travis_rsa diff --git a/deploy/deploy.sh b/deploy/deploy.sh new file mode 100644 index 000000000..60bddf6d6 --- /dev/null +++ b/deploy/deploy.sh @@ -0,0 +1,77 @@ +#! /bin/bash + +# ---------------- +# DECLERATIONS +# ---------------- + +set -e # fail with exit 1 on any error + +# ---------------- +# SCRIPTS +# ---------------- + +inform_live() { + # $1: Project Name (client, storybook, vuepress) + if [[ "$TRAVIS_EVENT_TYPE" != "cron" ]] + then + curl -X POST -H 'Content-Type: application/json' --data '{"text":":rocket: Die Produktivsysteme können aktualisiert werden: Schul-Cloud Edtrio! Dockertag: '$DOCKERTAG'"}' $WEBHOOK_URL_CHAT + fi +} + +inform_staging() { + if [[ "$TRAVIS_EVENT_TYPE" != "cron" ]] + then + curl -X POST -H 'Content-Type: application/json' --data '{"text":":boom: Das Staging-System wurde aktualisiert: Schul-Cloud Edtrio! (Dockertag: '$DOCKERTAG')"}' $WEBHOOK_URL_CHAT + fi +} + +deploy(){ + SYSTEM=$1 # [staging, test, demo] + + DOCKER_IMAGE=$2 # (edtrio) + DOCKER_TAG=$3 # version/tag of the image to use. Usually the branch name or a GIT_SHA + DOCKER_SERVICE_NAME=$4 # docker service name on server + + echo "deploy " $DOCKER_IMAGE ":" $DOCKER_TAG " to " $SYSTEM " as " $DOCKER_SERVICE_NAME + + # deploy new dockerfile + ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i travis_rsa linux@$SYSTEM.schul-cloud.org /usr/bin/docker service update --force --image schulcloud/$DOCKER_IMAGE:$DOCKER_TAG $DOCKER_SERVICE_NAME +} + +# ---------------- +# MAIN SCRIPT +# ---------------- +cd deploy + +source ./buildAndDeployFilter.sh +buildAndDeployFilter + +bash ./decryptSecrets.sh + +echo "DOCKERTAG" $DOCKERTAG + +if [ -z "$DOCKERTAG" ]; +then + echo "DOCKERTAG env is missing. Abort deployment." + exit 1; +fi + + +case "$TRAVIS_BRANCH" in + + master) + inform_live + ;; + + develop) + echo "develop" + # deploy $SYSTEM $DOCKERFILE $DOCKERTAG $DOCKER_SERVICENAME $COMPOSE_DUMMY $COMPOSE_FILE $COMPOSE_SERVICENAME + deploy "test" "edtrio" $DOCKERTAG "test-schul-cloud_edtrio" + ;; + release* | hotfix*) + echo "release/hotfix" + deploy "staging" "edtrio" $DOCKERTAG "staging_edtrio" + ;; +esac + +exit 0 diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml new file mode 100644 index 000000000..ddee193fe --- /dev/null +++ b/deploy/docker-compose.yml @@ -0,0 +1,18 @@ +version: "3.7" + +# example compose file + +services: + edtrio: + build: + context: ../ + dockerfile: deploy/Dockerfile + container_name: edtr + environment: + - EDITOR_API_URL=https://editor.test.schul-cloud.org + - SERVER_API_URL=https://api.test.schul-cloud.org + - EDITOR_SOCKET_URL=wss://editor.test.schul-cloud.org + - HOMEWORK_URI=/homework + ports: + - 4100:80 + restart: unless-stopped \ No newline at end of file diff --git a/deploy/docker-entrypoint.sh b/deploy/docker-entrypoint.sh new file mode 100755 index 000000000..b55b27031 --- /dev/null +++ b/deploy/docker-entrypoint.sh @@ -0,0 +1,4 @@ +bash ./env.sh /usr/share/nginx/html/env.js +cd /etc/nginx +envsubst '${CORS_URL}' < nginx.conf.template > /etc/nginx/nginx.conf +nginx -g "daemon off;" \ No newline at end of file diff --git a/deploy/env.sh b/deploy/env.sh new file mode 100644 index 000000000..792e93e76 --- /dev/null +++ b/deploy/env.sh @@ -0,0 +1,40 @@ +#!/bin/sh -eu + +# ------------------------------------ +# LIST ALL USED ENV VARIABLES HERE +# ------------------------------------ + +envs=( + "EDITOR_API_URL" + "SERVER_API_URL" + "EDITOR_SOCKET_URL" + "HOMEWORK_URI" + "ENABLE_LTI" +) + +# ------------------------------------ + +file=$1 +if [ -z "${file:-}" ]; then + echo "missing parameter output file" + echo "Usage: bash env.sh output/filename.js" + exit 1 +fi + +# clear file +> $file + +for i in "${envs[@]}" +do + tmp="$i" + val="${!tmp}" + + if [ -z "${val:-}" ]; then + val="undefined" + else + val="\"$val\"" + fi + + echo "window.$i = ${val};" >> $file +done + diff --git a/deploy/nginx.conf.template b/deploy/nginx.conf.template new file mode 100644 index 000000000..a12d53f0a --- /dev/null +++ b/deploy/nginx.conf.template @@ -0,0 +1,72 @@ +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + gzip on; + gzip_static on; + + server { + listen 80; + server_name 0.0.0.0; + + #charset koi8-r; + #access_log /var/log/nginx/host.access.log main; + + set $cors ''; + if ($http_origin ~* (.${CORS_URL})) { + set $cors 'true' ; + } + + location / { + root /usr/share/nginx/html; + index index.js; + + if ($cors = 'true') { + add_header 'Access-Control-Allow-Origin' "$http_origin" always; + add_header 'Access-Control-Allow-Credentials' 'true' always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always; + add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always; + # required to be able to read Authorization header in frontend + add_header 'Access-Control-Expose-Headers' 'Authorization' always; + } + + if ($request_method = 'OPTIONS') { + # Tell client that this pre-flight info is valid for 20 days + add_header 'Access-Control-Max-Age' 1728000; + add_header 'Content-Type' 'text/plain charset=UTF-8'; + add_header 'Content-Length' 0; + return 204; + } + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + } +} \ No newline at end of file diff --git a/deploy/travis_rsa.enc b/deploy/travis_rsa.enc new file mode 100644 index 000000000..1b8557d52 Binary files /dev/null and b/deploy/travis_rsa.enc differ diff --git a/dist/arrow-back.a18e2bc1.svg b/dist/arrow-back.a18e2bc1.svg deleted file mode 100644 index 93f1b32e2..000000000 --- a/dist/arrow-back.a18e2bc1.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/close-white.f9bc3925.svg b/dist/close-white.f9bc3925.svg deleted file mode 100644 index 08bb3edd6..000000000 --- a/dist/close-white.f9bc3925.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/dist/double-arrow-left-red.cdbded20.svg b/dist/double-arrow-left-red.cdbded20.svg deleted file mode 100644 index 9838a3226..000000000 --- a/dist/double-arrow-left-red.cdbded20.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - round-expand-24px - - - Created with Sketch. - - - - - - - - - - diff --git a/dist/double-arrow-left-white.fe884adc.svg b/dist/double-arrow-left-white.fe884adc.svg deleted file mode 100644 index f87da6baa..000000000 --- a/dist/double-arrow-left-white.fe884adc.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - round-expand-24px - - - Created with Sketch. - - - - - - - - - - diff --git a/dist/drag-handle.61261d2c.svg b/dist/drag-handle.61261d2c.svg deleted file mode 100644 index 79fe60025..000000000 --- a/dist/drag-handle.61261d2c.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - ic-Drag handle - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/dist/duplicate-white.497ddc83.svg b/dist/duplicate-white.497ddc83.svg deleted file mode 100644 index eb0de301d..000000000 --- a/dist/duplicate-white.497ddc83.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/dist/eye-red.082cb930.svg b/dist/eye-red.082cb930.svg deleted file mode 100644 index bdc43d1ee..000000000 --- a/dist/eye-red.082cb930.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/header-settings.bf1c394f.svg b/dist/header-settings.bf1c394f.svg deleted file mode 100644 index 2e6cd1c5b..000000000 --- a/dist/header-settings.bf1c394f.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 57ea755ff..153e74c02 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,4 +1,4 @@ -parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c0?r:o)(t)}; },{}],"vfEH":[function(require,module,exports) { var e=require("./_to-integer"),r=Math.max,t=Math.min;module.exports=function(n,a){return(n=e(n))<0?r(n+a,0):t(n,a)}; @@ -56,17 +56,17 @@ var e=require("./_to-integer"),r=Math.max,t=Math.min;module.exports=function(n,a var e=require("./_to-integer"),r=Math.min;module.exports=function(t){return t>0?r(e(t),9007199254740991):0}; },{"./_to-integer":"yjVO"}],"Oppn":[function(require,module,exports) { "use strict";var e=require("./_to-object"),t=require("./_to-absolute-index"),i=require("./_to-length");module.exports=[].copyWithin||function(r,o){var n=e(this),u=i(n.length),h=t(r,u),l=t(o,u),d=arguments.length>2?arguments[2]:void 0,s=Math.min((void 0===d?u:t(d,u))-l,u-h),a=1;for(l0;)l in n?n[h]=n[l]:delete n[h],h+=a,l+=a;return n}; -},{"./_to-object":"rfVX","./_to-absolute-index":"vfEH","./_to-length":"dJBs"}],"44AI":[function(require,module,exports) { +},{"./_to-object":"rfVX","./_to-absolute-index":"vfEH","./_to-length":"dJBs"}],"AIP1":[function(require,module,exports) { var e=require("./_shared")("wks"),r=require("./_uid"),o=require("./_global").Symbol,u="function"==typeof o,i=module.exports=function(i){return e[i]||(e[i]=u&&o[i]||(u?o:r)("Symbol."+i))};i.store=e; -},{"./_shared":"6zGc","./_uid":"U49f","./_global":"5qf4"}],"Z7e/":[function(require,module,exports) { +},{"./_shared":"zGcK","./_uid":"U49f","./_global":"qf4T"}],"Z7eD":[function(require,module,exports) { var e=require("./_wks")("unscopables"),r=Array.prototype;null==r[e]&&require("./_hide")(r,e,{}),module.exports=function(o){r[e][o]=!0}; -},{"./_wks":"44AI","./_hide":"0NXb"}],"tWTB":[function(require,module,exports) { +},{"./_wks":"AIP1","./_hide":"NXbe"}],"tWTB":[function(require,module,exports) { var r=require("./_export");r(r.P,"Array",{copyWithin:require("./_array-copy-within")}),require("./_add-to-unscopables")("copyWithin"); -},{"./_export":"izCb","./_array-copy-within":"Oppn","./_add-to-unscopables":"Z7e/"}],"hphS":[function(require,module,exports) { +},{"./_export":"izCb","./_array-copy-within":"Oppn","./_add-to-unscopables":"Z7eD"}],"hphS":[function(require,module,exports) { "use strict";var e=require("./_to-object"),t=require("./_to-absolute-index"),r=require("./_to-length");module.exports=function(o){for(var i=e(this),u=r(i.length),n=arguments.length,d=t(n>1?arguments[1]:void 0,u),l=n>2?arguments[2]:void 0,s=void 0===l?u:t(l,u);s>d;)i[d++]=o;return i}; },{"./_to-object":"rfVX","./_to-absolute-index":"vfEH","./_to-length":"dJBs"}],"hUQ6":[function(require,module,exports) { var r=require("./_export");r(r.P,"Array",{fill:require("./_array-fill")}),require("./_add-to-unscopables")("fill"); -},{"./_export":"izCb","./_array-fill":"hphS","./_add-to-unscopables":"Z7e/"}],"Z5df":[function(require,module,exports) { +},{"./_export":"izCb","./_array-fill":"hphS","./_add-to-unscopables":"Z7eD"}],"Z5df":[function(require,module,exports) { var r={}.toString;module.exports=function(t){return r.call(t).slice(8,-1)}; },{}],"nGau":[function(require,module,exports) { var e=require("./_cof");module.exports=Object("z").propertyIsEnumerable(0)?Object:function(r){return"String"==e(r)?r.split(""):Object(r)}; @@ -74,109 +74,113 @@ var e=require("./_cof");module.exports=Object("z").propertyIsEnumerable(0)?Objec var r=require("./_cof");module.exports=Array.isArray||function(e){return"Array"==r(e)}; },{"./_cof":"Z5df"}],"NNbH":[function(require,module,exports) { var r=require("./_is-object"),e=require("./_is-array"),o=require("./_wks")("species");module.exports=function(i){var t;return e(i)&&("function"!=typeof(t=i.constructor)||t!==Array&&!e(t.prototype)||(t=void 0),r(t)&&null===(t=t[o])&&(t=void 0)),void 0===t?Array:t}; -},{"./_is-object":"M7z6","./_is-array":"JTrm","./_wks":"44AI"}],"igas":[function(require,module,exports) { +},{"./_is-object":"M7z6","./_is-array":"JTrm","./_wks":"AIP1"}],"igas":[function(require,module,exports) { var r=require("./_array-species-constructor");module.exports=function(e,n){return new(r(e))(n)}; },{"./_array-species-constructor":"NNbH"}],"AuPh":[function(require,module,exports) { var e=require("./_ctx"),r=require("./_iobject"),t=require("./_to-object"),i=require("./_to-length"),u=require("./_array-species-create");module.exports=function(n,c){var s=1==n,a=2==n,o=3==n,f=4==n,l=6==n,q=5==n||l,_=c||u;return function(u,c,h){for(var v,p,b=t(u),d=r(b),g=e(c,h,3),j=i(d.length),x=0,m=s?_(u,j):a?_(u,0):void 0;j>x;x++)if((q||x in d)&&(p=g(v=d[x],x,b),n))if(s)m[x]=p;else if(p)switch(n){case 3:return!0;case 5:return v;case 6:return x;case 2:m.push(v)}else if(f)return!1;return l?-1:o||f?f:m}}; },{"./_ctx":"E3Kh","./_iobject":"nGau","./_to-object":"rfVX","./_to-length":"dJBs","./_array-species-create":"igas"}],"Qppk":[function(require,module,exports) { "use strict";var r=require("./_export"),e=require("./_array-methods")(5),i="find",n=!0;i in[]&&Array(1)[i](function(){n=!1}),r(r.P+r.F*n,"Array",{find:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")(i); -},{"./_export":"izCb","./_array-methods":"AuPh","./_add-to-unscopables":"Z7e/"}],"7sVm":[function(require,module,exports) { +},{"./_export":"izCb","./_array-methods":"AuPh","./_add-to-unscopables":"Z7eD"}],"sVmK":[function(require,module,exports) { "use strict";var r=require("./_export"),e=require("./_array-methods")(6),n="findIndex",i=!0;n in[]&&Array(1)[n](function(){i=!1}),r(r.P+r.F*i,"Array",{findIndex:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")(n); -},{"./_export":"izCb","./_array-methods":"AuPh","./_add-to-unscopables":"Z7e/"}],"RnO+":[function(require,module,exports) { +},{"./_export":"izCb","./_array-methods":"AuPh","./_add-to-unscopables":"Z7eD"}],"emcv":[function(require,module,exports) { +"use strict";var r=require("./_is-array"),e=require("./_is-object"),i=require("./_to-length"),t=require("./_ctx"),o=require("./_wks")("isConcatSpreadable");function u(s,a,n,c,f,l,q,_){for(var d,h,p=f,v=0,b=!!q&&t(q,_,3);v0)p=u(s,a,d,i(d.length),p,l-1)-1;else{if(p>=9007199254740991)throw TypeError();s[p]=d}p++}v++}return p}module.exports=u; +},{"./_is-array":"JTrm","./_is-object":"M7z6","./_to-length":"dJBs","./_ctx":"E3Kh","./_wks":"AIP1"}],"I8vV":[function(require,module,exports) { +"use strict";var r=require("./_export"),e=require("./_flatten-into-array"),t=require("./_to-object"),a=require("./_to-length"),i=require("./_a-function"),u=require("./_array-species-create");r(r.P,"Array",{flatMap:function(r){var n,o,c=t(this);return i(r),n=a(c.length),o=u(c,0),e(o,c,c,n,0,1,r,arguments[1]),o}}),require("./_add-to-unscopables")("flatMap"); +},{"./_export":"izCb","./_flatten-into-array":"emcv","./_to-object":"rfVX","./_to-length":"dJBs","./_a-function":"kYjc","./_array-species-create":"igas","./_add-to-unscopables":"Z7eD"}],"RnOJ":[function(require,module,exports) { var r=require("./_an-object");module.exports=function(t,e,o,a){try{return a?e(r(o)[0],o[1]):e(o)}catch(n){var c=t.return;throw void 0!==c&&r(c.call(t)),n}}; },{"./_an-object":"eT53"}],"JO4d":[function(require,module,exports) { module.exports={}; -},{}],"0B0p":[function(require,module,exports) { +},{}],"B0pB":[function(require,module,exports) { var r=require("./_iterators"),e=require("./_wks")("iterator"),t=Array.prototype;module.exports=function(o){return void 0!==o&&(r.Array===o||t[e]===o)}; -},{"./_iterators":"JO4d","./_wks":"44AI"}],"JCwR":[function(require,module,exports) { +},{"./_iterators":"JO4d","./_wks":"AIP1"}],"JCwR":[function(require,module,exports) { "use strict";var e=require("./_object-dp"),r=require("./_property-desc");module.exports=function(t,i,o){i in t?e.f(t,i,r(0,o)):t[i]=o}; },{"./_object-dp":"nw8e","./_property-desc":"uJ6d"}],"GM7B":[function(require,module,exports) { var e=require("./_cof"),t=require("./_wks")("toStringTag"),n="Arguments"==e(function(){return arguments}()),r=function(e,t){try{return e[t]}catch(n){}};module.exports=function(u){var o,c,i;return void 0===u?"Undefined":null===u?"Null":"string"==typeof(c=r(o=Object(u),t))?c:n?e(o):"Object"==(i=e(o))&&"function"==typeof o.callee?"Arguments":i}; -},{"./_cof":"Z5df","./_wks":"44AI"}],"ia+4":[function(require,module,exports) { +},{"./_cof":"Z5df","./_wks":"AIP1"}],"ia42":[function(require,module,exports) { var r=require("./_classof"),e=require("./_wks")("iterator"),t=require("./_iterators");module.exports=require("./_core").getIteratorMethod=function(o){if(null!=o)return o[e]||o["@@iterator"]||t[r(o)]}; -},{"./_classof":"GM7B","./_wks":"44AI","./_iterators":"JO4d","./_core":"ss9A"}],"md62":[function(require,module,exports) { +},{"./_classof":"GM7B","./_wks":"AIP1","./_iterators":"JO4d","./_core":"ss9A"}],"md62":[function(require,module,exports) { var r=require("./_wks")("iterator"),t=!1;try{var n=[7][r]();n.return=function(){t=!0},Array.from(n,function(){throw 2})}catch(e){}module.exports=function(n,u){if(!u&&!t)return!1;var o=!1;try{var c=[7],a=c[r]();a.next=function(){return{done:o=!0}},c[r]=function(){return a},n(c)}catch(e){}return o}; -},{"./_wks":"44AI"}],"RRcs":[function(require,module,exports) { +},{"./_wks":"AIP1"}],"RRcs":[function(require,module,exports) { "use strict";var e=require("./_ctx"),r=require("./_export"),t=require("./_to-object"),i=require("./_iter-call"),o=require("./_is-array-iter"),u=require("./_to-length"),n=require("./_create-property"),a=require("./core.get-iterator-method");r(r.S+r.F*!require("./_iter-detect")(function(e){Array.from(e)}),"Array",{from:function(r){var l,c,f,q,_=t(r),h="function"==typeof this?this:Array,v=arguments.length,y=v>1?arguments[1]:void 0,d=void 0!==y,s=0,g=a(_);if(d&&(y=e(y,v>2?arguments[2]:void 0,2)),null==g||h==Array&&o(g))for(c=new h(l=u(_.length));l>s;s++)n(c,s,d?y(_[s],s):_[s]);else for(q=g.call(_),c=new h;!(f=q.next()).done;s++)n(c,s,d?i(q,y,[f.value,s],!0):f.value);return c.length=s,c}}); -},{"./_ctx":"E3Kh","./_export":"izCb","./_to-object":"rfVX","./_iter-call":"RnO+","./_is-array-iter":"0B0p","./_to-length":"dJBs","./_create-property":"JCwR","./core.get-iterator-method":"ia+4","./_iter-detect":"md62"}],"g6sb":[function(require,module,exports) { +},{"./_ctx":"E3Kh","./_export":"izCb","./_to-object":"rfVX","./_iter-call":"RnOJ","./_is-array-iter":"B0pB","./_to-length":"dJBs","./_create-property":"JCwR","./core.get-iterator-method":"ia42","./_iter-detect":"md62"}],"g6sb":[function(require,module,exports) { var e=require("./_iobject"),r=require("./_defined");module.exports=function(i){return e(r(i))}; -},{"./_iobject":"nGau","./_defined":"+Bjj"}],"4Ca7":[function(require,module,exports) { +},{"./_iobject":"nGau","./_defined":"BjjL"}],"Ca7J":[function(require,module,exports) { var e=require("./_to-iobject"),r=require("./_to-length"),t=require("./_to-absolute-index");module.exports=function(n){return function(i,o,u){var f,l=e(i),a=r(l.length),c=t(u,a);if(n&&o!=o){for(;a>c;)if((f=l[c++])!=f)return!0}else for(;a>c;c++)if((n||c in l)&&l[c]===o)return n||c||0;return!n&&-1}}; },{"./_to-iobject":"g6sb","./_to-length":"dJBs","./_to-absolute-index":"vfEH"}],"TLss":[function(require,module,exports) { "use strict";var r=require("./_export"),e=require("./_array-includes")(!0);r(r.P,"Array",{includes:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")("includes"); -},{"./_export":"izCb","./_array-includes":"4Ca7","./_add-to-unscopables":"Z7e/"}],"x8b3":[function(require,module,exports) { +},{"./_export":"izCb","./_array-includes":"Ca7J","./_add-to-unscopables":"Z7eD"}],"x8b3":[function(require,module,exports) { module.exports=function(e,n){return{value:n,done:!!e}}; },{}],"NaGB":[function(require,module,exports) { var e=require("./_shared")("keys"),r=require("./_uid");module.exports=function(u){return e[u]||(e[u]=r(u))}; -},{"./_shared":"6zGc","./_uid":"U49f"}],"vL0Z":[function(require,module,exports) { +},{"./_shared":"zGcK","./_uid":"U49f"}],"vL0Z":[function(require,module,exports) { var r=require("./_has"),e=require("./_to-iobject"),u=require("./_array-includes")(!1),i=require("./_shared-key")("IE_PROTO");module.exports=function(o,a){var n,s=e(o),t=0,h=[];for(n in s)n!=i&&r(s,n)&&h.push(n);for(;a.length>t;)r(s,n=a[t++])&&(~u(h,n)||h.push(n));return h}; -},{"./_has":"2uHg","./_to-iobject":"g6sb","./_array-includes":"4Ca7","./_shared-key":"NaGB"}],"9bbv":[function(require,module,exports) { +},{"./_has":"uHgd","./_to-iobject":"g6sb","./_array-includes":"Ca7J","./_shared-key":"NaGB"}],"bbv4":[function(require,module,exports) { module.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","); },{}],"U9a7":[function(require,module,exports) { var e=require("./_object-keys-internal"),r=require("./_enum-bug-keys");module.exports=Object.keys||function(u){return e(u,r)}; -},{"./_object-keys-internal":"vL0Z","./_enum-bug-keys":"9bbv"}],"MiMz":[function(require,module,exports) { +},{"./_object-keys-internal":"vL0Z","./_enum-bug-keys":"bbv4"}],"MiMz":[function(require,module,exports) { var e=require("./_object-dp"),r=require("./_an-object"),t=require("./_object-keys");module.exports=require("./_descriptors")?Object.defineProperties:function(o,i){r(o);for(var u,c=t(i),n=c.length,s=0;n>s;)e.f(o,u=c[s++],i[u]);return o}; -},{"./_object-dp":"nw8e","./_an-object":"eT53","./_object-keys":"U9a7","./_descriptors":"P9Ib"}],"xj/b":[function(require,module,exports) { +},{"./_object-dp":"nw8e","./_an-object":"eT53","./_object-keys":"U9a7","./_descriptors":"P9Ib"}],"xjB1":[function(require,module,exports) { var e=require("./_global").document;module.exports=e&&e.documentElement; -},{"./_global":"5qf4"}],"sYaK":[function(require,module,exports) { +},{"./_global":"qf4T"}],"sYaK":[function(require,module,exports) { var e=require("./_an-object"),r=require("./_object-dps"),t=require("./_enum-bug-keys"),n=require("./_shared-key")("IE_PROTO"),o=function(){},i="prototype",u=function(){var e,r=require("./_dom-create")("iframe"),n=t.length;for(r.style.display="none",require("./_html").appendChild(r),r.src="javascript:",(e=r.contentWindow.document).open(),e.write("\n if (val === '') return true;\n if (val === 'false') return false;\n if (val === 'true') return true;\n return val;\n}\n\nif (DOCUMENT && typeof DOCUMENT.querySelector === 'function') {\n var attrs = [['data-family-prefix', 'familyPrefix'], ['data-replacement-class', 'replacementClass'], ['data-auto-replace-svg', 'autoReplaceSvg'], ['data-auto-add-css', 'autoAddCss'], ['data-auto-a11y', 'autoA11y'], ['data-search-pseudo-elements', 'searchPseudoElements'], ['data-observe-mutations', 'observeMutations'], ['data-mutate-approach', 'mutateApproach'], ['data-keep-original-source', 'keepOriginalSource'], ['data-measure-performance', 'measurePerformance'], ['data-show-missing-icons', 'showMissingIcons']];\n attrs.forEach(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n attr = _ref2[0],\n key = _ref2[1];\n\n var val = coerce(getAttrConfig(attr));\n\n if (val !== undefined && val !== null) {\n initial[key] = val;\n }\n });\n}\n\nvar _default = {\n familyPrefix: DEFAULT_FAMILY_PREFIX,\n replacementClass: DEFAULT_REPLACEMENT_CLASS,\n autoReplaceSvg: true,\n autoAddCss: true,\n autoA11y: true,\n searchPseudoElements: false,\n observeMutations: true,\n mutateApproach: 'async',\n keepOriginalSource: true,\n measurePerformance: false,\n showMissingIcons: true\n};\n\nvar _config = _objectSpread({}, _default, initial);\n\nif (!_config.autoReplaceSvg) _config.observeMutations = false;\n\nvar config = _objectSpread({}, _config);\n\nWINDOW.FontAwesomeConfig = config;\n\nvar w = WINDOW || {};\nif (!w[NAMESPACE_IDENTIFIER]) w[NAMESPACE_IDENTIFIER] = {};\nif (!w[NAMESPACE_IDENTIFIER].styles) w[NAMESPACE_IDENTIFIER].styles = {};\nif (!w[NAMESPACE_IDENTIFIER].hooks) w[NAMESPACE_IDENTIFIER].hooks = {};\nif (!w[NAMESPACE_IDENTIFIER].shims) w[NAMESPACE_IDENTIFIER].shims = [];\nvar namespace = w[NAMESPACE_IDENTIFIER];\n\nvar functions = [];\n\nvar listener = function listener() {\n DOCUMENT.removeEventListener('DOMContentLoaded', listener);\n loaded = 1;\n functions.map(function (fn) {\n return fn();\n });\n};\n\nvar loaded = false;\n\nif (IS_DOM) {\n loaded = (DOCUMENT.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(DOCUMENT.readyState);\n if (!loaded) DOCUMENT.addEventListener('DOMContentLoaded', listener);\n}\n\nfunction domready (fn) {\n if (!IS_DOM) return;\n loaded ? setTimeout(fn, 0) : functions.push(fn);\n}\n\nvar PENDING = 'pending';\nvar SETTLED = 'settled';\nvar FULFILLED = 'fulfilled';\nvar REJECTED = 'rejected';\n\nvar NOOP = function NOOP() {};\n\nvar isNode = typeof global !== 'undefined' && typeof global.process !== 'undefined' && typeof global.process.emit === 'function';\nvar asyncSetTimer = typeof setImmediate === 'undefined' ? setTimeout : setImmediate;\nvar asyncQueue = [];\nvar asyncTimer;\n\nfunction asyncFlush() {\n // run promise callbacks\n for (var i = 0; i < asyncQueue.length; i++) {\n asyncQueue[i][0](asyncQueue[i][1]);\n } // reset async asyncQueue\n\n\n asyncQueue = [];\n asyncTimer = false;\n}\n\nfunction asyncCall(callback, arg) {\n asyncQueue.push([callback, arg]);\n\n if (!asyncTimer) {\n asyncTimer = true;\n asyncSetTimer(asyncFlush, 0);\n }\n}\n\nfunction invokeResolver(resolver, promise) {\n function resolvePromise(value) {\n resolve(promise, value);\n }\n\n function rejectPromise(reason) {\n reject(promise, reason);\n }\n\n try {\n resolver(resolvePromise, rejectPromise);\n } catch (e) {\n rejectPromise(e);\n }\n}\n\nfunction invokeCallback(subscriber) {\n var owner = subscriber.owner;\n var settled = owner._state;\n var value = owner._data;\n var callback = subscriber[settled];\n var promise = subscriber.then;\n\n if (typeof callback === 'function') {\n settled = FULFILLED;\n\n try {\n value = callback(value);\n } catch (e) {\n reject(promise, e);\n }\n }\n\n if (!handleThenable(promise, value)) {\n if (settled === FULFILLED) {\n resolve(promise, value);\n }\n\n if (settled === REJECTED) {\n reject(promise, value);\n }\n }\n}\n\nfunction handleThenable(promise, value) {\n var resolved;\n\n try {\n if (promise === value) {\n throw new TypeError('A promises callback cannot return that same promise.');\n }\n\n if (value && (typeof value === 'function' || _typeof(value) === 'object')) {\n // then should be retrieved only once\n var then = value.then;\n\n if (typeof then === 'function') {\n then.call(value, function (val) {\n if (!resolved) {\n resolved = true;\n\n if (value === val) {\n fulfill(promise, val);\n } else {\n resolve(promise, val);\n }\n }\n }, function (reason) {\n if (!resolved) {\n resolved = true;\n reject(promise, reason);\n }\n });\n return true;\n }\n }\n } catch (e) {\n if (!resolved) {\n reject(promise, e);\n }\n\n return true;\n }\n\n return false;\n}\n\nfunction resolve(promise, value) {\n if (promise === value || !handleThenable(promise, value)) {\n fulfill(promise, value);\n }\n}\n\nfunction fulfill(promise, value) {\n if (promise._state === PENDING) {\n promise._state = SETTLED;\n promise._data = value;\n asyncCall(publishFulfillment, promise);\n }\n}\n\nfunction reject(promise, reason) {\n if (promise._state === PENDING) {\n promise._state = SETTLED;\n promise._data = reason;\n asyncCall(publishRejection, promise);\n }\n}\n\nfunction publish(promise) {\n promise._then = promise._then.forEach(invokeCallback);\n}\n\nfunction publishFulfillment(promise) {\n promise._state = FULFILLED;\n publish(promise);\n}\n\nfunction publishRejection(promise) {\n promise._state = REJECTED;\n publish(promise);\n\n if (!promise._handled && isNode) {\n global.process.emit('unhandledRejection', promise._data, promise);\n }\n}\n\nfunction notifyRejectionHandled(promise) {\n global.process.emit('rejectionHandled', promise);\n}\n/**\n * @class\n */\n\n\nfunction P(resolver) {\n if (typeof resolver !== 'function') {\n throw new TypeError('Promise resolver ' + resolver + ' is not a function');\n }\n\n if (this instanceof P === false) {\n throw new TypeError('Failed to construct \\'Promise\\': Please use the \\'new\\' operator, this object constructor cannot be called as a function.');\n }\n\n this._then = [];\n invokeResolver(resolver, this);\n}\n\nP.prototype = {\n constructor: P,\n _state: PENDING,\n _then: null,\n _data: undefined,\n _handled: false,\n then: function then(onFulfillment, onRejection) {\n var subscriber = {\n owner: this,\n then: new this.constructor(NOOP),\n fulfilled: onFulfillment,\n rejected: onRejection\n };\n\n if ((onRejection || onFulfillment) && !this._handled) {\n this._handled = true;\n\n if (this._state === REJECTED && isNode) {\n asyncCall(notifyRejectionHandled, this);\n }\n }\n\n if (this._state === FULFILLED || this._state === REJECTED) {\n // already resolved, call callback async\n asyncCall(invokeCallback, subscriber);\n } else {\n // subscribe\n this._then.push(subscriber);\n }\n\n return subscriber.then;\n },\n catch: function _catch(onRejection) {\n return this.then(null, onRejection);\n }\n};\n\nP.all = function (promises) {\n if (!Array.isArray(promises)) {\n throw new TypeError('You must pass an array to Promise.all().');\n }\n\n return new P(function (resolve, reject) {\n var results = [];\n var remaining = 0;\n\n function resolver(index) {\n remaining++;\n return function (value) {\n results[index] = value;\n\n if (! --remaining) {\n resolve(results);\n }\n };\n }\n\n for (var i = 0, promise; i < promises.length; i++) {\n promise = promises[i];\n\n if (promise && typeof promise.then === 'function') {\n promise.then(resolver(i), reject);\n } else {\n results[i] = promise;\n }\n }\n\n if (!remaining) {\n resolve(results);\n }\n });\n};\n\nP.race = function (promises) {\n if (!Array.isArray(promises)) {\n throw new TypeError('You must pass an array to Promise.race().');\n }\n\n return new P(function (resolve, reject) {\n for (var i = 0, promise; i < promises.length; i++) {\n promise = promises[i];\n\n if (promise && typeof promise.then === 'function') {\n promise.then(resolve, reject);\n } else {\n resolve(promise);\n }\n }\n });\n};\n\nP.resolve = function (value) {\n if (value && _typeof(value) === 'object' && value.constructor === P) {\n return value;\n }\n\n return new P(function (resolve) {\n resolve(value);\n });\n};\n\nP.reject = function (reason) {\n return new P(function (resolve, reject) {\n reject(reason);\n });\n};\n\nvar picked = typeof Promise === 'function' ? Promise : P;\n\nvar d = UNITS_IN_GRID;\nvar meaninglessTransform = {\n size: 16,\n x: 0,\n y: 0,\n rotate: 0,\n flipX: false,\n flipY: false\n};\n\nfunction isReserved(name) {\n return ~RESERVED_CLASSES.indexOf(name);\n}\nfunction insertCss(css) {\n if (!css || !IS_DOM) {\n return;\n }\n\n var style = DOCUMENT.createElement('style');\n style.setAttribute('type', 'text/css');\n style.innerHTML = css;\n var headChildren = DOCUMENT.head.childNodes;\n var beforeChild = null;\n\n for (var i = headChildren.length - 1; i > -1; i--) {\n var child = headChildren[i];\n var tagName = (child.tagName || '').toUpperCase();\n\n if (['STYLE', 'LINK'].indexOf(tagName) > -1) {\n beforeChild = child;\n }\n }\n\n DOCUMENT.head.insertBefore(style, beforeChild);\n return css;\n}\nvar idPool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\nfunction nextUniqueId() {\n var size = 12;\n var id = '';\n\n while (size-- > 0) {\n id += idPool[Math.random() * 62 | 0];\n }\n\n return id;\n}\nfunction toArray(obj) {\n var array = [];\n\n for (var i = (obj || []).length >>> 0; i--;) {\n array[i] = obj[i];\n }\n\n return array;\n}\nfunction classArray(node) {\n if (node.classList) {\n return toArray(node.classList);\n } else {\n return (node.getAttribute('class') || '').split(' ').filter(function (i) {\n return i;\n });\n }\n}\nfunction getIconName(familyPrefix, cls) {\n var parts = cls.split('-');\n var prefix = parts[0];\n var iconName = parts.slice(1).join('-');\n\n if (prefix === familyPrefix && iconName !== '' && !isReserved(iconName)) {\n return iconName;\n } else {\n return null;\n }\n}\nfunction htmlEscape(str) {\n return \"\".concat(str).replace(/&/g, '&').replace(/\"/g, '"').replace(/'/g, ''').replace(//g, '>');\n}\nfunction joinAttributes(attributes) {\n return Object.keys(attributes || {}).reduce(function (acc, attributeName) {\n return acc + \"\".concat(attributeName, \"=\\\"\").concat(htmlEscape(attributes[attributeName]), \"\\\" \");\n }, '').trim();\n}\nfunction joinStyles(styles) {\n return Object.keys(styles || {}).reduce(function (acc, styleName) {\n return acc + \"\".concat(styleName, \": \").concat(styles[styleName], \";\");\n }, '');\n}\nfunction transformIsMeaningful(transform) {\n return transform.size !== meaninglessTransform.size || transform.x !== meaninglessTransform.x || transform.y !== meaninglessTransform.y || transform.rotate !== meaninglessTransform.rotate || transform.flipX || transform.flipY;\n}\nfunction transformForSvg(_ref) {\n var transform = _ref.transform,\n containerWidth = _ref.containerWidth,\n iconWidth = _ref.iconWidth;\n var outer = {\n transform: \"translate(\".concat(containerWidth / 2, \" 256)\")\n };\n var innerTranslate = \"translate(\".concat(transform.x * 32, \", \").concat(transform.y * 32, \") \");\n var innerScale = \"scale(\".concat(transform.size / 16 * (transform.flipX ? -1 : 1), \", \").concat(transform.size / 16 * (transform.flipY ? -1 : 1), \") \");\n var innerRotate = \"rotate(\".concat(transform.rotate, \" 0 0)\");\n var inner = {\n transform: \"\".concat(innerTranslate, \" \").concat(innerScale, \" \").concat(innerRotate)\n };\n var path = {\n transform: \"translate(\".concat(iconWidth / 2 * -1, \" -256)\")\n };\n return {\n outer: outer,\n inner: inner,\n path: path\n };\n}\nfunction transformForCss(_ref2) {\n var transform = _ref2.transform,\n _ref2$width = _ref2.width,\n width = _ref2$width === void 0 ? UNITS_IN_GRID : _ref2$width,\n _ref2$height = _ref2.height,\n height = _ref2$height === void 0 ? UNITS_IN_GRID : _ref2$height,\n _ref2$startCentered = _ref2.startCentered,\n startCentered = _ref2$startCentered === void 0 ? false : _ref2$startCentered;\n var val = '';\n\n if (startCentered && IS_IE) {\n val += \"translate(\".concat(transform.x / d - width / 2, \"em, \").concat(transform.y / d - height / 2, \"em) \");\n } else if (startCentered) {\n val += \"translate(calc(-50% + \".concat(transform.x / d, \"em), calc(-50% + \").concat(transform.y / d, \"em)) \");\n } else {\n val += \"translate(\".concat(transform.x / d, \"em, \").concat(transform.y / d, \"em) \");\n }\n\n val += \"scale(\".concat(transform.size / d * (transform.flipX ? -1 : 1), \", \").concat(transform.size / d * (transform.flipY ? -1 : 1), \") \");\n val += \"rotate(\".concat(transform.rotate, \"deg) \");\n return val;\n}\n\nvar ALL_SPACE = {\n x: 0,\n y: 0,\n width: '100%',\n height: '100%'\n};\n\nfunction fillBlack(abstract) {\n var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n\n if (abstract.attributes && (abstract.attributes.fill || force)) {\n abstract.attributes.fill = 'black';\n }\n\n return abstract;\n}\n\nfunction deGroup(abstract) {\n if (abstract.tag === 'g') {\n return abstract.children;\n } else {\n return [abstract];\n }\n}\n\nfunction makeIconMasking (_ref) {\n var children = _ref.children,\n attributes = _ref.attributes,\n main = _ref.main,\n mask = _ref.mask,\n transform = _ref.transform;\n var mainWidth = main.width,\n mainPath = main.icon;\n var maskWidth = mask.width,\n maskPath = mask.icon;\n var trans = transformForSvg({\n transform: transform,\n containerWidth: maskWidth,\n iconWidth: mainWidth\n });\n var maskRect = {\n tag: 'rect',\n attributes: _objectSpread({}, ALL_SPACE, {\n fill: 'white'\n })\n };\n var maskInnerGroupChildrenMixin = mainPath.children ? {\n children: mainPath.children.map(fillBlack)\n } : {};\n var maskInnerGroup = {\n tag: 'g',\n attributes: _objectSpread({}, trans.inner),\n children: [fillBlack(_objectSpread({\n tag: mainPath.tag,\n attributes: _objectSpread({}, mainPath.attributes, trans.path)\n }, maskInnerGroupChildrenMixin))]\n };\n var maskOuterGroup = {\n tag: 'g',\n attributes: _objectSpread({}, trans.outer),\n children: [maskInnerGroup]\n };\n var maskId = \"mask-\".concat(nextUniqueId());\n var clipId = \"clip-\".concat(nextUniqueId());\n var maskTag = {\n tag: 'mask',\n attributes: _objectSpread({}, ALL_SPACE, {\n id: maskId,\n maskUnits: 'userSpaceOnUse',\n maskContentUnits: 'userSpaceOnUse'\n }),\n children: [maskRect, maskOuterGroup]\n };\n var defs = {\n tag: 'defs',\n children: [{\n tag: 'clipPath',\n attributes: {\n id: clipId\n },\n children: deGroup(maskPath)\n }, maskTag]\n };\n children.push(defs, {\n tag: 'rect',\n attributes: _objectSpread({\n fill: 'currentColor',\n 'clip-path': \"url(#\".concat(clipId, \")\"),\n mask: \"url(#\".concat(maskId, \")\")\n }, ALL_SPACE)\n });\n return {\n children: children,\n attributes: attributes\n };\n}\n\nfunction makeIconStandard (_ref) {\n var children = _ref.children,\n attributes = _ref.attributes,\n main = _ref.main,\n transform = _ref.transform,\n styles = _ref.styles;\n var styleString = joinStyles(styles);\n\n if (styleString.length > 0) {\n attributes['style'] = styleString;\n }\n\n if (transformIsMeaningful(transform)) {\n var trans = transformForSvg({\n transform: transform,\n containerWidth: main.width,\n iconWidth: main.width\n });\n children.push({\n tag: 'g',\n attributes: _objectSpread({}, trans.outer),\n children: [{\n tag: 'g',\n attributes: _objectSpread({}, trans.inner),\n children: [{\n tag: main.icon.tag,\n children: main.icon.children,\n attributes: _objectSpread({}, main.icon.attributes, trans.path)\n }]\n }]\n });\n } else {\n children.push(main.icon);\n }\n\n return {\n children: children,\n attributes: attributes\n };\n}\n\nfunction asIcon (_ref) {\n var children = _ref.children,\n main = _ref.main,\n mask = _ref.mask,\n attributes = _ref.attributes,\n styles = _ref.styles,\n transform = _ref.transform;\n\n if (transformIsMeaningful(transform) && main.found && !mask.found) {\n var width = main.width,\n height = main.height;\n var offset = {\n x: width / height / 2,\n y: 0.5\n };\n attributes['style'] = joinStyles(_objectSpread({}, styles, {\n 'transform-origin': \"\".concat(offset.x + transform.x / 16, \"em \").concat(offset.y + transform.y / 16, \"em\")\n }));\n }\n\n return [{\n tag: 'svg',\n attributes: attributes,\n children: children\n }];\n}\n\nfunction asSymbol (_ref) {\n var prefix = _ref.prefix,\n iconName = _ref.iconName,\n children = _ref.children,\n attributes = _ref.attributes,\n symbol = _ref.symbol;\n var id = symbol === true ? \"\".concat(prefix, \"-\").concat(config.familyPrefix, \"-\").concat(iconName) : symbol;\n return [{\n tag: 'svg',\n attributes: {\n style: 'display: none;'\n },\n children: [{\n tag: 'symbol',\n attributes: _objectSpread({}, attributes, {\n id: id\n }),\n children: children\n }]\n }];\n}\n\nfunction makeInlineSvgAbstract(params) {\n var _params$icons = params.icons,\n main = _params$icons.main,\n mask = _params$icons.mask,\n prefix = params.prefix,\n iconName = params.iconName,\n transform = params.transform,\n symbol = params.symbol,\n title = params.title,\n extra = params.extra,\n _params$watchable = params.watchable,\n watchable = _params$watchable === void 0 ? false : _params$watchable;\n\n var _ref = mask.found ? mask : main,\n width = _ref.width,\n height = _ref.height;\n\n var widthClass = \"fa-w-\".concat(Math.ceil(width / height * 16));\n var attrClass = [config.replacementClass, iconName ? \"\".concat(config.familyPrefix, \"-\").concat(iconName) : '', widthClass].filter(function (c) {\n return extra.classes.indexOf(c) === -1;\n }).concat(extra.classes).join(' ');\n var content = {\n children: [],\n attributes: _objectSpread({}, extra.attributes, {\n 'data-prefix': prefix,\n 'data-icon': iconName,\n 'class': attrClass,\n 'role': extra.attributes.role || 'img',\n 'xmlns': 'http://www.w3.org/2000/svg',\n 'viewBox': \"0 0 \".concat(width, \" \").concat(height)\n })\n };\n\n if (watchable) {\n content.attributes[DATA_FA_I2SVG] = '';\n }\n\n if (title) content.children.push({\n tag: 'title',\n attributes: {\n id: content.attributes['aria-labelledby'] || \"title-\".concat(nextUniqueId())\n },\n children: [title]\n });\n\n var args = _objectSpread({}, content, {\n prefix: prefix,\n iconName: iconName,\n main: main,\n mask: mask,\n transform: transform,\n symbol: symbol,\n styles: extra.styles\n });\n\n var _ref2 = mask.found && main.found ? makeIconMasking(args) : makeIconStandard(args),\n children = _ref2.children,\n attributes = _ref2.attributes;\n\n args.children = children;\n args.attributes = attributes;\n\n if (symbol) {\n return asSymbol(args);\n } else {\n return asIcon(args);\n }\n}\nfunction makeLayersTextAbstract(params) {\n var content = params.content,\n width = params.width,\n height = params.height,\n transform = params.transform,\n title = params.title,\n extra = params.extra,\n _params$watchable2 = params.watchable,\n watchable = _params$watchable2 === void 0 ? false : _params$watchable2;\n\n var attributes = _objectSpread({}, extra.attributes, title ? {\n 'title': title\n } : {}, {\n 'class': extra.classes.join(' ')\n });\n\n if (watchable) {\n attributes[DATA_FA_I2SVG] = '';\n }\n\n var styles = _objectSpread({}, extra.styles);\n\n if (transformIsMeaningful(transform)) {\n styles['transform'] = transformForCss({\n transform: transform,\n startCentered: true,\n width: width,\n height: height\n });\n styles['-webkit-transform'] = styles['transform'];\n }\n\n var styleString = joinStyles(styles);\n\n if (styleString.length > 0) {\n attributes['style'] = styleString;\n }\n\n var val = [];\n val.push({\n tag: 'span',\n attributes: attributes,\n children: [content]\n });\n\n if (title) {\n val.push({\n tag: 'span',\n attributes: {\n class: 'sr-only'\n },\n children: [title]\n });\n }\n\n return val;\n}\nfunction makeLayersCounterAbstract(params) {\n var content = params.content,\n title = params.title,\n extra = params.extra;\n\n var attributes = _objectSpread({}, extra.attributes, title ? {\n 'title': title\n } : {}, {\n 'class': extra.classes.join(' ')\n });\n\n var styleString = joinStyles(extra.styles);\n\n if (styleString.length > 0) {\n attributes['style'] = styleString;\n }\n\n var val = [];\n val.push({\n tag: 'span',\n attributes: attributes,\n children: [content]\n });\n\n if (title) {\n val.push({\n tag: 'span',\n attributes: {\n class: 'sr-only'\n },\n children: [title]\n });\n }\n\n return val;\n}\n\nvar noop$1 = function noop() {};\n\nvar p = config.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : {\n mark: noop$1,\n measure: noop$1\n};\nvar preamble = \"FA \\\"5.11.2\\\"\";\n\nvar begin = function begin(name) {\n p.mark(\"\".concat(preamble, \" \").concat(name, \" begins\"));\n return function () {\n return end(name);\n };\n};\n\nvar end = function end(name) {\n p.mark(\"\".concat(preamble, \" \").concat(name, \" ends\"));\n p.measure(\"\".concat(preamble, \" \").concat(name), \"\".concat(preamble, \" \").concat(name, \" begins\"), \"\".concat(preamble, \" \").concat(name, \" ends\"));\n};\n\nvar perf = {\n begin: begin,\n end: end\n};\n\n/**\n * Internal helper to bind a function known to have 4 arguments\n * to a given context.\n */\n\nvar bindInternal4 = function bindInternal4(func, thisContext) {\n return function (a, b, c, d) {\n return func.call(thisContext, a, b, c, d);\n };\n};\n\n/**\n * # Reduce\n *\n * A fast object `.reduce()` implementation.\n *\n * @param {Object} subject The object to reduce over.\n * @param {Function} fn The reducer function.\n * @param {mixed} initialValue The initial value for the reducer, defaults to subject[0].\n * @param {Object} thisContext The context for the reducer.\n * @return {mixed} The final result.\n */\n\n\nvar reduce = function fastReduceObject(subject, fn, initialValue, thisContext) {\n var keys = Object.keys(subject),\n length = keys.length,\n iterator = thisContext !== undefined ? bindInternal4(fn, thisContext) : fn,\n i,\n key,\n result;\n\n if (initialValue === undefined) {\n i = 1;\n result = subject[keys[0]];\n } else {\n i = 0;\n result = initialValue;\n }\n\n for (; i < length; i++) {\n key = keys[i];\n result = iterator(result, subject[key], key, subject);\n }\n\n return result;\n};\n\nfunction toHex(unicode) {\n var result = '';\n\n for (var i = 0; i < unicode.length; i++) {\n var hex = unicode.charCodeAt(i).toString(16);\n result += ('000' + hex).slice(-4);\n }\n\n return result;\n}\n\nfunction defineIcons(prefix, icons) {\n var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var _params$skipHooks = params.skipHooks,\n skipHooks = _params$skipHooks === void 0 ? false : _params$skipHooks;\n var normalized = Object.keys(icons).reduce(function (acc, iconName) {\n var icon = icons[iconName];\n var expanded = !!icon.icon;\n\n if (expanded) {\n acc[icon.iconName] = icon.icon;\n } else {\n acc[iconName] = icon;\n }\n\n return acc;\n }, {});\n\n if (typeof namespace.hooks.addPack === 'function' && !skipHooks) {\n namespace.hooks.addPack(prefix, normalized);\n } else {\n namespace.styles[prefix] = _objectSpread({}, namespace.styles[prefix] || {}, normalized);\n }\n /**\n * Font Awesome 4 used the prefix of `fa` for all icons. With the introduction\n * of new styles we needed to differentiate between them. Prefix `fa` is now an alias\n * for `fas` so we'll easy the upgrade process for our users by automatically defining\n * this as well.\n */\n\n\n if (prefix === 'fas') {\n defineIcons('fa', icons);\n }\n}\n\nvar styles = namespace.styles,\n shims = namespace.shims;\nvar _byUnicode = {};\nvar _byLigature = {};\nvar _byOldName = {};\nvar build = function build() {\n var lookup = function lookup(reducer) {\n return reduce(styles, function (o, style, prefix) {\n o[prefix] = reduce(style, reducer, {});\n return o;\n }, {});\n };\n\n _byUnicode = lookup(function (acc, icon, iconName) {\n if (icon[3]) {\n acc[icon[3]] = iconName;\n }\n\n return acc;\n });\n _byLigature = lookup(function (acc, icon, iconName) {\n var ligatures = icon[2];\n acc[iconName] = iconName;\n ligatures.forEach(function (ligature) {\n acc[ligature] = iconName;\n });\n return acc;\n });\n var hasRegular = 'far' in styles;\n _byOldName = reduce(shims, function (acc, shim) {\n var oldName = shim[0];\n var prefix = shim[1];\n var iconName = shim[2];\n\n if (prefix === 'far' && !hasRegular) {\n prefix = 'fas';\n }\n\n acc[oldName] = {\n prefix: prefix,\n iconName: iconName\n };\n return acc;\n }, {});\n};\nbuild();\nfunction byUnicode(prefix, unicode) {\n return (_byUnicode[prefix] || {})[unicode];\n}\nfunction byLigature(prefix, ligature) {\n return (_byLigature[prefix] || {})[ligature];\n}\nfunction byOldName(name) {\n return _byOldName[name] || {\n prefix: null,\n iconName: null\n };\n}\n\nvar styles$1 = namespace.styles;\nvar emptyCanonicalIcon = function emptyCanonicalIcon() {\n return {\n prefix: null,\n iconName: null,\n rest: []\n };\n};\nfunction getCanonicalIcon(values) {\n return values.reduce(function (acc, cls) {\n var iconName = getIconName(config.familyPrefix, cls);\n\n if (styles$1[cls]) {\n acc.prefix = cls;\n } else if (config.autoFetchSvg && ['fas', 'far', 'fal', 'fad', 'fab', 'fa'].indexOf(cls) > -1) {\n acc.prefix = cls;\n } else if (iconName) {\n var shim = acc.prefix === 'fa' ? byOldName(iconName) : {};\n acc.iconName = shim.iconName || iconName;\n acc.prefix = shim.prefix || acc.prefix;\n } else if (cls !== config.replacementClass && cls.indexOf('fa-w-') !== 0) {\n acc.rest.push(cls);\n }\n\n return acc;\n }, emptyCanonicalIcon());\n}\nfunction iconFromMapping(mapping, prefix, iconName) {\n if (mapping && mapping[prefix] && mapping[prefix][iconName]) {\n return {\n prefix: prefix,\n iconName: iconName,\n icon: mapping[prefix][iconName]\n };\n }\n}\n\nfunction toHtml(abstractNodes) {\n var tag = abstractNodes.tag,\n _abstractNodes$attrib = abstractNodes.attributes,\n attributes = _abstractNodes$attrib === void 0 ? {} : _abstractNodes$attrib,\n _abstractNodes$childr = abstractNodes.children,\n children = _abstractNodes$childr === void 0 ? [] : _abstractNodes$childr;\n\n if (typeof abstractNodes === 'string') {\n return htmlEscape(abstractNodes);\n } else {\n return \"<\".concat(tag, \" \").concat(joinAttributes(attributes), \">\").concat(children.map(toHtml).join(''), \"\");\n }\n}\n\nvar noop$2 = function noop() {};\n\nfunction isWatched(node) {\n var i2svg = node.getAttribute ? node.getAttribute(DATA_FA_I2SVG) : null;\n return typeof i2svg === 'string';\n}\n\nfunction getMutator() {\n if (config.autoReplaceSvg === true) {\n return mutators.replace;\n }\n\n var mutator = mutators[config.autoReplaceSvg];\n return mutator || mutators.replace;\n}\n\nvar mutators = {\n replace: function replace(mutation) {\n var node = mutation[0];\n var abstract = mutation[1];\n var newOuterHTML = abstract.map(function (a) {\n return toHtml(a);\n }).join('\\n');\n\n if (node.parentNode && node.outerHTML) {\n node.outerHTML = newOuterHTML + (config.keepOriginalSource && node.tagName.toLowerCase() !== 'svg' ? \"\") : '');\n } else if (node.parentNode) {\n var newNode = document.createElement('span');\n node.parentNode.replaceChild(newNode, node);\n newNode.outerHTML = newOuterHTML;\n }\n },\n nest: function nest(mutation) {\n var node = mutation[0];\n var abstract = mutation[1]; // If we already have a replaced node we do not want to continue nesting within it.\n // Short-circuit to the standard replacement\n\n if (~classArray(node).indexOf(config.replacementClass)) {\n return mutators.replace(mutation);\n }\n\n var forSvg = new RegExp(\"\".concat(config.familyPrefix, \"-.*\"));\n delete abstract[0].attributes.style;\n delete abstract[0].attributes.id;\n var splitClasses = abstract[0].attributes.class.split(' ').reduce(function (acc, cls) {\n if (cls === config.replacementClass || cls.match(forSvg)) {\n acc.toSvg.push(cls);\n } else {\n acc.toNode.push(cls);\n }\n\n return acc;\n }, {\n toNode: [],\n toSvg: []\n });\n abstract[0].attributes.class = splitClasses.toSvg.join(' ');\n var newInnerHTML = abstract.map(function (a) {\n return toHtml(a);\n }).join('\\n');\n node.setAttribute('class', splitClasses.toNode.join(' '));\n node.setAttribute(DATA_FA_I2SVG, '');\n node.innerHTML = newInnerHTML;\n }\n};\n\nfunction performOperationSync(op) {\n op();\n}\n\nfunction perform(mutations, callback) {\n var callbackFunction = typeof callback === 'function' ? callback : noop$2;\n\n if (mutations.length === 0) {\n callbackFunction();\n } else {\n var frame = performOperationSync;\n\n if (config.mutateApproach === MUTATION_APPROACH_ASYNC) {\n frame = WINDOW.requestAnimationFrame || performOperationSync;\n }\n\n frame(function () {\n var mutator = getMutator();\n var mark = perf.begin('mutate');\n mutations.map(mutator);\n mark();\n callbackFunction();\n });\n }\n}\nvar disabled = false;\nfunction disableObservation() {\n disabled = true;\n}\nfunction enableObservation() {\n disabled = false;\n}\nvar mo = null;\nfunction observe(options) {\n if (!MUTATION_OBSERVER) {\n return;\n }\n\n if (!config.observeMutations) {\n return;\n }\n\n var treeCallback = options.treeCallback,\n nodeCallback = options.nodeCallback,\n pseudoElementsCallback = options.pseudoElementsCallback,\n _options$observeMutat = options.observeMutationsRoot,\n observeMutationsRoot = _options$observeMutat === void 0 ? DOCUMENT : _options$observeMutat;\n mo = new MUTATION_OBSERVER(function (objects) {\n if (disabled) return;\n toArray(objects).forEach(function (mutationRecord) {\n if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) {\n if (config.searchPseudoElements) {\n pseudoElementsCallback(mutationRecord.target);\n }\n\n treeCallback(mutationRecord.target);\n }\n\n if (mutationRecord.type === 'attributes' && mutationRecord.target.parentNode && config.searchPseudoElements) {\n pseudoElementsCallback(mutationRecord.target.parentNode);\n }\n\n if (mutationRecord.type === 'attributes' && isWatched(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) {\n if (mutationRecord.attributeName === 'class') {\n var _getCanonicalIcon = getCanonicalIcon(classArray(mutationRecord.target)),\n prefix = _getCanonicalIcon.prefix,\n iconName = _getCanonicalIcon.iconName;\n\n if (prefix) mutationRecord.target.setAttribute('data-prefix', prefix);\n if (iconName) mutationRecord.target.setAttribute('data-icon', iconName);\n } else {\n nodeCallback(mutationRecord.target);\n }\n }\n });\n });\n if (!IS_DOM) return;\n mo.observe(observeMutationsRoot, {\n childList: true,\n attributes: true,\n characterData: true,\n subtree: true\n });\n}\nfunction disconnect() {\n if (!mo) return;\n mo.disconnect();\n}\n\nfunction styleParser (node) {\n var style = node.getAttribute('style');\n var val = [];\n\n if (style) {\n val = style.split(';').reduce(function (acc, style) {\n var styles = style.split(':');\n var prop = styles[0];\n var value = styles.slice(1);\n\n if (prop && value.length > 0) {\n acc[prop] = value.join(':').trim();\n }\n\n return acc;\n }, {});\n }\n\n return val;\n}\n\nfunction classParser (node) {\n var existingPrefix = node.getAttribute('data-prefix');\n var existingIconName = node.getAttribute('data-icon');\n var innerText = node.innerText !== undefined ? node.innerText.trim() : '';\n var val = getCanonicalIcon(classArray(node));\n\n if (existingPrefix && existingIconName) {\n val.prefix = existingPrefix;\n val.iconName = existingIconName;\n }\n\n if (val.prefix && innerText.length > 1) {\n val.iconName = byLigature(val.prefix, node.innerText);\n } else if (val.prefix && innerText.length === 1) {\n val.iconName = byUnicode(val.prefix, toHex(node.innerText));\n }\n\n return val;\n}\n\nvar parseTransformString = function parseTransformString(transformString) {\n var transform = {\n size: 16,\n x: 0,\n y: 0,\n flipX: false,\n flipY: false,\n rotate: 0\n };\n\n if (!transformString) {\n return transform;\n } else {\n return transformString.toLowerCase().split(' ').reduce(function (acc, n) {\n var parts = n.toLowerCase().split('-');\n var first = parts[0];\n var rest = parts.slice(1).join('-');\n\n if (first && rest === 'h') {\n acc.flipX = true;\n return acc;\n }\n\n if (first && rest === 'v') {\n acc.flipY = true;\n return acc;\n }\n\n rest = parseFloat(rest);\n\n if (isNaN(rest)) {\n return acc;\n }\n\n switch (first) {\n case 'grow':\n acc.size = acc.size + rest;\n break;\n\n case 'shrink':\n acc.size = acc.size - rest;\n break;\n\n case 'left':\n acc.x = acc.x - rest;\n break;\n\n case 'right':\n acc.x = acc.x + rest;\n break;\n\n case 'up':\n acc.y = acc.y - rest;\n break;\n\n case 'down':\n acc.y = acc.y + rest;\n break;\n\n case 'rotate':\n acc.rotate = acc.rotate + rest;\n break;\n }\n\n return acc;\n }, transform);\n }\n};\nfunction transformParser (node) {\n return parseTransformString(node.getAttribute('data-fa-transform'));\n}\n\nfunction symbolParser (node) {\n var symbol = node.getAttribute('data-fa-symbol');\n return symbol === null ? false : symbol === '' ? true : symbol;\n}\n\nfunction attributesParser (node) {\n var extraAttributes = toArray(node.attributes).reduce(function (acc, attr) {\n if (acc.name !== 'class' && acc.name !== 'style') {\n acc[attr.name] = attr.value;\n }\n\n return acc;\n }, {});\n var title = node.getAttribute('title');\n\n if (config.autoA11y) {\n if (title) {\n extraAttributes['aria-labelledby'] = \"\".concat(config.replacementClass, \"-title-\").concat(nextUniqueId());\n } else {\n extraAttributes['aria-hidden'] = 'true';\n extraAttributes['focusable'] = 'false';\n }\n }\n\n return extraAttributes;\n}\n\nfunction maskParser (node) {\n var mask = node.getAttribute('data-fa-mask');\n\n if (!mask) {\n return emptyCanonicalIcon();\n } else {\n return getCanonicalIcon(mask.split(' ').map(function (i) {\n return i.trim();\n }));\n }\n}\n\nfunction blankMeta() {\n return {\n iconName: null,\n title: null,\n prefix: null,\n transform: meaninglessTransform,\n symbol: false,\n mask: null,\n extra: {\n classes: [],\n styles: {},\n attributes: {}\n }\n };\n}\nfunction parseMeta(node) {\n var _classParser = classParser(node),\n iconName = _classParser.iconName,\n prefix = _classParser.prefix,\n extraClasses = _classParser.rest;\n\n var extraStyles = styleParser(node);\n var transform = transformParser(node);\n var symbol = symbolParser(node);\n var extraAttributes = attributesParser(node);\n var mask = maskParser(node);\n return {\n iconName: iconName,\n title: node.getAttribute('title'),\n prefix: prefix,\n transform: transform,\n symbol: symbol,\n mask: mask,\n extra: {\n classes: extraClasses,\n styles: extraStyles,\n attributes: extraAttributes\n }\n };\n}\n\nfunction MissingIcon(error) {\n this.name = 'MissingIcon';\n this.message = error || 'Icon unavailable';\n this.stack = new Error().stack;\n}\nMissingIcon.prototype = Object.create(Error.prototype);\nMissingIcon.prototype.constructor = MissingIcon;\n\nvar FILL = {\n fill: 'currentColor'\n};\nvar ANIMATION_BASE = {\n attributeType: 'XML',\n repeatCount: 'indefinite',\n dur: '2s'\n};\nvar RING = {\n tag: 'path',\n attributes: _objectSpread({}, FILL, {\n d: 'M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z'\n })\n};\n\nvar OPACITY_ANIMATE = _objectSpread({}, ANIMATION_BASE, {\n attributeName: 'opacity'\n});\n\nvar DOT = {\n tag: 'circle',\n attributes: _objectSpread({}, FILL, {\n cx: '256',\n cy: '364',\n r: '28'\n }),\n children: [{\n tag: 'animate',\n attributes: _objectSpread({}, ANIMATION_BASE, {\n attributeName: 'r',\n values: '28;14;28;28;14;28;'\n })\n }, {\n tag: 'animate',\n attributes: _objectSpread({}, OPACITY_ANIMATE, {\n values: '1;0;1;1;0;1;'\n })\n }]\n};\nvar QUESTION = {\n tag: 'path',\n attributes: _objectSpread({}, FILL, {\n opacity: '1',\n d: 'M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z'\n }),\n children: [{\n tag: 'animate',\n attributes: _objectSpread({}, OPACITY_ANIMATE, {\n values: '1;0;0;0;0;1;'\n })\n }]\n};\nvar EXCLAMATION = {\n tag: 'path',\n attributes: _objectSpread({}, FILL, {\n opacity: '0',\n d: 'M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z'\n }),\n children: [{\n tag: 'animate',\n attributes: _objectSpread({}, OPACITY_ANIMATE, {\n values: '0;0;1;1;0;0;'\n })\n }]\n};\nvar missing = {\n tag: 'g',\n children: [RING, DOT, QUESTION, EXCLAMATION]\n};\n\nvar styles$2 = namespace.styles;\nfunction asFoundIcon(icon) {\n var width = icon[0];\n var height = icon[1];\n\n var _icon$slice = icon.slice(4),\n _icon$slice2 = _slicedToArray(_icon$slice, 1),\n vectorData = _icon$slice2[0];\n\n var element = null;\n\n if (Array.isArray(vectorData)) {\n element = {\n tag: 'g',\n attributes: {\n class: \"\".concat(config.familyPrefix, \"-\").concat(DUOTONE_CLASSES.GROUP)\n },\n children: [{\n tag: 'path',\n attributes: {\n class: \"\".concat(config.familyPrefix, \"-\").concat(DUOTONE_CLASSES.SECONDARY),\n fill: 'currentColor',\n d: vectorData[0]\n }\n }, {\n tag: 'path',\n attributes: {\n class: \"\".concat(config.familyPrefix, \"-\").concat(DUOTONE_CLASSES.PRIMARY),\n fill: 'currentColor',\n d: vectorData[1]\n }\n }]\n };\n } else {\n element = {\n tag: 'path',\n attributes: {\n fill: 'currentColor',\n d: vectorData\n }\n };\n }\n\n return {\n found: true,\n width: width,\n height: height,\n icon: element\n };\n}\nfunction findIcon(iconName, prefix) {\n return new picked(function (resolve, reject) {\n var val = {\n found: false,\n width: 512,\n height: 512,\n icon: missing\n };\n\n if (iconName && prefix && styles$2[prefix] && styles$2[prefix][iconName]) {\n var icon = styles$2[prefix][iconName];\n return resolve(asFoundIcon(icon));\n }\n\n var headers = {};\n\n if (_typeof(WINDOW.FontAwesomeKitConfig) === 'object' && typeof window.FontAwesomeKitConfig.token === 'string') {\n headers['fa-kit-token'] = WINDOW.FontAwesomeKitConfig.token;\n }\n\n if (iconName && prefix && !config.showMissingIcons) {\n reject(new MissingIcon(\"Icon is missing for prefix \".concat(prefix, \" with icon name \").concat(iconName)));\n } else {\n resolve(val);\n }\n });\n}\n\nvar styles$3 = namespace.styles;\n\nfunction generateSvgReplacementMutation(node, nodeMeta) {\n var iconName = nodeMeta.iconName,\n title = nodeMeta.title,\n prefix = nodeMeta.prefix,\n transform = nodeMeta.transform,\n symbol = nodeMeta.symbol,\n mask = nodeMeta.mask,\n extra = nodeMeta.extra;\n return new picked(function (resolve, reject) {\n picked.all([findIcon(iconName, prefix), findIcon(mask.iconName, mask.prefix)]).then(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n main = _ref2[0],\n mask = _ref2[1];\n\n resolve([node, makeInlineSvgAbstract({\n icons: {\n main: main,\n mask: mask\n },\n prefix: prefix,\n iconName: iconName,\n transform: transform,\n symbol: symbol,\n mask: mask,\n title: title,\n extra: extra,\n watchable: true\n })]);\n });\n });\n}\n\nfunction generateLayersText(node, nodeMeta) {\n var title = nodeMeta.title,\n transform = nodeMeta.transform,\n extra = nodeMeta.extra;\n var width = null;\n var height = null;\n\n if (IS_IE) {\n var computedFontSize = parseInt(getComputedStyle(node).fontSize, 10);\n var boundingClientRect = node.getBoundingClientRect();\n width = boundingClientRect.width / computedFontSize;\n height = boundingClientRect.height / computedFontSize;\n }\n\n if (config.autoA11y && !title) {\n extra.attributes['aria-hidden'] = 'true';\n }\n\n return picked.resolve([node, makeLayersTextAbstract({\n content: node.innerHTML,\n width: width,\n height: height,\n transform: transform,\n title: title,\n extra: extra,\n watchable: true\n })]);\n}\n\nfunction generateMutation(node) {\n var nodeMeta = parseMeta(node);\n\n if (~nodeMeta.extra.classes.indexOf(LAYERS_TEXT_CLASSNAME)) {\n return generateLayersText(node, nodeMeta);\n } else {\n return generateSvgReplacementMutation(node, nodeMeta);\n }\n}\n\nfunction onTree(root) {\n var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n if (!IS_DOM) return;\n var htmlClassList = DOCUMENT.documentElement.classList;\n\n var hclAdd = function hclAdd(suffix) {\n return htmlClassList.add(\"\".concat(HTML_CLASS_I2SVG_BASE_CLASS, \"-\").concat(suffix));\n };\n\n var hclRemove = function hclRemove(suffix) {\n return htmlClassList.remove(\"\".concat(HTML_CLASS_I2SVG_BASE_CLASS, \"-\").concat(suffix));\n };\n\n var prefixes = config.autoFetchSvg ? Object.keys(PREFIX_TO_STYLE) : Object.keys(styles$3);\n var prefixesDomQuery = [\".\".concat(LAYERS_TEXT_CLASSNAME, \":not([\").concat(DATA_FA_I2SVG, \"])\")].concat(prefixes.map(function (p) {\n return \".\".concat(p, \":not([\").concat(DATA_FA_I2SVG, \"])\");\n })).join(', ');\n\n if (prefixesDomQuery.length === 0) {\n return;\n }\n\n var candidates = [];\n\n try {\n candidates = toArray(root.querySelectorAll(prefixesDomQuery));\n } catch (e) {// noop\n }\n\n if (candidates.length > 0) {\n hclAdd('pending');\n hclRemove('complete');\n } else {\n return;\n }\n\n var mark = perf.begin('onTree');\n var mutations = candidates.reduce(function (acc, node) {\n try {\n var mutation = generateMutation(node);\n\n if (mutation) {\n acc.push(mutation);\n }\n } catch (e) {\n if (!PRODUCTION) {\n if (e instanceof MissingIcon) {\n console.error(e);\n }\n }\n }\n\n return acc;\n }, []);\n return new picked(function (resolve, reject) {\n picked.all(mutations).then(function (resolvedMutations) {\n perform(resolvedMutations, function () {\n hclAdd('active');\n hclAdd('complete');\n hclRemove('pending');\n if (typeof callback === 'function') callback();\n mark();\n resolve();\n });\n }).catch(function () {\n mark();\n reject();\n });\n });\n}\nfunction onNode(node) {\n var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n generateMutation(node).then(function (mutation) {\n if (mutation) {\n perform([mutation], callback);\n }\n });\n}\n\nfunction replaceForPosition(node, position) {\n var pendingAttribute = \"\".concat(DATA_FA_PSEUDO_ELEMENT_PENDING).concat(position.replace(':', '-'));\n return new picked(function (resolve, reject) {\n if (node.getAttribute(pendingAttribute) !== null) {\n // This node is already being processed\n return resolve();\n }\n\n var children = toArray(node.children);\n var alreadyProcessedPseudoElement = children.filter(function (c) {\n return c.getAttribute(DATA_FA_PSEUDO_ELEMENT) === position;\n })[0];\n var styles = WINDOW.getComputedStyle(node, position);\n var fontFamily = styles.getPropertyValue('font-family').match(FONT_FAMILY_PATTERN);\n var fontWeight = styles.getPropertyValue('font-weight');\n\n if (alreadyProcessedPseudoElement && !fontFamily) {\n // If we've already processed it but the current computed style does not result in a font-family,\n // that probably means that a class name that was previously present to make the icon has been\n // removed. So we now should delete the icon.\n node.removeChild(alreadyProcessedPseudoElement);\n return resolve();\n } else if (fontFamily) {\n var content = styles.getPropertyValue('content');\n var prefix = ~['Solid', 'Regular', 'Light', 'Duotone', 'Brands'].indexOf(fontFamily[1]) ? STYLE_TO_PREFIX[fontFamily[1].toLowerCase()] : FONT_WEIGHT_TO_PREFIX[fontWeight];\n var hexValue = toHex(content.length === 3 ? content.substr(1, 1) : content);\n var iconName = byUnicode(prefix, hexValue);\n var iconIdentifier = iconName; // Only convert the pseudo element in this :before/:after position into an icon if we haven't\n // already done so with the same prefix and iconName\n\n if (iconName && (!alreadyProcessedPseudoElement || alreadyProcessedPseudoElement.getAttribute(DATA_PREFIX) !== prefix || alreadyProcessedPseudoElement.getAttribute(DATA_ICON) !== iconIdentifier)) {\n node.setAttribute(pendingAttribute, iconIdentifier);\n\n if (alreadyProcessedPseudoElement) {\n // Delete the old one, since we're replacing it with a new one\n node.removeChild(alreadyProcessedPseudoElement);\n }\n\n var meta = blankMeta();\n var extra = meta.extra;\n extra.attributes[DATA_FA_PSEUDO_ELEMENT] = position;\n findIcon(iconName, prefix).then(function (main) {\n var abstract = makeInlineSvgAbstract(_objectSpread({}, meta, {\n icons: {\n main: main,\n mask: emptyCanonicalIcon()\n },\n prefix: prefix,\n iconName: iconIdentifier,\n extra: extra,\n watchable: true\n }));\n var element = DOCUMENT.createElement('svg');\n\n if (position === ':before') {\n node.insertBefore(element, node.firstChild);\n } else {\n node.appendChild(element);\n }\n\n element.outerHTML = abstract.map(function (a) {\n return toHtml(a);\n }).join('\\n');\n node.removeAttribute(pendingAttribute);\n resolve();\n }).catch(reject);\n } else {\n resolve();\n }\n } else {\n resolve();\n }\n });\n}\n\nfunction replace(node) {\n return picked.all([replaceForPosition(node, ':before'), replaceForPosition(node, ':after')]);\n}\n\nfunction processable(node) {\n return node.parentNode !== document.head && !~TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS.indexOf(node.tagName.toUpperCase()) && !node.getAttribute(DATA_FA_PSEUDO_ELEMENT) && (!node.parentNode || node.parentNode.tagName !== 'svg');\n}\n\nfunction searchPseudoElements (root) {\n if (!IS_DOM) return;\n return new picked(function (resolve, reject) {\n var operations = toArray(root.querySelectorAll('*')).filter(processable).map(replace);\n var end = perf.begin('searchPseudoElements');\n disableObservation();\n picked.all(operations).then(function () {\n end();\n enableObservation();\n resolve();\n }).catch(function () {\n end();\n enableObservation();\n reject();\n });\n });\n}\n\nvar baseStyles = \"svg:not(:root).svg-inline--fa {\\n overflow: visible;\\n}\\n\\n.svg-inline--fa {\\n display: inline-block;\\n font-size: inherit;\\n height: 1em;\\n overflow: visible;\\n vertical-align: -0.125em;\\n}\\n.svg-inline--fa.fa-lg {\\n vertical-align: -0.225em;\\n}\\n.svg-inline--fa.fa-w-1 {\\n width: 0.0625em;\\n}\\n.svg-inline--fa.fa-w-2 {\\n width: 0.125em;\\n}\\n.svg-inline--fa.fa-w-3 {\\n width: 0.1875em;\\n}\\n.svg-inline--fa.fa-w-4 {\\n width: 0.25em;\\n}\\n.svg-inline--fa.fa-w-5 {\\n width: 0.3125em;\\n}\\n.svg-inline--fa.fa-w-6 {\\n width: 0.375em;\\n}\\n.svg-inline--fa.fa-w-7 {\\n width: 0.4375em;\\n}\\n.svg-inline--fa.fa-w-8 {\\n width: 0.5em;\\n}\\n.svg-inline--fa.fa-w-9 {\\n width: 0.5625em;\\n}\\n.svg-inline--fa.fa-w-10 {\\n width: 0.625em;\\n}\\n.svg-inline--fa.fa-w-11 {\\n width: 0.6875em;\\n}\\n.svg-inline--fa.fa-w-12 {\\n width: 0.75em;\\n}\\n.svg-inline--fa.fa-w-13 {\\n width: 0.8125em;\\n}\\n.svg-inline--fa.fa-w-14 {\\n width: 0.875em;\\n}\\n.svg-inline--fa.fa-w-15 {\\n width: 0.9375em;\\n}\\n.svg-inline--fa.fa-w-16 {\\n width: 1em;\\n}\\n.svg-inline--fa.fa-w-17 {\\n width: 1.0625em;\\n}\\n.svg-inline--fa.fa-w-18 {\\n width: 1.125em;\\n}\\n.svg-inline--fa.fa-w-19 {\\n width: 1.1875em;\\n}\\n.svg-inline--fa.fa-w-20 {\\n width: 1.25em;\\n}\\n.svg-inline--fa.fa-pull-left {\\n margin-right: 0.3em;\\n width: auto;\\n}\\n.svg-inline--fa.fa-pull-right {\\n margin-left: 0.3em;\\n width: auto;\\n}\\n.svg-inline--fa.fa-border {\\n height: 1.5em;\\n}\\n.svg-inline--fa.fa-li {\\n width: 2em;\\n}\\n.svg-inline--fa.fa-fw {\\n width: 1.25em;\\n}\\n\\n.fa-layers svg.svg-inline--fa {\\n bottom: 0;\\n left: 0;\\n margin: auto;\\n position: absolute;\\n right: 0;\\n top: 0;\\n}\\n\\n.fa-layers {\\n display: inline-block;\\n height: 1em;\\n position: relative;\\n text-align: center;\\n vertical-align: -0.125em;\\n width: 1em;\\n}\\n.fa-layers svg.svg-inline--fa {\\n -webkit-transform-origin: center center;\\n transform-origin: center center;\\n}\\n\\n.fa-layers-counter, .fa-layers-text {\\n display: inline-block;\\n position: absolute;\\n text-align: center;\\n}\\n\\n.fa-layers-text {\\n left: 50%;\\n top: 50%;\\n -webkit-transform: translate(-50%, -50%);\\n transform: translate(-50%, -50%);\\n -webkit-transform-origin: center center;\\n transform-origin: center center;\\n}\\n\\n.fa-layers-counter {\\n background-color: #ff253a;\\n border-radius: 1em;\\n -webkit-box-sizing: border-box;\\n box-sizing: border-box;\\n color: #fff;\\n height: 1.5em;\\n line-height: 1;\\n max-width: 5em;\\n min-width: 1.5em;\\n overflow: hidden;\\n padding: 0.25em;\\n right: 0;\\n text-overflow: ellipsis;\\n top: 0;\\n -webkit-transform: scale(0.25);\\n transform: scale(0.25);\\n -webkit-transform-origin: top right;\\n transform-origin: top right;\\n}\\n\\n.fa-layers-bottom-right {\\n bottom: 0;\\n right: 0;\\n top: auto;\\n -webkit-transform: scale(0.25);\\n transform: scale(0.25);\\n -webkit-transform-origin: bottom right;\\n transform-origin: bottom right;\\n}\\n\\n.fa-layers-bottom-left {\\n bottom: 0;\\n left: 0;\\n right: auto;\\n top: auto;\\n -webkit-transform: scale(0.25);\\n transform: scale(0.25);\\n -webkit-transform-origin: bottom left;\\n transform-origin: bottom left;\\n}\\n\\n.fa-layers-top-right {\\n right: 0;\\n top: 0;\\n -webkit-transform: scale(0.25);\\n transform: scale(0.25);\\n -webkit-transform-origin: top right;\\n transform-origin: top right;\\n}\\n\\n.fa-layers-top-left {\\n left: 0;\\n right: auto;\\n top: 0;\\n -webkit-transform: scale(0.25);\\n transform: scale(0.25);\\n -webkit-transform-origin: top left;\\n transform-origin: top left;\\n}\\n\\n.fa-lg {\\n font-size: 1.3333333333em;\\n line-height: 0.75em;\\n vertical-align: -0.0667em;\\n}\\n\\n.fa-xs {\\n font-size: 0.75em;\\n}\\n\\n.fa-sm {\\n font-size: 0.875em;\\n}\\n\\n.fa-1x {\\n font-size: 1em;\\n}\\n\\n.fa-2x {\\n font-size: 2em;\\n}\\n\\n.fa-3x {\\n font-size: 3em;\\n}\\n\\n.fa-4x {\\n font-size: 4em;\\n}\\n\\n.fa-5x {\\n font-size: 5em;\\n}\\n\\n.fa-6x {\\n font-size: 6em;\\n}\\n\\n.fa-7x {\\n font-size: 7em;\\n}\\n\\n.fa-8x {\\n font-size: 8em;\\n}\\n\\n.fa-9x {\\n font-size: 9em;\\n}\\n\\n.fa-10x {\\n font-size: 10em;\\n}\\n\\n.fa-fw {\\n text-align: center;\\n width: 1.25em;\\n}\\n\\n.fa-ul {\\n list-style-type: none;\\n margin-left: 2.5em;\\n padding-left: 0;\\n}\\n.fa-ul > li {\\n position: relative;\\n}\\n\\n.fa-li {\\n left: -2em;\\n position: absolute;\\n text-align: center;\\n width: 2em;\\n line-height: inherit;\\n}\\n\\n.fa-border {\\n border: solid 0.08em #eee;\\n border-radius: 0.1em;\\n padding: 0.2em 0.25em 0.15em;\\n}\\n\\n.fa-pull-left {\\n float: left;\\n}\\n\\n.fa-pull-right {\\n float: right;\\n}\\n\\n.fa.fa-pull-left,\\n.fas.fa-pull-left,\\n.far.fa-pull-left,\\n.fal.fa-pull-left,\\n.fab.fa-pull-left {\\n margin-right: 0.3em;\\n}\\n.fa.fa-pull-right,\\n.fas.fa-pull-right,\\n.far.fa-pull-right,\\n.fal.fa-pull-right,\\n.fab.fa-pull-right {\\n margin-left: 0.3em;\\n}\\n\\n.fa-spin {\\n -webkit-animation: fa-spin 2s infinite linear;\\n animation: fa-spin 2s infinite linear;\\n}\\n\\n.fa-pulse {\\n -webkit-animation: fa-spin 1s infinite steps(8);\\n animation: fa-spin 1s infinite steps(8);\\n}\\n\\n@-webkit-keyframes fa-spin {\\n 0% {\\n -webkit-transform: rotate(0deg);\\n transform: rotate(0deg);\\n }\\n 100% {\\n -webkit-transform: rotate(360deg);\\n transform: rotate(360deg);\\n }\\n}\\n\\n@keyframes fa-spin {\\n 0% {\\n -webkit-transform: rotate(0deg);\\n transform: rotate(0deg);\\n }\\n 100% {\\n -webkit-transform: rotate(360deg);\\n transform: rotate(360deg);\\n }\\n}\\n.fa-rotate-90 {\\n -ms-filter: \\\"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)\\\";\\n -webkit-transform: rotate(90deg);\\n transform: rotate(90deg);\\n}\\n\\n.fa-rotate-180 {\\n -ms-filter: \\\"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)\\\";\\n -webkit-transform: rotate(180deg);\\n transform: rotate(180deg);\\n}\\n\\n.fa-rotate-270 {\\n -ms-filter: \\\"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)\\\";\\n -webkit-transform: rotate(270deg);\\n transform: rotate(270deg);\\n}\\n\\n.fa-flip-horizontal {\\n -ms-filter: \\\"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)\\\";\\n -webkit-transform: scale(-1, 1);\\n transform: scale(-1, 1);\\n}\\n\\n.fa-flip-vertical {\\n -ms-filter: \\\"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)\\\";\\n -webkit-transform: scale(1, -1);\\n transform: scale(1, -1);\\n}\\n\\n.fa-flip-both, .fa-flip-horizontal.fa-flip-vertical {\\n -ms-filter: \\\"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)\\\";\\n -webkit-transform: scale(-1, -1);\\n transform: scale(-1, -1);\\n}\\n\\n:root .fa-rotate-90,\\n:root .fa-rotate-180,\\n:root .fa-rotate-270,\\n:root .fa-flip-horizontal,\\n:root .fa-flip-vertical,\\n:root .fa-flip-both {\\n -webkit-filter: none;\\n filter: none;\\n}\\n\\n.fa-stack {\\n display: inline-block;\\n height: 2em;\\n position: relative;\\n width: 2.5em;\\n}\\n\\n.fa-stack-1x,\\n.fa-stack-2x {\\n bottom: 0;\\n left: 0;\\n margin: auto;\\n position: absolute;\\n right: 0;\\n top: 0;\\n}\\n\\n.svg-inline--fa.fa-stack-1x {\\n height: 1em;\\n width: 1.25em;\\n}\\n.svg-inline--fa.fa-stack-2x {\\n height: 2em;\\n width: 2.5em;\\n}\\n\\n.fa-inverse {\\n color: #fff;\\n}\\n\\n.sr-only {\\n border: 0;\\n clip: rect(0, 0, 0, 0);\\n height: 1px;\\n margin: -1px;\\n overflow: hidden;\\n padding: 0;\\n position: absolute;\\n width: 1px;\\n}\\n\\n.sr-only-focusable:active, .sr-only-focusable:focus {\\n clip: auto;\\n height: auto;\\n margin: 0;\\n overflow: visible;\\n position: static;\\n width: auto;\\n}\\n\\n.svg-inline--fa .fa-primary {\\n fill: var(--fa-primary-color, currentColor);\\n opacity: 1;\\n opacity: var(--fa-primary-opacity, 1);\\n}\\n\\n.svg-inline--fa .fa-secondary {\\n fill: var(--fa-secondary-color, currentColor);\\n opacity: 0.4;\\n opacity: var(--fa-secondary-opacity, 0.4);\\n}\\n\\n.svg-inline--fa.fa-swap-opacity .fa-primary {\\n opacity: 0.4;\\n opacity: var(--fa-secondary-opacity, 0.4);\\n}\\n\\n.svg-inline--fa.fa-swap-opacity .fa-secondary {\\n opacity: 1;\\n opacity: var(--fa-primary-opacity, 1);\\n}\\n\\n.svg-inline--fa mask .fa-primary,\\n.svg-inline--fa mask .fa-secondary {\\n fill: black;\\n}\\n\\n.fad.fa-inverse {\\n color: #fff;\\n}\";\n\nfunction css () {\n var dfp = DEFAULT_FAMILY_PREFIX;\n var drc = DEFAULT_REPLACEMENT_CLASS;\n var fp = config.familyPrefix;\n var rc = config.replacementClass;\n var s = baseStyles;\n\n if (fp !== dfp || rc !== drc) {\n var dPatt = new RegExp(\"\\\\.\".concat(dfp, \"\\\\-\"), 'g');\n var customPropPatt = new RegExp(\"\\\\--\".concat(dfp, \"\\\\-\"), 'g');\n var rPatt = new RegExp(\"\\\\.\".concat(drc), 'g');\n s = s.replace(dPatt, \".\".concat(fp, \"-\")).replace(customPropPatt, \"--\".concat(fp, \"-\")).replace(rPatt, \".\".concat(rc));\n }\n\n return s;\n}\n\nvar Library =\n/*#__PURE__*/\nfunction () {\n function Library() {\n _classCallCheck(this, Library);\n\n this.definitions = {};\n }\n\n _createClass(Library, [{\n key: \"add\",\n value: function add() {\n var _this = this;\n\n for (var _len = arguments.length, definitions = new Array(_len), _key = 0; _key < _len; _key++) {\n definitions[_key] = arguments[_key];\n }\n\n var additions = definitions.reduce(this._pullDefinitions, {});\n Object.keys(additions).forEach(function (key) {\n _this.definitions[key] = _objectSpread({}, _this.definitions[key] || {}, additions[key]);\n defineIcons(key, additions[key]);\n build();\n });\n }\n }, {\n key: \"reset\",\n value: function reset() {\n this.definitions = {};\n }\n }, {\n key: \"_pullDefinitions\",\n value: function _pullDefinitions(additions, definition) {\n var normalized = definition.prefix && definition.iconName && definition.icon ? {\n 0: definition\n } : definition;\n Object.keys(normalized).map(function (key) {\n var _normalized$key = normalized[key],\n prefix = _normalized$key.prefix,\n iconName = _normalized$key.iconName,\n icon = _normalized$key.icon;\n if (!additions[prefix]) additions[prefix] = {};\n additions[prefix][iconName] = icon;\n });\n return additions;\n }\n }]);\n\n return Library;\n}();\n\nfunction ensureCss() {\n if (config.autoAddCss && !_cssInserted) {\n insertCss(css());\n\n _cssInserted = true;\n }\n}\n\nfunction apiObject(val, abstractCreator) {\n Object.defineProperty(val, 'abstract', {\n get: abstractCreator\n });\n Object.defineProperty(val, 'html', {\n get: function get() {\n return val.abstract.map(function (a) {\n return toHtml(a);\n });\n }\n });\n Object.defineProperty(val, 'node', {\n get: function get() {\n if (!IS_DOM) return;\n var container = DOCUMENT.createElement('div');\n container.innerHTML = val.html;\n return container.children;\n }\n });\n return val;\n}\n\nfunction findIconDefinition(iconLookup) {\n var _iconLookup$prefix = iconLookup.prefix,\n prefix = _iconLookup$prefix === void 0 ? 'fa' : _iconLookup$prefix,\n iconName = iconLookup.iconName;\n if (!iconName) return;\n return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);\n}\n\nfunction resolveIcons(next) {\n return function (maybeIconDefinition) {\n var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var iconDefinition = (maybeIconDefinition || {}).icon ? maybeIconDefinition : findIconDefinition(maybeIconDefinition || {});\n var mask = params.mask;\n\n if (mask) {\n mask = (mask || {}).icon ? mask : findIconDefinition(mask || {});\n }\n\n return next(iconDefinition, _objectSpread({}, params, {\n mask: mask\n }));\n };\n}\n\nvar library = new Library();\nvar noAuto = function noAuto() {\n config.autoReplaceSvg = false;\n config.observeMutations = false;\n disconnect();\n};\nvar _cssInserted = false;\nvar dom = {\n i2svg: function i2svg() {\n var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (IS_DOM) {\n ensureCss();\n var _params$node = params.node,\n node = _params$node === void 0 ? DOCUMENT : _params$node,\n _params$callback = params.callback,\n callback = _params$callback === void 0 ? function () {} : _params$callback;\n\n if (config.searchPseudoElements) {\n searchPseudoElements(node);\n }\n\n return onTree(node, callback);\n } else {\n return picked.reject('Operation requires a DOM of some kind.');\n }\n },\n css: css,\n insertCss: function insertCss$$1() {\n if (!_cssInserted) {\n insertCss(css());\n\n _cssInserted = true;\n }\n },\n watch: function watch() {\n var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var autoReplaceSvgRoot = params.autoReplaceSvgRoot,\n observeMutationsRoot = params.observeMutationsRoot;\n\n if (config.autoReplaceSvg === false) {\n config.autoReplaceSvg = true;\n }\n\n config.observeMutations = true;\n domready(function () {\n autoReplace({\n autoReplaceSvgRoot: autoReplaceSvgRoot\n });\n observe({\n treeCallback: onTree,\n nodeCallback: onNode,\n pseudoElementsCallback: searchPseudoElements,\n observeMutationsRoot: observeMutationsRoot\n });\n });\n }\n};\nvar parse = {\n transform: function transform(transformString) {\n return parseTransformString(transformString);\n }\n};\nvar icon = resolveIcons(function (iconDefinition) {\n var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var _params$transform = params.transform,\n transform = _params$transform === void 0 ? meaninglessTransform : _params$transform,\n _params$symbol = params.symbol,\n symbol = _params$symbol === void 0 ? false : _params$symbol,\n _params$mask = params.mask,\n mask = _params$mask === void 0 ? null : _params$mask,\n _params$title = params.title,\n title = _params$title === void 0 ? null : _params$title,\n _params$classes = params.classes,\n classes = _params$classes === void 0 ? [] : _params$classes,\n _params$attributes = params.attributes,\n attributes = _params$attributes === void 0 ? {} : _params$attributes,\n _params$styles = params.styles,\n styles = _params$styles === void 0 ? {} : _params$styles;\n if (!iconDefinition) return;\n var prefix = iconDefinition.prefix,\n iconName = iconDefinition.iconName,\n icon = iconDefinition.icon;\n return apiObject(_objectSpread({\n type: 'icon'\n }, iconDefinition), function () {\n ensureCss();\n\n if (config.autoA11y) {\n if (title) {\n attributes['aria-labelledby'] = \"\".concat(config.replacementClass, \"-title-\").concat(nextUniqueId());\n } else {\n attributes['aria-hidden'] = 'true';\n attributes['focusable'] = 'false';\n }\n }\n\n return makeInlineSvgAbstract({\n icons: {\n main: asFoundIcon(icon),\n mask: mask ? asFoundIcon(mask.icon) : {\n found: false,\n width: null,\n height: null,\n icon: {}\n }\n },\n prefix: prefix,\n iconName: iconName,\n transform: _objectSpread({}, meaninglessTransform, transform),\n symbol: symbol,\n title: title,\n extra: {\n attributes: attributes,\n styles: styles,\n classes: classes\n }\n });\n });\n});\nvar text = function text(content) {\n var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var _params$transform2 = params.transform,\n transform = _params$transform2 === void 0 ? meaninglessTransform : _params$transform2,\n _params$title2 = params.title,\n title = _params$title2 === void 0 ? null : _params$title2,\n _params$classes2 = params.classes,\n classes = _params$classes2 === void 0 ? [] : _params$classes2,\n _params$attributes2 = params.attributes,\n attributes = _params$attributes2 === void 0 ? {} : _params$attributes2,\n _params$styles2 = params.styles,\n styles = _params$styles2 === void 0 ? {} : _params$styles2;\n return apiObject({\n type: 'text',\n content: content\n }, function () {\n ensureCss();\n return makeLayersTextAbstract({\n content: content,\n transform: _objectSpread({}, meaninglessTransform, transform),\n title: title,\n extra: {\n attributes: attributes,\n styles: styles,\n classes: [\"\".concat(config.familyPrefix, \"-layers-text\")].concat(_toConsumableArray(classes))\n }\n });\n });\n};\nvar counter = function counter(content) {\n var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var _params$title3 = params.title,\n title = _params$title3 === void 0 ? null : _params$title3,\n _params$classes3 = params.classes,\n classes = _params$classes3 === void 0 ? [] : _params$classes3,\n _params$attributes3 = params.attributes,\n attributes = _params$attributes3 === void 0 ? {} : _params$attributes3,\n _params$styles3 = params.styles,\n styles = _params$styles3 === void 0 ? {} : _params$styles3;\n return apiObject({\n type: 'counter',\n content: content\n }, function () {\n ensureCss();\n return makeLayersCounterAbstract({\n content: content.toString(),\n title: title,\n extra: {\n attributes: attributes,\n styles: styles,\n classes: [\"\".concat(config.familyPrefix, \"-layers-counter\")].concat(_toConsumableArray(classes))\n }\n });\n });\n};\nvar layer = function layer(assembler) {\n var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var _params$classes4 = params.classes,\n classes = _params$classes4 === void 0 ? [] : _params$classes4;\n return apiObject({\n type: 'layer'\n }, function () {\n ensureCss();\n var children = [];\n assembler(function (args) {\n Array.isArray(args) ? args.map(function (a) {\n children = children.concat(a.abstract);\n }) : children = children.concat(args.abstract);\n });\n return [{\n tag: 'span',\n attributes: {\n class: [\"\".concat(config.familyPrefix, \"-layers\")].concat(_toConsumableArray(classes)).join(' ')\n },\n children: children\n }];\n });\n};\nvar api = {\n noAuto: noAuto,\n config: config,\n dom: dom,\n library: library,\n parse: parse,\n findIconDefinition: findIconDefinition,\n icon: icon,\n text: text,\n counter: counter,\n layer: layer,\n toHtml: toHtml\n};\n\nvar autoReplace = function autoReplace() {\n var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var _params$autoReplaceSv = params.autoReplaceSvgRoot,\n autoReplaceSvgRoot = _params$autoReplaceSv === void 0 ? DOCUMENT : _params$autoReplaceSv;\n if ((Object.keys(namespace.styles).length > 0 || config.autoFetchSvg) && IS_DOM && config.autoReplaceSvg) api.dom.i2svg({\n node: autoReplaceSvgRoot\n });\n};\n\nexport { icon, noAuto, config, toHtml, layer, text, counter, library, dom, parse, findIconDefinition };\n","import { parse, icon } from '@fortawesome/fontawesome-svg-core';\nimport PropTypes from 'prop-types';\nimport React from 'react';\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n}\n\nfunction _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n}\n\n// Get CSS class list from a props object\nfunction classList(props) {\n var _classes;\n\n var spin = props.spin,\n pulse = props.pulse,\n fixedWidth = props.fixedWidth,\n inverse = props.inverse,\n border = props.border,\n listItem = props.listItem,\n flip = props.flip,\n size = props.size,\n rotation = props.rotation,\n pull = props.pull; // map of CSS class names to properties\n\n var classes = (_classes = {\n 'fa-spin': spin,\n 'fa-pulse': pulse,\n 'fa-fw': fixedWidth,\n 'fa-inverse': inverse,\n 'fa-border': border,\n 'fa-li': listItem,\n 'fa-flip-horizontal': flip === 'horizontal' || flip === 'both',\n 'fa-flip-vertical': flip === 'vertical' || flip === 'both'\n }, _defineProperty(_classes, \"fa-\".concat(size), typeof size !== 'undefined'), _defineProperty(_classes, \"fa-rotate-\".concat(rotation), typeof rotation !== 'undefined'), _defineProperty(_classes, \"fa-pull-\".concat(pull), typeof pull !== 'undefined'), _defineProperty(_classes, 'fa-swap-opacity', props.swapOpacity), _classes); // map over all the keys in the classes object\n // return an array of the keys where the value for the key is not null\n\n return Object.keys(classes).map(function (key) {\n return classes[key] ? key : null;\n }).filter(function (key) {\n return key;\n });\n}\n\n// Camelize taken from humps\n// humps is copyright © 2012+ Dom Christie\n// Released under the MIT license.\n// Performant way to determine if object coerces to a number\nfunction _isNumerical(obj) {\n obj = obj - 0; // eslint-disable-next-line no-self-compare\n\n return obj === obj;\n}\n\nfunction camelize(string) {\n if (_isNumerical(string)) {\n return string;\n } // eslint-disable-next-line no-useless-escape\n\n\n string = string.replace(/[\\-_\\s]+(.)?/g, function (match, chr) {\n return chr ? chr.toUpperCase() : '';\n }); // Ensure 1st char is always lowercase\n\n return string.substr(0, 1).toLowerCase() + string.substr(1);\n}\n\nfunction capitalize(val) {\n return val.charAt(0).toUpperCase() + val.slice(1);\n}\n\nfunction styleToObject(style) {\n return style.split(';').map(function (s) {\n return s.trim();\n }).filter(function (s) {\n return s;\n }).reduce(function (acc, pair) {\n var i = pair.indexOf(':');\n var prop = camelize(pair.slice(0, i));\n var value = pair.slice(i + 1).trim();\n prop.startsWith('webkit') ? acc[capitalize(prop)] = value : acc[prop] = value;\n return acc;\n }, {});\n}\n\nfunction convert(createElement, element) {\n var extraProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n if (typeof element === 'string') {\n return element;\n }\n\n var children = (element.children || []).map(function (child) {\n return convert(createElement, child);\n });\n var mixins = Object.keys(element.attributes || {}).reduce(function (acc, key) {\n var val = element.attributes[key];\n\n switch (key) {\n case 'class':\n acc.attrs['className'] = val;\n delete element.attributes['class'];\n break;\n\n case 'style':\n acc.attrs['style'] = styleToObject(val);\n break;\n\n default:\n if (key.indexOf('aria-') === 0 || key.indexOf('data-') === 0) {\n acc.attrs[key.toLowerCase()] = val;\n } else {\n acc.attrs[camelize(key)] = val;\n }\n\n }\n\n return acc;\n }, {\n attrs: {}\n });\n\n var _extraProps$style = extraProps.style,\n existingStyle = _extraProps$style === void 0 ? {} : _extraProps$style,\n remaining = _objectWithoutProperties(extraProps, [\"style\"]);\n\n mixins.attrs['style'] = _objectSpread({}, mixins.attrs['style'], existingStyle);\n return createElement.apply(void 0, [element.tag, _objectSpread({}, mixins.attrs, remaining)].concat(_toConsumableArray(children)));\n}\n\nvar PRODUCTION = false;\n\ntry {\n PRODUCTION = process.env.NODE_ENV === 'production';\n} catch (e) {}\n\nfunction log () {\n if (!PRODUCTION && console && typeof console.error === 'function') {\n var _console;\n\n (_console = console).error.apply(_console, arguments);\n }\n}\n\n// Normalize icon arguments\nfunction normalizeIconArgs(icon$$1) {\n // if the icon is null, there's nothing to do\n if (icon$$1 === null) {\n return null;\n } // if the icon is an object and has a prefix and an icon name, return it\n\n\n if (_typeof(icon$$1) === 'object' && icon$$1.prefix && icon$$1.iconName) {\n return icon$$1;\n } // if it's an array with length of two\n\n\n if (Array.isArray(icon$$1) && icon$$1.length === 2) {\n // use the first item as prefix, second as icon name\n return {\n prefix: icon$$1[0],\n iconName: icon$$1[1]\n };\n } // if it's a string, use it as the icon name\n\n\n if (typeof icon$$1 === 'string') {\n return {\n prefix: 'fas',\n iconName: icon$$1\n };\n }\n}\n\n// creates an object with a key of key\n// and a value of value\n// if certain conditions are met\nfunction objectWithKey(key, value) {\n // if the value is a non-empty array\n // or it's not an array but it is truthy\n // then create the object with the key and the value\n // if not, return an empty array\n return Array.isArray(value) && value.length > 0 || !Array.isArray(value) && value ? _defineProperty({}, key, value) : {};\n}\n\nfunction FontAwesomeIcon(props) {\n var iconArgs = props.icon,\n maskArgs = props.mask,\n symbol = props.symbol,\n className = props.className,\n title = props.title;\n var iconLookup = normalizeIconArgs(iconArgs);\n var classes = objectWithKey('classes', [].concat(_toConsumableArray(classList(props)), _toConsumableArray(className.split(' '))));\n var transform = objectWithKey('transform', typeof props.transform === 'string' ? parse.transform(props.transform) : props.transform);\n var mask = objectWithKey('mask', normalizeIconArgs(maskArgs));\n var renderedIcon = icon(iconLookup, _objectSpread({}, classes, transform, mask, {\n symbol: symbol,\n title: title\n }));\n\n if (!renderedIcon) {\n log('Could not find icon', iconLookup);\n return null;\n }\n\n var abstract = renderedIcon.abstract;\n var extraProps = {};\n Object.keys(props).forEach(function (key) {\n if (!FontAwesomeIcon.defaultProps.hasOwnProperty(key)) {\n extraProps[key] = props[key];\n }\n });\n return convertCurry(abstract[0], extraProps);\n}\nFontAwesomeIcon.displayName = 'FontAwesomeIcon';\nFontAwesomeIcon.propTypes = {\n border: PropTypes.bool,\n className: PropTypes.string,\n mask: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string]),\n fixedWidth: PropTypes.bool,\n inverse: PropTypes.bool,\n flip: PropTypes.oneOf(['horizontal', 'vertical', 'both']),\n icon: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string]),\n listItem: PropTypes.bool,\n pull: PropTypes.oneOf(['right', 'left']),\n pulse: PropTypes.bool,\n rotation: PropTypes.oneOf([90, 180, 270]),\n size: PropTypes.oneOf(['lg', 'xs', 'sm', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x']),\n spin: PropTypes.bool,\n symbol: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n title: PropTypes.string,\n transform: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n swapOpacity: PropTypes.bool\n};\nFontAwesomeIcon.defaultProps = {\n border: false,\n className: '',\n mask: null,\n fixedWidth: false,\n inverse: false,\n flip: null,\n icon: null,\n listItem: false,\n pull: null,\n pulse: false,\n rotation: null,\n size: null,\n spin: false,\n symbol: false,\n title: '',\n transform: null,\n swapOpacity: false\n};\nvar convertCurry = convert.bind(null, React.createElement);\n\nexport { FontAwesomeIcon };\n","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'check';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f00c';\nvar svgPathData = 'M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCheck = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'cut';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f0c4';\nvar svgPathData = 'M278.06 256L444.48 89.57c4.69-4.69 4.69-12.29 0-16.97-32.8-32.8-85.99-32.8-118.79 0L210.18 188.12l-24.86-24.86c4.31-10.92 6.68-22.81 6.68-35.26 0-53.02-42.98-96-96-96S0 74.98 0 128s42.98 96 96 96c4.54 0 8.99-.32 13.36-.93L142.29 256l-32.93 32.93c-4.37-.61-8.83-.93-13.36-.93-53.02 0-96 42.98-96 96s42.98 96 96 96 96-42.98 96-96c0-12.45-2.37-24.34-6.68-35.26l24.86-24.86L325.69 439.4c32.8 32.8 85.99 32.8 118.79 0 4.69-4.68 4.69-12.28 0-16.97L278.06 256zM96 160c-17.64 0-32-14.36-32-32s14.36-32 32-32 32 14.36 32 32-14.36 32-32 32zm0 256c-17.64 0-32-14.36-32-32s14.36-32 32-32 32 14.36 32 32-14.36 32-32 32z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCut = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'cog';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f013';\nvar svgPathData = 'M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCog = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'copy';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f0c5';\nvar svgPathData = 'M320 448v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V120c0-13.255 10.745-24 24-24h72v296c0 30.879 25.121 56 56 56h168zm0-344V0H152c-13.255 0-24 10.745-24 24v368c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24V128H344c-13.2 0-24-10.8-24-24zm120.971-31.029L375.029 7.029A24 24 0 0 0 358.059 0H352v96h96v-6.059a24 24 0 0 0-7.029-16.97z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCopy = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-alt';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f15c';\nvar svgPathData = 'M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm64 236c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12v8zm0-64c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12v8zm0-72v8c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12zm96-114.1v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFileAlt = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'images';\nvar width = 576;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f302';\nvar svgPathData = 'M480 416v16c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V176c0-26.51 21.49-48 48-48h16v208c0 44.112 35.888 80 80 80h336zm96-80V80c0-26.51-21.49-48-48-48H144c-26.51 0-48 21.49-48 48v256c0 26.51 21.49 48 48 48h384c26.51 0 48-21.49 48-48zM256 128c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-96 144l55.515-55.515c4.686-4.686 12.284-4.686 16.971 0L272 256l135.515-135.515c4.686-4.686 12.284-4.686 16.971 0L512 208v112H160v-48z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faImages = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'link';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f0c1';\nvar svgPathData = 'M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faLink = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'minus';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f068';\nvar svgPathData = 'M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faMinus = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'paste';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f0ea';\nvar svgPathData = 'M128 184c0-30.879 25.122-56 56-56h136V56c0-13.255-10.745-24-24-24h-80.61C204.306 12.89 183.637 0 160 0s-44.306 12.89-55.39 32H24C10.745 32 0 42.745 0 56v336c0 13.255 10.745 24 24 24h104V184zm32-144c13.255 0 24 10.745 24 24s-10.745 24-24 24-24-10.745-24-24 10.745-24 24-24zm184 248h104v200c0 13.255-10.745 24-24 24H184c-13.255 0-24-10.745-24-24V184c0-13.255 10.745-24 24-24h136v104c0 13.2 10.8 24 24 24zm104-38.059V256h-96v-96h6.059a24 24 0 0 1 16.97 7.029l65.941 65.941a24.002 24.002 0 0 1 7.03 16.971z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faPaste = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'pencil-alt';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f303';\nvar svgPathData = 'M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faPencilAlt = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'plus';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f067';\nvar svgPathData = 'M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faPlus = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'spinner';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f110';\nvar svgPathData = 'M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faSpinner = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'table';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f0ce';\nvar svgPathData = 'M464 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48zM224 416H64v-96h160v96zm0-160H64v-96h160v96zm224 160H288v-96h160v96zm0-160H288v-96h160v96z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faTable = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'times';\nvar width = 352;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f00d';\nvar svgPathData = 'M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faTimes = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'trash-alt';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f2ed';\nvar svgPathData = 'M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faTrashAlt = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'film';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f008';\nvar svgPathData = 'M488 64h-8v20c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12V64H96v20c0 6.6-5.4 12-12 12H44c-6.6 0-12-5.4-12-12V64h-8C10.7 64 0 74.7 0 88v336c0 13.3 10.7 24 24 24h8v-20c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v20h320v-20c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v20h8c13.3 0 24-10.7 24-24V88c0-13.3-10.7-24-24-24zM96 372c0 6.6-5.4 12-12 12H44c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm0-96c0 6.6-5.4 12-12 12H44c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm0-96c0 6.6-5.4 12-12 12H44c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm272 208c0 6.6-5.4 12-12 12H156c-6.6 0-12-5.4-12-12v-96c0-6.6 5.4-12 12-12h200c6.6 0 12 5.4 12 12v96zm0-168c0 6.6-5.4 12-12 12H156c-6.6 0-12-5.4-12-12v-96c0-6.6 5.4-12 12-12h200c6.6 0 12 5.4 12 12v96zm112 152c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm0-96c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm0-96c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFilm = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'caret-square-up';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f151';\nvar svgPathData = 'M0 432V80c0-26.51 21.49-48 48-48h352c26.51 0 48 21.49 48 48v352c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48zm355.515-140.485l-123.03-123.03c-4.686-4.686-12.284-4.686-16.971 0L92.485 291.515c-7.56 7.56-2.206 20.485 8.485 20.485h246.059c10.691 0 16.045-12.926 8.486-20.485z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCaretSquareUp = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'caret-square-down';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f150';\nvar svgPathData = 'M448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zM92.5 220.5l123 123c4.7 4.7 12.3 4.7 17 0l123-123c7.6-7.6 2.2-20.5-8.5-20.5H101c-10.7 0-16.1 12.9-8.5 20.5z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCaretSquareDown = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'sort-up';\nvar width = 320;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f0de';\nvar svgPathData = 'M279 224H41c-21.4 0-32.1-25.9-17-41L143 64c9.4-9.4 24.6-9.4 33.9 0l119 119c15.2 15.1 4.5 41-16.9 41z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faSortUp = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'sort-down';\nvar width = 320;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f0dd';\nvar svgPathData = 'M41 288h238c21.4 0 32.1 25.9 17 41L177 448c-9.4 9.4-24.6 9.4-33.9 0L24 329c-15.1-15.1-4.4-41 17-41z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faSortDown = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'toolbox';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f552';\nvar svgPathData = 'M502.63 214.63l-45.25-45.25c-6-6-14.14-9.37-22.63-9.37H384V80c0-26.51-21.49-48-48-48H176c-26.51 0-48 21.49-48 48v80H77.25c-8.49 0-16.62 3.37-22.63 9.37L9.37 214.63c-6 6-9.37 14.14-9.37 22.63V320h128v-16c0-8.84 7.16-16 16-16h32c8.84 0 16 7.16 16 16v16h128v-16c0-8.84 7.16-16 16-16h32c8.84 0 16 7.16 16 16v16h128v-82.75c0-8.48-3.37-16.62-9.37-22.62zM320 160H192V96h128v64zm64 208c0 8.84-7.16 16-16 16h-32c-8.84 0-16-7.16-16-16v-16H192v16c0 8.84-7.16 16-16 16h-32c-8.84 0-16-7.16-16-16v-16H0v96c0 17.67 14.33 32 32 32h448c17.67 0 32-14.33 32-32v-96H384v16z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faToolbox = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'ellipsis-h';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f141';\nvar svgPathData = 'M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faEllipsisH = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'search';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f002';\nvar svgPathData = 'M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faSearch = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'cloud-upload-alt';\nvar width = 640;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f382';\nvar svgPathData = 'M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4zM393.4 288H328v112c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V288h-65.4c-14.3 0-21.4-17.2-11.3-27.3l105.4-105.4c6.2-6.2 16.4-6.2 22.6 0l105.4 105.4c10.1 10.1 2.9 27.3-11.3 27.3z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCloudUploadAlt = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'question-circle';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f059';\nvar svgPathData = 'M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zM262.655 90c-54.497 0-89.255 22.957-116.549 63.758-3.536 5.286-2.353 12.415 2.715 16.258l34.699 26.31c5.205 3.947 12.621 3.008 16.665-2.122 17.864-22.658 30.113-35.797 57.303-35.797 20.429 0 45.698 13.148 45.698 32.958 0 14.976-12.363 22.667-32.534 33.976C247.128 238.528 216 254.941 216 296v4c0 6.627 5.373 12 12 12h56c6.627 0 12-5.373 12-12v-1.333c0-28.462 83.186-29.647 83.186-106.667 0-58.002-60.165-102-116.531-102zM256 338c-25.365 0-46 20.635-46 46 0 25.364 20.635 46 46 46s46-20.636 46-46c0-25.365-20.635-46-46-46z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faQuestionCircle = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'anchor';\nvar width = 576;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f13d';\nvar svgPathData = 'M12.971 352h32.394C67.172 454.735 181.944 512 288 512c106.229 0 220.853-57.38 242.635-160h32.394c10.691 0 16.045-12.926 8.485-20.485l-67.029-67.029c-4.686-4.686-12.284-4.686-16.971 0l-67.029 67.029c-7.56 7.56-2.206 20.485 8.485 20.485h35.146c-20.29 54.317-84.963 86.588-144.117 94.015V256h52c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12h-52v-5.47c37.281-13.178 63.995-48.725 64-90.518C384.005 43.772 341.605.738 289.37.01 235.723-.739 192 42.525 192 96c0 41.798 26.716 77.35 64 90.53V192h-52c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h52v190.015c-58.936-7.399-123.82-39.679-144.117-94.015h35.146c10.691 0 16.045-12.926 8.485-20.485l-67.029-67.029c-4.686-4.686-12.284-4.686-16.971 0L4.485 331.515C-3.074 339.074 2.28 352 12.971 352zM288 64c17.645 0 32 14.355 32 32s-14.355 32-32 32-32-14.355-32-32 14.355-32 32-32z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faAnchor = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'quote-right';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f10e';\nvar svgPathData = 'M464 32H336c-26.5 0-48 21.5-48 48v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48zm-288 0H48C21.5 32 0 53.5 0 80v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faQuoteRight = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'equals';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f52c';\nvar svgPathData = 'M416 304H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32zm0-192H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faEquals = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'cubes';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1b3';\nvar svgPathData = 'M488.6 250.2L392 214V105.5c0-15-9.3-28.4-23.4-33.7l-100-37.5c-8.1-3.1-17.1-3.1-25.3 0l-100 37.5c-14.1 5.3-23.4 18.7-23.4 33.7V214l-96.6 36.2C9.3 255.5 0 268.9 0 283.9V394c0 13.6 7.7 26.1 19.9 32.2l100 50c10.1 5.1 22.1 5.1 32.2 0l103.9-52 103.9 52c10.1 5.1 22.1 5.1 32.2 0l100-50c12.2-6.1 19.9-18.6 19.9-32.2V283.9c0-15-9.3-28.4-23.4-33.7zM358 214.8l-85 31.9v-68.2l85-37v73.3zM154 104.1l102-38.2 102 38.2v.6l-102 41.4-102-41.4v-.6zm84 291.1l-85 42.5v-79.1l85-38.8v75.4zm0-112l-102 41.4-102-41.4v-.6l102-38.2 102 38.2v.6zm240 112l-85 42.5v-79.1l85-38.8v75.4zm0-112l-102 41.4-102-41.4v-.6l102-38.2 102 38.2v.6z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCubes = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'code';\nvar width = 640;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f121';\nvar svgPathData = 'M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCode = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'lightbulb';\nvar width = 352;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f0eb';\nvar svgPathData = 'M96.06 454.35c.01 6.29 1.87 12.45 5.36 17.69l17.09 25.69a31.99 31.99 0 0 0 26.64 14.28h61.71a31.99 31.99 0 0 0 26.64-14.28l17.09-25.69a31.989 31.989 0 0 0 5.36-17.69l.04-38.35H96.01l.05 38.35zM0 176c0 44.37 16.45 84.85 43.56 115.78 16.52 18.85 42.36 58.23 52.21 91.45.04.26.07.52.11.78h160.24c.04-.26.07-.51.11-.78 9.85-33.22 35.69-72.6 52.21-91.45C335.55 260.85 352 220.37 352 176 352 78.61 272.91-.3 175.45 0 73.44.31 0 82.97 0 176zm176-80c-44.11 0-80 35.89-80 80 0 8.84-7.16 16-16 16s-16-7.16-16-16c0-61.76 50.24-112 112-112 8.84 0 16 7.16 16 16s-7.16 16-16 16z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faLightbulb = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'keyboard';\nvar width = 576;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f11c';\nvar svgPathData = 'M528 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h480c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM128 180v-40c0-6.627-5.373-12-12-12H76c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12H76c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm288 0v-40c0-6.627-5.373-12-12-12H172c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h232c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faKeyboard = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'dot-circle';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f192';\nvar svgPathData = 'M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm80 248c0 44.112-35.888 80-80 80s-80-35.888-80-80 35.888-80 80-80 80 35.888 80 80z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faDotCircle = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'check-square';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f14a';\nvar svgPathData = 'M400 480H48c-26.51 0-48-21.49-48-48V80c0-26.51 21.49-48 48-48h352c26.51 0 48 21.49 48 48v352c0 26.51-21.49 48-48 48zm-204.686-98.059l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.248-16.379-6.249-22.628 0L184 302.745l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.25 16.379 6.25 22.628.001z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCheckSquare = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'paragraph';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1dd';\nvar svgPathData = 'M448 48v32a16 16 0 0 1-16 16h-48v368a16 16 0 0 1-16 16h-32a16 16 0 0 1-16-16V96h-32v368a16 16 0 0 1-16 16h-32a16 16 0 0 1-16-16V352h-32a160 160 0 0 1 0-320h240a16 16 0 0 1 16 16z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faParagraph = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'redo-alt';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f2f9';\nvar svgPathData = 'M256.455 8c66.269.119 126.437 26.233 170.859 68.685l35.715-35.715C478.149 25.851 504 36.559 504 57.941V192c0 13.255-10.745 24-24 24H345.941c-21.382 0-32.09-25.851-16.971-40.971l41.75-41.75c-30.864-28.899-70.801-44.907-113.23-45.273-92.398-.798-170.283 73.977-169.484 169.442C88.764 348.009 162.184 424 256 424c41.127 0 79.997-14.678 110.629-41.556 4.743-4.161 11.906-3.908 16.368.553l39.662 39.662c4.872 4.872 4.631 12.815-.482 17.433C378.202 479.813 319.926 504 256 504 119.034 504 8.001 392.967 8 256.002 7.999 119.193 119.646 7.755 256.455 8z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faRedoAlt = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'external-link-alt';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f35d';\nvar svgPathData = 'M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faExternalLinkAlt = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","import { Component, createElement } from 'react';\nimport { findDOMNode } from 'react-dom';\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\n/**\n * Check whether some DOM node is our Component's node.\n */\nfunction isNodeFound(current, componentNode, ignoreClass) {\n if (current === componentNode) {\n return true;\n } // SVG elements do not technically reside in the rendered DOM, so\n // they do not have classList directly, but they offer a link to their\n // corresponding element, which can have classList. This extra check is for\n // that case.\n // See: http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGUseElement\n // Discussion: https://github.com/Pomax/react-onclickoutside/pull/17\n\n\n if (current.correspondingElement) {\n return current.correspondingElement.classList.contains(ignoreClass);\n }\n\n return current.classList.contains(ignoreClass);\n}\n/**\n * Try to find our node in a hierarchy of nodes, returning the document\n * node as highest node if our node is not found in the path up.\n */\n\nfunction findHighest(current, componentNode, ignoreClass) {\n if (current === componentNode) {\n return true;\n } // If source=local then this event came from 'somewhere'\n // inside and should be ignored. We could handle this with\n // a layered approach, too, but that requires going back to\n // thinking in terms of Dom node nesting, running counter\n // to React's 'you shouldn't care about the DOM' philosophy.\n\n\n while (current.parentNode) {\n if (isNodeFound(current, componentNode, ignoreClass)) {\n return true;\n }\n\n current = current.parentNode;\n }\n\n return current;\n}\n/**\n * Check if the browser scrollbar was clicked\n */\n\nfunction clickedScrollbar(evt) {\n return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;\n}\n\n// ideally will get replaced with external dep\n// when rafrex/detect-passive-events#4 and rafrex/detect-passive-events#5 get merged in\nvar testPassiveEventSupport = function testPassiveEventSupport() {\n if (typeof window === 'undefined' || typeof window.addEventListener !== 'function') {\n return;\n }\n\n var passive = false;\n var options = Object.defineProperty({}, 'passive', {\n get: function get() {\n passive = true;\n }\n });\n\n var noop = function noop() {};\n\n window.addEventListener('testPassiveEventSupport', noop, options);\n window.removeEventListener('testPassiveEventSupport', noop, options);\n return passive;\n};\n\nfunction autoInc(seed) {\n if (seed === void 0) {\n seed = 0;\n }\n\n return function () {\n return ++seed;\n };\n}\n\nvar uid = autoInc();\n\nvar passiveEventSupport;\nvar handlersMap = {};\nvar enabledInstances = {};\nvar touchEvents = ['touchstart', 'touchmove'];\nvar IGNORE_CLASS_NAME = 'ignore-react-onclickoutside';\n/**\n * Options for addEventHandler and removeEventHandler\n */\n\nfunction getEventHandlerOptions(instance, eventName) {\n var handlerOptions = null;\n var isTouchEvent = touchEvents.indexOf(eventName) !== -1;\n\n if (isTouchEvent && passiveEventSupport) {\n handlerOptions = {\n passive: !instance.props.preventDefault\n };\n }\n\n return handlerOptions;\n}\n/**\n * This function generates the HOC function that you'll use\n * in order to impart onOutsideClick listening to an\n * arbitrary component. It gets called at the end of the\n * bootstrapping code to yield an instance of the\n * onClickOutsideHOC function defined inside setupHOC().\n */\n\n\nfunction onClickOutsideHOC(WrappedComponent, config) {\n var _class, _temp;\n\n var componentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';\n return _temp = _class =\n /*#__PURE__*/\n function (_Component) {\n _inheritsLoose(onClickOutside, _Component);\n\n function onClickOutside(props) {\n var _this;\n\n _this = _Component.call(this, props) || this;\n\n _this.__outsideClickHandler = function (event) {\n if (typeof _this.__clickOutsideHandlerProp === 'function') {\n _this.__clickOutsideHandlerProp(event);\n\n return;\n }\n\n var instance = _this.getInstance();\n\n if (typeof instance.props.handleClickOutside === 'function') {\n instance.props.handleClickOutside(event);\n return;\n }\n\n if (typeof instance.handleClickOutside === 'function') {\n instance.handleClickOutside(event);\n return;\n }\n\n throw new Error(\"WrappedComponent: \" + componentName + \" lacks a handleClickOutside(event) function for processing outside click events.\");\n };\n\n _this.__getComponentNode = function () {\n var instance = _this.getInstance();\n\n if (config && typeof config.setClickOutsideRef === 'function') {\n return config.setClickOutsideRef()(instance);\n }\n\n if (typeof instance.setClickOutsideRef === 'function') {\n return instance.setClickOutsideRef();\n }\n\n return findDOMNode(instance);\n };\n\n _this.enableOnClickOutside = function () {\n if (typeof document === 'undefined' || enabledInstances[_this._uid]) {\n return;\n }\n\n if (typeof passiveEventSupport === 'undefined') {\n passiveEventSupport = testPassiveEventSupport();\n }\n\n enabledInstances[_this._uid] = true;\n var events = _this.props.eventTypes;\n\n if (!events.forEach) {\n events = [events];\n }\n\n handlersMap[_this._uid] = function (event) {\n if (_this.componentNode === null) return;\n\n if (_this.props.preventDefault) {\n event.preventDefault();\n }\n\n if (_this.props.stopPropagation) {\n event.stopPropagation();\n }\n\n if (_this.props.excludeScrollbar && clickedScrollbar(event)) return;\n var current = event.target;\n\n if (findHighest(current, _this.componentNode, _this.props.outsideClickIgnoreClass) !== document) {\n return;\n }\n\n _this.__outsideClickHandler(event);\n };\n\n events.forEach(function (eventName) {\n document.addEventListener(eventName, handlersMap[_this._uid], getEventHandlerOptions(_this, eventName));\n });\n };\n\n _this.disableOnClickOutside = function () {\n delete enabledInstances[_this._uid];\n var fn = handlersMap[_this._uid];\n\n if (fn && typeof document !== 'undefined') {\n var events = _this.props.eventTypes;\n\n if (!events.forEach) {\n events = [events];\n }\n\n events.forEach(function (eventName) {\n return document.removeEventListener(eventName, fn, getEventHandlerOptions(_this, eventName));\n });\n delete handlersMap[_this._uid];\n }\n };\n\n _this.getRef = function (ref) {\n return _this.instanceRef = ref;\n };\n\n _this._uid = uid();\n return _this;\n }\n /**\n * Access the WrappedComponent's instance.\n */\n\n\n var _proto = onClickOutside.prototype;\n\n _proto.getInstance = function getInstance() {\n if (!WrappedComponent.prototype.isReactComponent) {\n return this;\n }\n\n var ref = this.instanceRef;\n return ref.getInstance ? ref.getInstance() : ref;\n };\n\n /**\n * Add click listeners to the current document,\n * linked to this component's state.\n */\n _proto.componentDidMount = function componentDidMount() {\n // If we are in an environment without a DOM such\n // as shallow rendering or snapshots then we exit\n // early to prevent any unhandled errors being thrown.\n if (typeof document === 'undefined' || !document.createElement) {\n return;\n }\n\n var instance = this.getInstance();\n\n if (config && typeof config.handleClickOutside === 'function') {\n this.__clickOutsideHandlerProp = config.handleClickOutside(instance);\n\n if (typeof this.__clickOutsideHandlerProp !== 'function') {\n throw new Error(\"WrappedComponent: \" + componentName + \" lacks a function for processing outside click events specified by the handleClickOutside config option.\");\n }\n }\n\n this.componentNode = this.__getComponentNode(); // return early so we dont initiate onClickOutside\n\n if (this.props.disableOnClickOutside) return;\n this.enableOnClickOutside();\n };\n\n _proto.componentDidUpdate = function componentDidUpdate() {\n this.componentNode = this.__getComponentNode();\n };\n /**\n * Remove all document's event listeners for this component\n */\n\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.disableOnClickOutside();\n };\n /**\n * Can be called to explicitly enable event listening\n * for clicks and touches outside of this element.\n */\n\n\n /**\n * Pass-through render\n */\n _proto.render = function render() {\n // eslint-disable-next-line no-unused-vars\n var _props = this.props,\n excludeScrollbar = _props.excludeScrollbar,\n props = _objectWithoutProperties(_props, [\"excludeScrollbar\"]);\n\n if (WrappedComponent.prototype.isReactComponent) {\n props.ref = this.getRef;\n } else {\n props.wrappedRef = this.getRef;\n }\n\n props.disableOnClickOutside = this.disableOnClickOutside;\n props.enableOnClickOutside = this.enableOnClickOutside;\n return createElement(WrappedComponent, props);\n };\n\n return onClickOutside;\n }(Component), _class.displayName = \"OnClickOutside(\" + componentName + \")\", _class.defaultProps = {\n eventTypes: ['mousedown', 'touchstart'],\n excludeScrollbar: config && config.excludeScrollbar || false,\n outsideClickIgnoreClass: IGNORE_CLASS_NAME,\n preventDefault: false,\n stopPropagation: false\n }, _class.getClass = function () {\n return WrappedComponent.getClass ? WrappedComponent.getClass() : WrappedComponent;\n }, _temp;\n}\n\nexport { IGNORE_CLASS_NAME };\nexport default onClickOutsideHOC;\n","/**\n * @module @edtr-io/editor-ui\n */\n/** Comment needed because of https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/337 */\nimport * as React from 'react'\n\nimport { Icon, faSpinner } from './icon'\n\nexport class UploadProgress extends React.Component {\n public render() {\n const { progress } = this.props\n\n if (!progress) {\n return null\n }\n\n if (progress > 0 && progress < 1) {\n return \n }\n\n return null\n }\n}\n\nexport interface UploadProgressProps {\n progress?: number\n complete?: boolean\n}\n","/**\n * @module @edtr-io/editor-ui\n */\n/** Comment needed because of https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/337 */\nimport { IconDefinition } from '@fortawesome/fontawesome-svg-core'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport * as React from 'react'\nimport styled from 'styled-components'\n\nexport const Icon = FontAwesomeIcon\n\nexport { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck'\nexport { faCut } from '@fortawesome/free-solid-svg-icons/faCut'\nexport { faCog } from '@fortawesome/free-solid-svg-icons/faCog'\nexport { faCopy } from '@fortawesome/free-solid-svg-icons/faCopy'\nexport { faFileAlt } from '@fortawesome/free-solid-svg-icons/faFileAlt'\nexport { faImages } from '@fortawesome/free-solid-svg-icons/faImages'\nexport { faLink } from '@fortawesome/free-solid-svg-icons/faLink'\nexport { faMinus } from '@fortawesome/free-solid-svg-icons/faMinus'\nexport { faPaste } from '@fortawesome/free-solid-svg-icons/faPaste'\nexport { faPencilAlt } from '@fortawesome/free-solid-svg-icons/faPencilAlt'\nexport { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus'\nexport { faSpinner } from '@fortawesome/free-solid-svg-icons/faSpinner'\nexport { faTable } from '@fortawesome/free-solid-svg-icons/faTable'\nexport { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes'\nexport { faTrashAlt } from '@fortawesome/free-solid-svg-icons/faTrashAlt'\nexport { faFilm } from '@fortawesome/free-solid-svg-icons/faFilm'\nexport {\n faCaretSquareUp\n} from '@fortawesome/free-solid-svg-icons/faCaretSquareUp'\nexport {\n faCaretSquareDown\n} from '@fortawesome/free-solid-svg-icons/faCaretSquareDown'\nexport { faSortUp } from '@fortawesome/free-solid-svg-icons/faSortUp'\nexport { faSortDown } from '@fortawesome/free-solid-svg-icons/faSortDown'\nexport { faToolbox } from '@fortawesome/free-solid-svg-icons/faToolbox'\nexport { faEllipsisH } from '@fortawesome/free-solid-svg-icons/faEllipsisH'\nexport { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch'\nexport {\n faCloudUploadAlt\n} from '@fortawesome/free-solid-svg-icons/faCloudUploadAlt'\nexport {\n faQuestionCircle\n} from '@fortawesome/free-solid-svg-icons/faQuestionCircle'\nexport { faAnchor } from '@fortawesome/free-solid-svg-icons/faAnchor'\nexport { faQuoteRight } from '@fortawesome/free-solid-svg-icons/faQuoteRight'\nexport { faEquals } from '@fortawesome/free-solid-svg-icons/faEquals'\nexport { faCubes } from '@fortawesome/free-solid-svg-icons/faCubes'\nexport { faCode } from '@fortawesome/free-solid-svg-icons/faCode'\nexport { faLightbulb } from '@fortawesome/free-solid-svg-icons/faLightbulb'\nexport { faKeyboard } from '@fortawesome/free-solid-svg-icons/faKeyboard'\nexport { faDotCircle } from '@fortawesome/free-solid-svg-icons/faDotCircle'\nexport { faCheckSquare } from '@fortawesome/free-solid-svg-icons/faCheckSquare'\nexport { faParagraph } from '@fortawesome/free-solid-svg-icons/faParagraph'\nexport { faRedoAlt } from '@fortawesome/free-solid-svg-icons/faRedoAlt'\nexport {\n faExternalLinkAlt\n} from '@fortawesome/free-solid-svg-icons/faExternalLinkAlt'\n\nexport function createIcon(i: IconDefinition): React.FunctionComponent {\n return function I() {\n return \n }\n}\n\nexport type EdtrIconDefinition = string\n\nconst EdtrSVG = styled.svg({\n display: 'inline-block',\n verticalAlign: 'middle',\n overflow: 'hidden'\n})\n\nexport const EdtrIcon: React.FunctionComponent<{\n icon: EdtrIconDefinition\n className?: string\n}> = props => {\n return (\n \n \n \n )\n}\n\nexport const edtrAlignBlock: EdtrIconDefinition =\n 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z'\nexport const edtrAlignCenter: EdtrIconDefinition =\n 'M7 16c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zm-3 5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm3-5c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z'\nexport const edtrAlignRight: EdtrIconDefinition =\n 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zm-6-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z'\nexport const edtrAlignLeft: EdtrIconDefinition =\n 'M14 15H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zm0-8H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zM4 13h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0 8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z'\nexport const edtrClose: EdtrIconDefinition =\n 'M18.3,5.71 C17.91,5.32 17.28,5.32 16.89,5.71 L12,10.59 L7.11,5.7 C6.72,5.31 6.09,5.31 5.7,5.7 C5.31,6.09 5.31,6.72 5.7,7.11 L10.59,12 L5.7,16.89 C5.31,17.28 5.31,17.91 5.7,18.3 C6.09,18.69 6.72,18.69 7.11,18.3 L12,13.41 L16.89,18.3 C17.28,18.69 17.91,18.69 18.3,18.3 C18.69,17.91 18.69,17.28 18.3,16.89 L13.41,12 L18.3,7.11 C18.68,6.73 18.68,6.09 18.3,5.71 Z'\nexport const edtrFormel: EdtrIconDefinition =\n 'M9.796061,6.84358189 L9.546061,9.73358189 L11.366061,9.73358189 C11.9183457,9.73358189 12.366061,10.1812971 12.366061,10.7335819 L12.366061,10.7335819 C12.366061,11.2858666 11.9183457,11.7335819 11.366061,11.7335819 L9.366061,11.7335819 L8.926061,16.8035819 C8.726061,19.0035819 6.786061,20.6335819 4.586061,20.4335819 C3.95133688,20.3777262 3.21218763,20.0027937 2.36861326,19.3087844 L2.3686112,19.3087869 C1.93754177,18.9541458 1.8755844,18.3172015 2.23022554,17.8861321 C2.25098506,17.8608987 2.27295601,17.8366869 2.296061,17.8135819 L2.296061,17.8135819 C2.68943711,17.4202058 3.31879167,17.3943638 3.74309403,17.7541652 C4.42335978,18.3310001 5.0243456,18.5341427 5.546061,18.3635819 C6.326061,18.1235819 6.876061,17.4335819 6.946061,16.6235819 L7.366061,11.7335819 L5.366061,11.7335819 C4.81377625,11.7335819 4.366061,11.2858666 4.366061,10.7335819 L4.366061,10.7335819 C4.366061,10.1812971 4.81377625,9.73358189 5.366061,9.73358189 L7.546061,9.73358189 L7.816061,6.66358189 C8.006061,4.46358189 9.936061,2.83358189 12.146061,3.01358189 C12.7876823,3.06959645 13.5343235,3.45039469 14.3859845,4.15597662 L14.3859731,4.15599041 C14.8171452,4.51320676 14.8770982,5.1523219 14.5198819,5.58349402 C14.4997127,5.60783893 14.4784158,5.63122712 14.456061,5.65358189 L14.456061,5.65358189 C14.077745,6.03189793 13.4644763,6.03223098 13.0857495,5.65432608 C12.6951429,5.26458609 12.3219165,5.05433484 11.966061,5.02358189 C10.866061,4.92358189 9.896061,5.73358189 9.796061,6.84358189 Z M20.841061,12.6785819 L20.841061,12.6785819 C20.4517003,12.2892211 19.8204217,12.2892211 19.431061,12.6785819 L17.306061,14.8035819 L15.1860786,12.6835995 C14.7931405,12.2906614 14.1567565,12.2884206 13.761061,12.6785819 L13.761061,12.6785819 C13.3689485,13.0652103 13.3645027,13.6965046 13.7511312,14.0886171 C13.7527745,14.0902837 13.7544236,14.0919445 13.7560786,14.0935995 L15.896061,16.2335819 L13.7610785,18.3385997 C13.3717179,18.7224956 13.3672879,19.3493438 13.7511838,19.7387045 C13.7544529,19.7420201 13.7577454,19.7453127 13.761061,19.7485819 L13.761061,19.7485819 C14.1567565,20.1387432 14.7931405,20.1365024 15.1860786,19.7435643 L17.306061,17.6235819 L19.431061,19.7485819 C19.8204217,20.1379426 20.4517003,20.1379426 20.841061,19.7485819 L20.841061,19.7485819 C21.2290435,19.3605994 21.2290435,18.7315555 20.841061,18.343573 C20.8402306,18.3427426 20.8393988,18.3419137 20.8385654,18.3410863 L18.716061,16.2335819 L20.8435477,14.0910599 C21.2319346,13.6999283 21.2308227,13.0683435 20.841061,12.6785819 Z'\nexport const edtrText: EdtrIconDefinition =\n 'M2.5 5.5C2.5 6.33 3.17 7 4 7h3.5v10.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V7H14c.83 0 1.5-.67 1.5-1.5S14.83 4 14 4H4c-.83 0-1.5.67-1.5 1.5zM20 9h-6c-.83 0-1.5.67-1.5 1.5S13.17 12 14 12h1.5v5.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V12H20c.83 0 1.5-.67 1.5-1.5S20.83 9 20 9z'\nexport const edtrLink: EdtrIconDefinition =\n 'M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1zm2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1z'\nexport const edtrQuote: EdtrIconDefinition =\n 'M7.17 17c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94zm10 0c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94z'\nexport const edtrListNumbered: EdtrIconDefinition =\n 'M8 7h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm12 10H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zm0-6H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zM4.5 16h-2c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5h-.5c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h2c.28 0 .5-.22.5-.5v-3c0-.28-.22-.5-.5-.5zm-2-11H3v2.5c0 .28.22.5.5.5s.5-.22.5-.5v-3c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5s.22.5.5.5zm2 5h-2c-.28 0-.5.22-.5.5s.22.5.5.5h1.3l-1.68 1.96c-.08.09-.12.21-.12.32v.22c0 .28.22.5.5.5h2c.28 0 .5-.22.5-.5s-.22-.5-.5-.5H3.2l1.68-1.96c.08-.09.12-.21.12-.32v-.22c0-.28-.22-.5-.5-.5z'\nexport const edtrListBullets: EdtrIconDefinition =\n 'M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM8 19h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm0-6h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zM7 6c0 .55.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1z'\nexport const edtrItalic: EdtrIconDefinition =\n 'M10 5.5c0 .83.67 1.5 1.5 1.5h.71l-3.42 8H7.5c-.83 0-1.5.67-1.5 1.5S6.67 18 7.5 18h5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5h-.71l3.42-8h1.29c.83 0 1.5-.67 1.5-1.5S17.33 4 16.5 4h-5c-.83 0-1.5.67-1.5 1.5z'\nexport const edtrColorText: EdtrIconDefinition =\n 'M10.63 3.93L6.06 15.58c-.27.68.23 1.42.97 1.42.43 0 .82-.27.98-.68L8.87 14h6.25l.87 2.32c.15.41.54.68.98.68.73 0 1.24-.74.97-1.42L13.37 3.93C13.14 3.37 12.6 3 12 3c-.6 0-1.15.37-1.37.93zM9.62 12L12 5.67 14.38 12H9.62z'\nexport const edtrFill: EdtrIconDefinition =\n 'M16.56 8.94L8.32.7C7.93.31 7.3.31 6.91.7c-.39.39-.39 1.02 0 1.41l1.68 1.68-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z'\nexport const edtrBold: EdtrIconDefinition =\n 'M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H8c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h5.78c2.07 0 3.96-1.69 3.97-3.77.01-1.53-.85-2.84-2.15-3.44zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z'\n\nexport const edtrPlus: EdtrIconDefinition =\n 'M12,2 C6.48,2 2,6.48 2,12 C2,17.52 6.48,22 12,22 C17.52,22 22,17.52 22,12 C22,6.48 17.52,2 12,2 Z M16,13 L13,13 L13,16 C13,16.55 12.55,17 12,17 C11.45,17 11,16.55 11,16 L11,13 L8,13 C7.45,13 7,12.55 7,12 C7,11.45 7.45,11 8,11 L11,11 L11,8 C11,7.45 11.45,7 12,7 C12.55,7 13,7.45 13,8 L13,11 L16,11 C16.55,11 17,11.45 17,12 C17,12.55 16.55,13 16,13 Z'\nexport const edtrSearch: EdtrIconDefinition =\n 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'\nexport const edtrDefaultPlugin: EdtrIconDefinition =\n 'M20.6190476,11.5238095 L19.1904762,11.5238095 L19.1904762,7.71428571 C19.1904762,6.65714286 18.3333333,5.80952381 17.2857143,5.80952381 L13.4761905,5.80952381 L13.4761905,4.38095238 C13.4761905,3.06598869 12.4102018,2 11.0952381,2 C9.78027441,2 8.71428571,3.06598869 8.71428571,4.38095238 L8.71428571,5.80952381 L4.9047619,5.80952381 C3.85279095,5.80952381 3,6.66231476 3,7.71428571 L3,11.3333333 L4.42857143,11.3333333 C5.85714286,11.3333333 7,12.4761905 7,13.9047619 C7,15.3333333 5.85714286,16.4761905 4.42857143,16.4761905 L3,16.4761905 L3,20.0952381 C3,21.147209 3.85279095,22 4.9047619,22 L8.52380952,22 L8.52380952,20.5714286 C8.52380952,19.1428571 9.66666667,18 11.0952381,18 C12.5238095,18 13.6666667,19.1428571 13.6666667,20.5714286 L13.6666667,22 L17.2857143,22 C18.3376852,22 19.1904762,21.147209 19.1904762,20.0952381 L19.1904762,16.2857143 L20.6190476,16.2857143 C21.9340113,16.2857143 23,15.2197256 23,13.9047619 C23,12.5897982 21.9340113,11.5238095 20.6190476,11.5238095 Z'\nexport const edtrDragHandle: EdtrIconDefinition =\n 'M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z'\n\nexport const edtrTextControls = {\n bold: edtrBold,\n italic: edtrItalic,\n colorText: edtrColorText,\n listNumbered: edtrListNumbered,\n listBullets: edtrListBullets,\n formel: edtrFormel,\n link: edtrLink,\n text: edtrText,\n close: edtrClose,\n quote: edtrQuote\n}\n\nexport const edtrRowsControls = {\n plus: edtrPlus,\n close: edtrClose,\n search: edtrSearch,\n defaultPlugin: edtrDefaultPlugin,\n dragHandle: edtrDragHandle\n}\n","/**\n * @module @edtr-io/editor-ui\n */\n/** Comment needed because of https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/337 */\nimport * as React from 'react'\nimport onClickOutsideHOC from 'react-onclickoutside'\n\nclass Comp extends React.Component<{ onClick: (e: Event) => void }> {\n public handleClickOutside = this.props.onClick\n public render() {\n return {this.props.children}\n }\n}\n\nexport const OnClickOutside: typeof Comp = (onClickOutsideHOC(\n Comp\n) as unknown) as typeof Comp\n","/**\n * @module @edtr-io/editor-ui\n */\n/** Comment needed because of https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/337 */\nimport {\n createEditorUiTheme,\n EditorThemeProps,\n ButtonTheme,\n styled\n} from '@edtr-io/ui'\n\nimport { createOverlayTheme } from '.'\n\nexport const createOverlayButtonTheme = createEditorUiTheme(\n theme => {\n return {\n backgroundColor: 'transparent',\n color: theme.color,\n borderColor: theme.color,\n hoverBackgroundColor: 'transparent',\n hoverColor: theme.primary.background,\n hoverBorderColor: theme.primary.background\n }\n }\n)\n\nexport const Button = styled.button((props: EditorThemeProps) => {\n const theme = createOverlayTheme(props.theme)\n\n return {\n margin: '3px',\n backgroundColor: theme.button.backgroundColor,\n outline: 'none',\n border: `2px solid ${theme.button.borderColor}`,\n color: theme.button.color,\n padding: '10px',\n borderRadius: '4px',\n minWidth: '125px',\n cursor: 'pointer',\n '&:hover': {\n backgroundColor: theme.button.hoverBackgroundColor,\n color: theme.button.hoverColor,\n borderColor: theme.button.hoverBorderColor\n }\n }\n})\n","/**\n * @module @edtr-io/editor-ui\n */\n/** Comment needed because of https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/337 */\nimport {\n createEditorUiTheme,\n CheckboxTheme,\n EditorThemeProps,\n styled\n} from '@edtr-io/ui'\nimport * as React from 'react'\n\nimport { createOverlayTheme } from './settings-overlay'\n\nexport const createOverlayCheckboxTheme = createEditorUiTheme(\n theme => {\n return {\n boxSelectedColor: theme.color,\n boxDeselectedColor: theme.backgroundColor,\n color: theme.color\n }\n }\n)\n\nconst CheckboxLabel = styled.label((props: EditorThemeProps) => {\n const theme = createOverlayTheme(props.theme)\n\n return {\n color: theme.checkbox.color,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n marginTop: '20px'\n }\n})\n\nconst CheckboxInlineLabel = styled.label((props: EditorThemeProps) => {\n const theme = createOverlayTheme(props.theme)\n return {\n color: theme.checkbox.color,\n verticalAlign: 'middle',\n margin: '5px 10px',\n display: 'inline-block'\n }\n})\n\nconst CheckboxInlineLabelInner = styled.span({\n marginRight: '10px',\n verticalAlign: 'middle'\n})\n\nconst CheckboxToggleContainer = styled.div<{\n value?: boolean\n}>(({ value, ...props }: { value?: boolean } & EditorThemeProps) => {\n const theme = createOverlayTheme(props.theme)\n\n return {\n cursor: 'pointer',\n border: `2px solid ${theme.checkbox.color}`,\n borderRadius: '15%',\n width: '20px',\n height: '20px',\n display: 'inline-block',\n verticalAlign: 'middle',\n backgroundColor: value\n ? theme.checkbox.boxSelectedColor\n : theme.checkbox.boxDeselectedColor\n }\n})\n\nconst CheckboxLabelInner = styled.span({ width: '20%' })\n\nconst CheckboxToggle = styled.div<{ value?: boolean }>(\n ({ value, ...props }: { value?: boolean } & EditorThemeProps) => {\n const theme = createOverlayTheme(props.theme)\n\n return {\n opacity: value ? 1 : 0,\n content: '',\n position: 'absolute',\n fontWeight: 'bold',\n width: '20px',\n height: '10px',\n border: `3px solid ${theme.checkbox.boxDeselectedColor}`,\n borderTop: 'none',\n borderRight: 'none',\n borderRadius: '1px',\n\n transform: 'rotate(-45deg)',\n zIndex: 1000\n }\n }\n)\n\nconst CheckboxInner = styled.div({\n width: '75%',\n textAlign: 'left'\n})\nexport class Checkbox extends React.Component {\n public render() {\n const { checked, onChange, label } = this.props\n return (\n \n {label}\n \n {\n if (onChange) {\n onChange(!checked)\n }\n }}\n value={checked}\n >\n \n \n \n \n )\n }\n}\n\nexport const InlineCheckbox: React.FunctionComponent = ({\n checked,\n onChange,\n label\n}) => {\n return (\n \n {label}\n {\n // avoid loosing focus\n e.stopPropagation()\n }}\n onClick={() => {\n if (onChange) {\n onChange(!checked)\n }\n }}\n value={checked}\n >\n \n \n \n )\n}\n\nexport interface CheckboxProps {\n checked?: boolean\n onChange?: (checked: boolean) => void\n label?: string\n}\n","/**\n * @module @edtr-io/editor-ui\n */\n/** Comment needed because of https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/337 */\nimport {\n createEditorUiTheme,\n EditorThemeProps,\n InputTheme,\n styled\n} from '@edtr-io/ui'\nimport * as React from 'react'\n\nimport { createOverlayTheme } from './settings-overlay'\n\nexport const createOverlayInputTheme = createEditorUiTheme(\n theme => {\n return {\n backgroundColor: 'transparent',\n color: theme.color,\n highlightColor: theme.primary.background\n }\n }\n)\n\nconst InputLabel = styled.label((props: EditorThemeProps) => {\n const theme = createOverlayTheme(props.theme)\n\n return {\n color: theme.input.color,\n margin: '20px auto 0px',\n display: 'flex',\n justifyContent: 'space-between',\n alignItems: 'center'\n }\n})\n\nconst InputLabelInner = styled.span({ width: '20%' })\n\nconst InputInner = styled.input((props: EditorThemeProps) => {\n const theme = createOverlayTheme(props.theme)\n\n return {\n backgroundColor: theme.input.backgroundColor,\n border: 'none',\n borderBottom: `2px solid ${theme.input.color}`,\n color: theme.input.color,\n width: '75%',\n '&:focus': {\n outline: 'none',\n borderBottom: `2px solid ${theme.input.highlightColor}`\n }\n }\n})\nconst InputInlineInner = styled.input((props: EditorThemeProps) => {\n const theme = createOverlayTheme(props.theme)\n\n return {\n backgroundColor: theme.input.backgroundColor,\n border: 'none',\n borderBottom: `2px solid ${theme.input.color}`,\n color: theme.input.color,\n '&:focus': {\n outline: 'none',\n borderBottom: `2px solid ${theme.input.highlightColor}`\n }\n }\n})\n\nexport class InlineInput extends React.Component {\n private input = React.createRef()\n\n public focus() {\n const input = this.input.current\n if (input) {\n input.focus()\n }\n }\n\n public render() {\n return \n }\n}\n\nexport class OverlayInput extends React.Component {\n private input = React.createRef()\n\n public focus() {\n const input = this.input.current\n if (input) {\n input.focus()\n }\n }\n\n public render() {\n const { label, ...props } = this.props\n return (\n \n {label}\n \n \n )\n }\n}\n\nexport class AutoFocusInput extends React.Component {\n public render() {\n return (\n {\n if (ref) {\n ref.focus()\n }\n }}\n />\n )\n }\n}\n\nexport interface InputProps\n extends React.DetailedHTMLProps<\n React.InputHTMLAttributes,\n HTMLInputElement\n > {\n label?: string\n textfieldWidth?: string\n editorInputWidth?: string\n}\n","/**\n * @module @edtr-io/editor-ui\n */\n/** Comment needed because of https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/337 */\nimport {\n createEditorUiTheme,\n EditorThemeProps,\n styled,\n TextareaTheme\n} from '@edtr-io/ui'\nimport * as React from 'react'\n\nimport { createOverlayTheme } from './settings-overlay'\n\nexport const createOverlayTextareaTheme = createEditorUiTheme(\n theme => {\n return {\n backgroundColor: 'transparent',\n color: theme.color,\n borderColor: theme.color,\n highlightColor: theme.primary.background\n }\n }\n)\nconst TextareaLabel = styled.label(props => {\n const theme = createOverlayTheme(props.theme)\n\n return {\n color: theme.textarea.color,\n display: 'flex',\n flexDirection: 'row',\n margin: '20px auto 0',\n justifyContent: 'space-between'\n }\n})\n\nconst TextareaLabelInner = styled.span({ width: '20%' })\n\nconst TextareaInner = styled.textarea(props => {\n const theme = createOverlayTheme(props.theme)\n\n return {\n backgroundColor: theme.textarea.backgroundColor,\n border: `2px solid ${theme.textarea.borderColor}`,\n marginTop: '5px',\n borderRadius: '5px',\n color: theme.textarea.color,\n padding: '10px',\n resize: 'none',\n outline: 'none',\n minHeight: '100px',\n width: '75%',\n '&:focus': {\n border: `2px solid ${theme.textarea.highlightColor}`\n }\n }\n})\n\nexport class Textarea extends React.Component {\n private textarea = React.createRef()\n\n public focus() {\n const textarea = this.textarea.current\n\n if (textarea) {\n setTimeout(() => {\n textarea.blur()\n textarea.focus()\n })\n }\n }\n\n public getTextareaRef(): HTMLTextAreaElement | null {\n return this.textarea.current\n }\n\n public render() {\n const { label, ...props } = this.props\n return (\n \n {label}\n \n \n )\n }\n}\n\nexport interface TextareaProps\n extends React.DetailedHTMLProps<\n React.InputHTMLAttributes,\n HTMLTextAreaElement\n > {\n label?: string\n}\n","/**\n * @module @edtr-io/editor-ui\n */\n/** Comment needed because of https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/337 */\nimport { OverlayContext } from '@edtr-io/core'\nimport {\n createEditorUiTheme,\n EditorThemeProps,\n OverlayTheme,\n styled\n} from '@edtr-io/ui'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\nimport { HotKeys } from 'react-hotkeys'\n\nimport { Icon, faTimes, faTrashAlt, faCog } from './icon'\nimport { OnClickOutside } from './on-click-outside'\nimport { createOverlayButtonTheme } from './overlay-button'\nimport { createOverlayCheckboxTheme } from './overlay-checkbox'\nimport { createOverlayInputTheme } from './overlay-input'\nimport { createOverlayTextareaTheme } from './overlay-textarea'\n\nexport const createOverlayTheme = (themeProp: EditorThemeProps['theme']) => {\n const themeCreator = createEditorUiTheme(theme => {\n return {\n backgroundColor: theme.backgroundColor,\n color: theme.color,\n overlayBackgroundColor: '#00000033',\n highlightColor: theme.primary.background,\n button: createOverlayButtonTheme('button', themeProp),\n input: createOverlayInputTheme('input', themeProp),\n textarea: createOverlayTextareaTheme('textarea', themeProp),\n checkbox: createOverlayCheckboxTheme('checkbox', themeProp)\n }\n })\n\n return themeCreator('overlay', themeProp)\n}\n\nconst OverlayWrapper = styled.div(props => {\n const theme = createOverlayTheme(props.theme)\n\n return {\n width: '100%',\n height: '100%',\n position: 'fixed',\n\n top: 0,\n left: 0,\n overlayBackgroundColor: theme.overlayBackgroundColor,\n zIndex: 99\n }\n})\n\nexport const OverlayBox = styled.div(props => {\n const theme = createOverlayTheme(props.theme)\n\n return {\n margin: '0 auto',\n position: 'absolute',\n boxShadow: '0 2px 4px 0 rgba(0,0,0,0.50)',\n borderRadius: '4px',\n zIndex: 100,\n backgroundColor: theme.backgroundColor,\n color: theme.color,\n left: '8%',\n right: '8%'\n }\n})\n\nconst OverlaySettingsBox = styled(OverlayBox)({\n minHeight: '60%',\n paddingBottom: '10px',\n maxWidth: '1150px',\n top: '20%'\n})\n\nconst CloseButton = styled.button(props => {\n const theme = createOverlayTheme(props.theme)\n\n return {\n float: 'right',\n position: 'relative',\n color: theme.color,\n fontSize: 16,\n zIndex: 98,\n outline: 'none',\n border: 'none',\n backgroundColor: 'transparent',\n paddingTop: '5px',\n '&:hover': {\n color: theme.highlightColor\n }\n }\n})\n\nconst ContentWrapper = styled.div({\n padding: '20px 15%'\n})\n\nexport function Overlay(props: {\n onClose?: () => void\n children?: React.ReactNode\n}) {\n const overlayContext = React.useContext(OverlayContext)\n function closeHandler() {\n overlayContext.hide()\n if (props.onClose) {\n props.onClose()\n }\n }\n return overlayContext.node.current && overlayContext.visible\n ? createPortal(\n \n \n \n \n \n \n \n {props.children}\n \n \n \n ,\n overlayContext.node.current\n )\n : null\n}\n\nconst OverlayTriangle = styled.div<\n EditorThemeProps & { positionAbove: boolean }\n>(props => {\n const theme = createOverlayTheme(props.theme)\n const borderPosition = props.positionAbove ? 'borderTop' : 'borderBottom'\n return {\n position: 'relative',\n width: 0,\n height: 0,\n borderLeft: '5px solid transparent',\n borderRight: '5px solid transparent',\n [borderPosition]: `10px solid ${theme.backgroundColor}`\n }\n})\nconst InlineOverlayWrapper = styled.div({\n position: 'absolute',\n top: '-10000px',\n left: '-10000px',\n opacity: 0,\n transition: 'opacity 0.5s',\n zIndex: 95,\n whiteSpace: 'nowrap'\n})\n\nconst InlineOverlayContentWrapper = styled.div((props: EditorThemeProps) => {\n const theme = createOverlayTheme(props.theme)\n return {\n boxShadow: '0 2px 4px 0 rgba(0,0,0,0.50)',\n backgroundColor: theme.backgroundColor,\n color: theme.color,\n borderRadius: '4px',\n '& a': {\n color: theme.color,\n '&:hover': {\n color: theme.highlightColor\n }\n }\n }\n})\n\nconst InlinePreview = styled.span({\n padding: '0px 8px'\n})\nconst ChangeButton = styled.div((props: EditorThemeProps) => {\n const theme = createOverlayTheme(props.theme)\n\n return {\n padding: '5px 5px 5px 10px',\n display: 'inline-block',\n borderLeft: `2px solid ${theme.color}`,\n cursor: 'pointer',\n margin: '2px',\n '&:hover': {\n color: theme.highlightColor\n }\n }\n})\n\nexport const InlineSettings: React.FunctionComponent<{\n onDelete: React.MouseEventHandler\n position: HoverPosition\n anchor?: React.RefObject\n}> = ({ position = 'below', ...props }) => {\n return (\n \n {props.children}\n \n \n \n \n )\n}\n\nexport type HoverPosition = 'above' | 'below'\n\nexport const HoveringOverlay: React.FunctionComponent<{\n position: HoverPosition\n anchor?: React.RefObject\n allowSelectionOverflow?: boolean\n}> = props => {\n const overlay = React.createRef()\n const triangle = React.createRef()\n const [positionAbove, setPositionAbove] = React.useState(\n props.position === 'above'\n )\n\n React.useLayoutEffect(() => {\n if (!overlay.current || !triangle.current) return\n const menu = overlay.current\n let rect = undefined\n if (props.anchor && props.anchor.current !== null) {\n rect = props.anchor.current.getBoundingClientRect()\n } else {\n const native = window.getSelection()\n if (native && native.rangeCount > 0) {\n const range = native.getRangeAt(0)\n rect = range.getBoundingClientRect()\n }\n }\n if (!rect) return\n if (rect.height === 0) return\n // menu is set to display:none, shouldn't ever happen\n if (!menu.offsetParent) return\n const parentRect = menu.offsetParent.getBoundingClientRect()\n // only show menu if selection is inside of parent\n if (\n parentRect.top - 5 > rect.top ||\n parentRect.top + parentRect.height + 5 < rect.top + rect.height ||\n parentRect.left - 5 > rect.left ||\n parentRect.left + parentRect.width + 5 < rect.left + rect.width\n ) {\n if (!props.allowSelectionOverflow) {\n menu.style.top = null\n menu.style.left = null\n return\n }\n }\n menu.style.opacity = '1'\n const aboveValue = rect.top - menu.offsetHeight - 6\n // if top becomes negative, place menu below\n setPositionAbove(props.position == 'above' && aboveValue >= 0)\n menu.style.top =\n (positionAbove ? aboveValue : rect.bottom + 6) - parentRect.top + 'px'\n\n menu.style.left = `${Math.min(\n Math.max(\n rect.left - parentRect.left - menu.offsetWidth / 2 + rect.width / 2,\n 0\n ),\n parentRect.width - menu.offsetWidth - 5\n )}px`\n triangle.current.style.left = `${rect.left -\n menu.offsetLeft -\n parentRect.left -\n triangle.current.offsetWidth / 2 +\n rect.width / 2}px`\n }, [\n overlay,\n triangle,\n props.position,\n props.anchor,\n positionAbove,\n props.allowSelectionOverflow\n ])\n\n return (\n \n {!positionAbove && (\n \n )}\n \n {props.children}\n \n {positionAbove && }\n \n )\n}\n\nconst ConfigIconContainer = styled.div({\n position: 'relative'\n})\nconst ConfigIcon = styled.div(props => {\n const theme = createOverlayTheme(props.theme)\n\n return {\n position: 'absolute',\n textAlign: 'center',\n width: '100%',\n height: '100%',\n top: 0,\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: theme.backgroundColor,\n color: theme.color,\n opacity: 0,\n '&:hover': {\n opacity: 1,\n transition: 'opacity 0.3s ease',\n cursor: 'pointer'\n }\n }\n})\n\nexport function ContainerWithConfigButton(props: {\n children?: React.ReactNode\n}) {\n const overlayContext = React.useContext(OverlayContext)\n return (\n \n {props.children}\n \n \n \n \n )\n}\n","/**\n * @module @edtr-io/editor-ui\n */\n/** Comment needed because of https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/337 */\nimport { EditorThemeProps, styled } from '@edtr-io/ui'\n\nimport { createOverlayTheme } from './settings-overlay'\n\n// Toolbar at the bottom of the browser.\nexport const BottomToolbar = styled.div(props => {\n const theme = createOverlayTheme(props.theme)\n return {\n boxShadow: '0 2px 4px 0 rgba(0,0,0,0.50)',\n backgroundColor: theme.backgroundColor,\n color: theme.color,\n borderRadius: '4px',\n position: 'fixed',\n left: '50%',\n transform: 'translate(-50%,-50%)',\n bottom: '0',\n zIndex: 90,\n whiteSpace: 'nowrap'\n }\n})\n","/**\n * @module @edtr-io/editor-ui\n */\n/** Comment needed because of https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/337 */\nimport {\n createEditorUiTheme,\n EditorThemeProps,\n ButtonTheme,\n styled\n} from '@edtr-io/ui'\n\nexport const createEditorButtonTheme = createEditorUiTheme(\n theme => {\n return {\n backgroundColor: theme.backgroundColor,\n color: theme.color,\n borderColor: theme.color,\n hoverBackgroundColor: 'rgba(0,0,0,0.50)',\n hoverColor: theme.primary.background,\n hoverBorderColor: theme.primary.background\n }\n }\n)\n\nexport const EditorButton = styled.button((props: EditorThemeProps) => {\n const theme = createEditorButtonTheme('button', props.theme)\n\n return {\n margin: '3px',\n backgroundColor: theme.backgroundColor,\n outline: 'none',\n border: 'none',\n boxShadow: '0 1px 2px 0 rgba(0,0,0,0.50)',\n color: theme.color,\n borderRadius: '4px',\n cursor: 'pointer',\n '&:hover': {\n backgroundColor: theme.hoverBackgroundColor,\n color: theme.hoverColor,\n borderColor: theme.hoverBorderColor\n }\n }\n})\n","/**\n * @module @edtr-io/editor-ui\n */\n/** Comment needed because of https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/337 */\nimport {\n createEditorUiTheme,\n CheckboxTheme,\n EditorThemeProps,\n styled\n} from '@edtr-io/ui'\nimport * as React from 'react'\n\nimport { CheckboxProps } from './overlay-checkbox'\n\nexport const createEditorCheckboxTheme = createEditorUiTheme(\n theme => {\n return {\n boxSelectedColor: theme.backgroundColor,\n boxDeselectedColor: 'transparent',\n color: theme.backgroundColor\n }\n }\n)\n\nconst CheckboxLabel = styled.label((props: EditorThemeProps) => {\n const theme = createEditorCheckboxTheme('checkbox', props.theme)\n\n return {\n color: theme.color\n }\n})\n\nconst CheckboxToggleContainer = styled.div((props: EditorThemeProps) => {\n const theme = createEditorCheckboxTheme('checkbox', props.theme)\n\n return {\n cursor: 'pointer',\n margin: '0 5px -1px 5px',\n border: `2px solid ${theme.color}`,\n borderRadius: '15%',\n width: '15px',\n height: '15px',\n display: 'inline-block',\n backgroundColor: theme.boxDeselectedColor\n }\n})\n\nconst CheckboxLabelInner = styled.span({ width: '5%' })\n\nconst CheckboxToggle = styled.div<{ value?: boolean }>(\n ({ value, ...props }: { value?: boolean } & EditorThemeProps) => {\n const theme = createEditorCheckboxTheme('checkbox', props.theme)\n\n return {\n opacity: value ? 1 : 0,\n content: '',\n position: 'absolute',\n fontWeight: 'bold',\n margin: '3px 0 0 2px',\n width: '10px',\n height: '5px',\n border: `2px solid ${theme.boxSelectedColor}`,\n borderTop: 'none',\n borderRight: 'none',\n\n transform: 'rotate(-45deg)',\n zIndex: 1000\n }\n }\n)\n\nexport class EditorCheckbox extends React.Component {\n public render() {\n const { checked, onChange, label } = this.props\n return (\n \n {label}\n\n {\n if (onChange) {\n onChange(!checked)\n }\n }}\n >\n \n \n \n )\n }\n}\n","import { styled } from '@edtr-io/ui'\nimport * as React from 'react'\n\nimport { Icon, faTimes, faPlus } from './icon'\n\nexport const AddButtonComponent = styled.button({\n marginLeft: 'calc(10% + 20px)',\n width: 'calc(90% - 20px)',\n borderRadius: '10px',\n backgroundColor: 'white',\n textAlign: 'left',\n color: 'lightgrey',\n minHeight: '50px',\n border: '2px solid lightgrey',\n outline: 'none',\n '&:hover': { border: '3px solid #007ec1', color: '#007ec1' }\n})\n\nexport function AddButton(props: { onClick: () => void; children: string }) {\n return (\n \n {props.children}\n \n )\n}\n\nconst AnswerContainer = styled.div({\n marginBottom: '10px',\n display: 'flex',\n alignItems: 'center'\n})\n\nconst CheckboxContainer = styled.div({\n width: '10%',\n textAlign: 'center',\n marginRight: '10px',\n fontWeight: 'bold'\n})\n\nconst RemoveButton = styled.button({\n borderRadius: '50%',\n outline: 'none',\n background: 'white',\n zIndex: 20,\n float: 'right',\n transform: 'translate(50%, -40%)',\n '&:hover': {\n border: '3px solid #007ec1',\n color: '#007ec1'\n }\n})\n\nconst FeedbackField = styled.div({\n paddingLeft: '20px',\n paddingBottom: '10px',\n paddingTop: '10px',\n marginTop: '5px'\n})\n\nconst FramedContainer = styled.div<{ focused: boolean }>(({ focused }) => {\n const defaultBorders = {\n border: '2px solid lightgrey',\n [`${RemoveButton}`]: {\n border: '2px solid lightgrey',\n color: 'lightgrey'\n },\n [`${FeedbackField}`]: {\n borderTop: '2px solid lightgrey'\n }\n }\n const focusedBorders = {\n border: '3px solid #007ec1',\n [`${RemoveButton}`]: {\n border: '3px solid #007ec1',\n color: '#007ec1'\n },\n [`${FeedbackField}`]: {\n borderTop: '2px solid #007ec1'\n }\n }\n\n return {\n width: '100%',\n marginLeft: '10px',\n borderRadius: '10px',\n\n ...(focused ? focusedBorders : defaultBorders),\n '&:focus-within': focusedBorders\n }\n})\nconst AnswerField = styled.div({ paddingLeft: '20px', paddingTop: '10px' })\n\nconst Container = styled.div<{ isRadio: boolean; checked: boolean }>(\n ({ isRadio, checked }) => {\n return {\n cursor: 'pointer',\n border: checked\n ? isRadio\n ? '5px solid #007ec1'\n : '2px solid #007ec1'\n : '2px solid lightgray',\n borderRadius: isRadio ? '50%' : '15%',\n width: '20px',\n height: '20px',\n display: 'inline-block',\n verticalAlign: 'middle',\n backgroundColor: checked && !isRadio ? '#007ec1' : 'white'\n }\n }\n)\n\nconst Tick = styled.div<{ checked: boolean }>(({ checked }) => {\n return {\n opacity: checked ? 1 : 0,\n content: '',\n position: 'absolute',\n\n fontWeight: 'bold',\n width: '15px',\n height: '10px',\n border: '3px solid white',\n borderTop: 'none',\n borderRight: 'none',\n borderRadius: '2px',\n zIndex: 10,\n transform: 'rotate(-45deg)'\n }\n})\n\nexport class CheckElement extends React.Component {\n public render() {\n const { isRadio, isActive, handleChange } = this.props\n return (\n {\n handleChange(e)\n }}\n >\n {isRadio ? null : }\n \n )\n }\n}\n\nexport function InteractiveAnswer(props: {\n isRadio?: boolean\n isActive?: boolean\n handleChange: () => void\n answerID?: string\n feedbackID: string\n answer: HTMLInputElement | React.ReactNode\n feedback: React.ReactNode\n focusedElement?: string\n remove: () => void\n}) {\n return (\n \n \n Richtig?\n \n \n {/* TODO: Change Placeholder to \"Antwort\" und \"Feedback\", Dependency Plugin Config */}\n \n {props.answer}\n \n \n \n {props.feedback}\n \n \n )\n}\n\ninterface SCMCInputProps {\n isRadio: boolean\n isActive: boolean\n handleChange: (event: React.MouseEvent) => void\n}\n","/**\n * @module @edtr-io/editor-ui\n */\n/** Comment needed because of https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/337 */\nimport {\n createEditorUiTheme,\n InputTheme,\n EditorThemeProps,\n styled\n} from '@edtr-io/ui'\nimport * as React from 'react'\n\nimport { InputProps } from './overlay-input'\n\nexport const createEditorInputTheme = createEditorUiTheme(theme => {\n return {\n color: theme.backgroundColor,\n backgroundColor: 'transparent',\n highlightColor: theme.primary.background\n }\n})\n\nconst EditorInputLabel = styled.label(\n (props: EditorThemeProps & { width: string | undefined }) => {\n const theme = createEditorInputTheme('input', props.theme)\n\n return {\n width: props.width,\n color: theme.color\n }\n }\n)\n\nconst EditorInputInner = styled.input(\n (props: EditorThemeProps & { textWidth: string | undefined }) => {\n const theme = createEditorInputTheme('input', props.theme)\n\n return {\n backgroundColor: theme.backgroundColor,\n border: 'none',\n width: props.textWidth,\n borderBottom: `2px solid ${theme.color}`,\n color: theme.color,\n paddingLeft: '10px',\n '&:focus': {\n outline: 'none',\n borderBottom: `2px solid ${theme.highlightColor}`\n }\n }\n }\n)\n\nexport class EditorInput extends React.Component {\n private input = React.createRef()\n\n public focus() {\n const input = this.input.current\n if (input) {\n input.focus()\n }\n }\n\n public render() {\n const { label, ...props } = this.props\n return (\n \n {label}\n \n \n )\n }\n}\n","/**\n * @module @edtr-io/editor-ui\n */\n/** Comment needed because of https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/337 */\nimport { styled } from '@edtr-io/ui'\n\nexport const PrimarySettings = styled.div({\n marginTop: '15px'\n})\n","/**\n * @module @edtr-io/editor-ui\n */\n/** Comment needed because of https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/337 */\nimport { ScopeContext } from '@edtr-io/core'\nimport { styled } from '@edtr-io/ui'\nimport * as React from 'react'\n\nconst NoClickArea = styled.div<{ active: boolean }>(props => {\n return {\n pointerEvents: props.active ? 'unset' : 'none',\n position: 'relative'\n }\n})\nconst Overlay = styled.div<{ active: boolean; blur: boolean }>(props => {\n return {\n display: props.active ? 'none' : undefined,\n position: 'absolute',\n width: '100%',\n height: '100%',\n top: 0,\n backgroundColor: props.blur ? 'rgba(255,255,255,0.8)' : undefined\n }\n})\n\nconst ButtonWrapper = styled.div({\n width: '100%',\n height: '100%',\n textAlign: 'center',\n display: 'flex'\n})\nconst ActivateButton = styled.button({\n pointerEvents: 'all',\n color: 'white',\n border: 'none',\n borderRadius: '5px',\n padding: '2px 10px',\n textAlign: 'center',\n outline: 'none',\n backgroundColor: 'rgb(0,126,193)',\n zIndex: 10,\n margin: 'auto'\n})\nexport const PreviewOverlay: React.FunctionComponent<\n PreviewOverlayProps\n> = props => {\n const [active, setActiveState] = React.useState(false)\n const { scope } = React.useContext(ScopeContext)\n\n const setActive = React.useCallback(\n (nextActive: boolean) => {\n if (props.onChange) {\n props.onChange(nextActive)\n }\n setActiveState(nextActive)\n },\n [props]\n )\n\n React.useEffect(() => {\n if (!props.focused && active) {\n setActive(false)\n }\n }, [props.focused, active, setActive])\n return (\n \n \n {props.focused ? (\n \n {\n setActive(true)\n }}\n >\n Aktivieren\n \n \n ) : null}\n \n {!props.editable ? (\n \n {props.children}\n \n ) : (\n props.children\n )}\n {active ? (\n \n {\n setActive(false)\n }}\n >\n Editieren\n \n \n ) : null}\n \n )\n}\n\ninterface PreviewOverlayProps {\n focused: boolean\n editable?: boolean\n onChange?: (nextActive: boolean) => void\n}\n","import { styled, EdtrIcon, edtrRowsControls } from '@edtr-io/editor-ui'\nimport { ThemeProps } from '@edtr-io/ui'\nimport * as React from 'react'\n\nimport { createRowPluginTheme } from '../..'\n\nconst StyledPlugin = styled.div(\n ({ name, ...props }) => {\n const theme = createRowPluginTheme(name, props.theme)\n return {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'flex-start',\n margin: '15px',\n width: '175px',\n borderRadius: '5px',\n padding: '15px',\n cursor: 'pointer',\n transition: '250ms all ease-in-out',\n color: theme.menu.primary.color,\n\n '&:hover': {\n backgroundColor: theme.menu.secondary.backgroundColor\n }\n }\n }\n)\n\nconst DefaultIcon = styled(EdtrIcon)({\n height: '100%',\n width: '100%'\n})\n\nconst IconWrapper = styled.div({\n height: '50px'\n})\n\nconst Title = styled.h3({\n marginTop: '15px',\n fontSize: '24px',\n marginBottom: '10px',\n fontWeight: 'bold',\n textAlign: 'center'\n})\n\nconst Description = styled.p({\n margin: 0,\n textAlign: 'center',\n fontSize: '16px'\n})\n\nexport const Plugin = ({\n plugin,\n pluginName,\n onClick,\n name\n}: {\n plugin: {\n name: string\n title?: string\n icon?: React.ComponentType\n description?: string\n }\n pluginName: string\n onClick: () => void\n name: string\n}) => {\n return (\n \n \n {plugin.icon ? (\n \n ) : (\n \n )}\n \n {plugin.title || pluginName}\n {plugin.description && {plugin.description}}\n \n )\n}\n","import { EdtrIcon, edtrRowsControls } from '@edtr-io/editor-ui'\nimport { styled, ThemeProps } from '@edtr-io/ui'\nimport * as React from 'react'\n\nimport { createRowPluginTheme } from '../..'\n\nconst StyledSearch = styled.div({\n paddingTop: '25px',\n paddingBottom: '25px',\n display: 'flex',\n justifyContent: 'center',\n width: '600px',\n '@media (max-width: 650px)': {\n width: '100%'\n }\n})\n\nconst InputWrapper = styled.div({\n position: 'relative',\n width: '100%'\n})\n\nconst StyledInput = styled.input(\n ({ name, ...props }: { name: string } & ThemeProps) => {\n const theme = createRowPluginTheme(name, props.theme)\n return {\n padding: '5px 30px',\n border: `2px solid ${theme.menu.secondary.color}`,\n borderRadius: '5px',\n fontSize: '20px',\n outline: 'none',\n backgroundColor: theme.menu.primary.backgroundColor,\n transition: '250ms all ease-in-out',\n width: '100%',\n\n '&:focus': {\n borderColor: theme.menu.highlightColor\n },\n\n '&::placeholder': {\n color: theme.menu.secondary.color\n }\n }\n }\n)\n\nconst ClearSearchContainer = styled.div<{ visible: boolean; name: string }>(\n props => {\n const theme = createRowPluginTheme(name, props.theme)\n return {\n height: '55%',\n position: 'absolute',\n top: '50%',\n right: '5px',\n transform: 'translateY(-50%)',\n opacity: props.visible ? 1 : 0,\n transition: '250ms all ease-in-out',\n cursor: 'pointer',\n color: theme.menu.secondary.color,\n\n '&:hover': {\n color: theme.menu.highlightColor\n }\n }\n }\n)\n\nconst SearchIcon = styled(EdtrIcon)<{ name: string } & ThemeProps>(\n ({ name, ...props }) => {\n const theme = createRowPluginTheme(name, props.theme)\n return {\n height: '55%',\n position: 'absolute',\n color: theme.menu.secondary.color,\n top: '50%',\n left: '5px',\n transform: 'translateY(-50%)'\n }\n }\n)\n\nexport const Search = ({\n search,\n setSearch,\n name\n}: {\n search: string\n setSearch: (newValue: string) => void\n name: string\n}) => {\n return (\n \n \n setSearch(e.target.value)}\n />\n 0}\n onClick={() => setSearch('')}\n >\n \n \n \n \n \n )\n}\n","import { useScopedSelector } from '@edtr-io/core'\nimport { styled, EdtrIcon, edtrRowsControls } from '@edtr-io/editor-ui'\nimport { getPlugins } from '@edtr-io/store'\nimport { ThemeProps } from '@edtr-io/ui'\nimport * as React from 'react'\n\nimport { createRowPluginTheme, PluginRegistry } from '../..'\nimport { Plugin } from './plugin'\nimport { Search } from './search'\n\nconst Wrapper = styled.div<{ name: string }>(\n ({ name, ...props }: ThemeProps & { name: string }) => {\n const theme = createRowPluginTheme(name, props.theme)\n return {\n display: 'flex',\n padding: '25px calc((100vw - 960px) / 2) 0',\n flexDirection: 'column',\n backgroundColor: theme.menu.primary.backgroundColor,\n alignItems: 'center',\n position: 'fixed',\n top: 0,\n left: 0,\n width: '100vw',\n height: '100vh',\n zIndex: 9999,\n\n '@media (max-width: 1000px)': {\n padding: '25px 20px 0'\n }\n }\n }\n)\n\nconst CloseButtonContainer = styled.div({\n position: 'absolute',\n top: '15px',\n right: '15px',\n width: '30px',\n cursor: 'pointer'\n})\n\nconst PluginList = styled.div({\n display: 'flex',\n justifyContent: 'space-around',\n flexWrap: 'wrap',\n overflowY: 'auto',\n alignItems: 'stretch'\n})\n\ninterface MenuProps {\n menu: {\n index: number\n onClose: (pluginState: { plugin: string; state?: unknown }) => void\n }\n setMenu: (newMenu?: MenuProps['menu']) => void\n name: string\n registry?: PluginRegistry\n}\n\nexport function Menu({ menu, setMenu, name, registry }: MenuProps) {\n const plugins = useScopedSelector(getPlugins())\n const [search, setSearch] = React.useState('')\n\n const close = React.useCallback(\n evt => {\n if (evt.key === 'Escape') setMenu(undefined)\n },\n [setMenu]\n )\n\n React.useEffect(() => {\n window.addEventListener('keydown', close)\n return () => {\n window.removeEventListener('keydown', close)\n }\n }, [close])\n\n const mappedPlugins = getAvailablePlugins()\n .filter(({ name: pluginKey }) => {\n const plugin = plugins[pluginKey]\n if (pluginKey === name || pluginKey === 'rows') return false\n if (!search.length) return true\n\n if (\n plugin.title &&\n plugin.title.toLowerCase().includes(search.toLowerCase())\n )\n return true\n if (\n plugin.description &&\n plugin.description.toLowerCase().includes(search.toLowerCase())\n )\n return true\n return pluginKey.toLowerCase().includes(search.toLowerCase())\n })\n .map(plugin => (\n menu.onClose({ plugin: plugin.name })}\n key={plugin.name}\n pluginName={plugin.name}\n plugin={plugin}\n name={name}\n />\n ))\n return (\n \n \n {mappedPlugins}\n setMenu(undefined)}>\n \n \n \n )\n\n function getAvailablePlugins(): PluginRegistry {\n return registry\n ? registry\n : Object.keys(plugins).map(name => {\n return { ...plugins[name], name }\n })\n }\n}\n","import { styled } from '@edtr-io/editor-ui'\nimport { ThemeProps } from '@edtr-io/ui'\n\nimport { createRowPluginTheme } from '.'\n\nexport const RowContainer = styled.div<{\n editable: boolean\n name: string\n noHeight?: boolean\n expanded?: boolean\n}>(\n ({\n name,\n editable,\n noHeight,\n expanded,\n ...props\n }: {\n name: string\n editable: boolean\n noHeight?: boolean\n expanded?: boolean\n } & ThemeProps) => {\n const theme = createRowPluginTheme(name, props.theme)\n return {\n ...(!noHeight\n ? {\n minHeight: '10px',\n marginBottom: '25px'\n }\n : {}),\n marginLeft: editable ? '15px' : undefined,\n position: 'relative',\n borderLeft: '2px solid transparent',\n paddingLeft: '5px',\n transition: '250ms all ease-in-out',\n\n ...(expanded\n ? {\n borderColor: theme.color,\n paddingTop: 0,\n paddingBottom: 0\n }\n : {})\n }\n }\n)\n","import { EdtrIcon, edtrRowsControls, styled } from '@edtr-io/editor-ui'\nimport { StateTypeReturnType } from '@edtr-io/plugin'\nimport * as React from 'react'\n\nimport { MoveControlsProps } from '.'\nimport { createRowPluginTheme, rowsState, rowState } from '../..'\n\nconst StyledControls = styled.div({\n display: 'flex'\n})\n\nconst IconContainer = styled.div<{ disabled?: boolean; name: string }>(\n ({ disabled, name, ...props }) => {\n const theme = createRowPluginTheme(name, props.theme)\n return {\n height: '24px',\n marginBottom: '15px',\n cursor: disabled ? 'not-allowed' : 'pointer',\n color: disabled ? theme.menu.secondary.color : theme.menu.primary.color,\n pointerEvents: disabled ? 'none' : undefined,\n '&:hover': {\n color: disabled ? theme.menu.secondary.color : theme.menu.highlightColor\n }\n }\n }\n)\n\nconst DragIcon = styled(IconContainer)({\n marginBottom: '5px',\n marginTop: '-3px',\n cursor: 'grab',\n userSelect: 'none',\n '&:active': {\n cursor: 'grabbing'\n }\n})\n\nconst Drag: React.FunctionComponent<\n IconProps & { connectDragSource: Function }\n> = ({ rows, connectDragSource, name }) => {\n return connectDragSource(\n
\n \n \n \n
\n )\n}\n\ninterface IconProps {\n name: string\n index: number\n rows: StateTypeReturnType\n row: StateTypeReturnType\n}\n\nexport const MoveControls = ({\n index,\n rows,\n row,\n name,\n connectDragSource\n}: MoveControlsProps) => {\n return (\n \n \n \n )\n}\n","import { faCog, Icon, styled } from '@edtr-io/editor-ui'\nimport { ThemeProps } from '@edtr-io/ui'\nimport * as React from 'react'\n\nimport { SettingsProps } from '.'\nimport { createRowPluginTheme } from '../..'\n\nconst StyledSettings = styled.div<\n ThemeProps & { expanded: boolean; name: string }\n>(({ expanded, name, ...props }) => {\n const theme = createRowPluginTheme(name, props.theme)\n return {\n position: 'absolute',\n top: 0,\n left: '-10px',\n transformOrigin: 'center top',\n transform: 'translateX(-100%)',\n pointerEvents: expanded ? 'all' : 'none',\n '&::before': {\n position: 'absolute',\n pointerEvents: 'none',\n top: 0,\n right: 0,\n content: '\"\"',\n opacity: 1,\n height: '100%',\n width: '2px',\n backgroundColor: theme.backgroundColor,\n zIndex: 15\n }\n }\n})\n\nconst StyledIconContainer = styled.div(\n ({ name, ...props }: ThemeProps & { name: string }) => {\n const theme = createRowPluginTheme(name, props.theme)\n return {\n height: '24px',\n opacity: 0.8,\n cursor: 'pointer',\n color: theme.menu.primary.color,\n\n '&:hover': {\n color: theme.menu.highlightColor\n }\n }\n }\n)\n\nconst Content = styled.div(\n ({ expanded, name, ...props }) => {\n const theme = createRowPluginTheme(name, props.theme)\n return {\n backgroundColor: theme.backgroundColor,\n paddingBottom: '10px',\n\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-end',\n opacity: expanded ? 1 : 0,\n zIndex: 16,\n position: 'relative',\n transition: '250ms all ease-in-out'\n }\n }\n)\n\nconst SettingsIcon = (props: { open: () => void; name: string }) => (\n \n \n \n \n \n)\n\nexport const Settings: React.FunctionComponent = ({\n name,\n children,\n expanded,\n setShowExtendedSettings\n}) => {\n return (\n \n \n {children}\n setShowExtendedSettings(true)} name={name} />\n \n \n )\n}\n","import { styled, Icon, faCopy, faTrashAlt } from '@edtr-io/editor-ui'\nimport { StateTypeReturnType } from '@edtr-io/plugin'\nimport * as React from 'react'\n\nimport { createRowPluginTheme, rowsState } from '../..'\n\nconst StyledGlobals = styled.div({\n display: 'flex',\n alignItems: 'center'\n})\n\nconst IconContainer = styled.div<{ disabled?: boolean; name: string }>(\n ({ disabled, name, ...props }) => {\n const theme = createRowPluginTheme(name, props.theme)\n return {\n margin: '0 5px 0 15px',\n padding: '5px',\n\n cursor: disabled ? 'not-allowed' : 'pointer',\n color: disabled ? theme.menu.secondary.color : theme.menu.primary.color,\n '&:hover': {\n color: disabled ? theme.menu.secondary.color : theme.highlightColor\n }\n }\n }\n)\n\nconst Copy = ({ duplicateRow, close, name }: GlobalsProps) => {\n return (\n {\n duplicateRow()\n close()\n }}\n >\n Kopieren\n \n )\n}\n\nconst Remove = ({ rows, index, close, name }: GlobalsProps) => {\n return (\n {\n rows.remove(index)\n close()\n }}\n >\n Löschen\n \n )\n}\n\ninterface GlobalsProps {\n name: string\n index: number\n rows: StateTypeReturnType\n close: () => void\n duplicateRow: () => void\n}\nexport const Globals = (props: GlobalsProps) => {\n return (\n \n \n \n \n )\n}\n","import { EdtrIcon, edtrRowsControls, styled } from '@edtr-io/editor-ui'\nimport { StateTypeReturnType } from '@edtr-io/plugin'\nimport * as React from 'react'\n\nimport { createRowPluginTheme, rowsState } from '../..'\nimport { Globals } from './globals'\n\nconst Overlay = styled.div<{ visible?: boolean; name: string }>(\n ({ visible, name, ...props }) => {\n const theme = createRowPluginTheme(name, props.theme)\n return {\n width: '100vw',\n height: '100vh',\n backgroundColor: theme.menu.secondary.backgroundColor,\n position: 'fixed',\n zIndex: 9999,\n top: 0,\n left: 0,\n display: visible ? 'flex' : 'none',\n justifyContent: 'center',\n alignItems: 'center'\n }\n }\n)\n\nconst Content = styled.div<{ name: string }>(({ name, ...props }) => {\n const theme = createRowPluginTheme(name, props.theme)\n return {\n backgroundColor: theme.backgroundColor,\n position: 'relative',\n padding: '15px',\n width: '98%',\n maxWidth: '600px',\n margin: 'auto'\n }\n})\n\nconst Header = styled.div({\n display: 'flex',\n justifyContent: 'space-between'\n})\n\nconst CloseBtnContainer = styled.div<{ name: string }>(({ name, ...props }) => {\n const theme = createRowPluginTheme(name, props.theme)\n return {\n width: '24px',\n height: '24px',\n cursor: 'pointer',\n color: theme.menu.primary.color,\n '&:hover': {\n color: theme.menu.highlightColor\n }\n }\n})\n\nconst Footer = styled.div<{ name: string }>(({ name, ...props }) => {\n const theme = createRowPluginTheme(name, props.theme)\n return {\n paddingTop: '10px',\n marginTop: '25px',\n borderTop: `1px solid ${theme.lightBackgroundColor}`, //rgba(182,182,182,1)\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between'\n }\n})\n\nconst CloseCaption = styled.div<{ name: string }>(({ name, ...props }) => {\n const theme = createRowPluginTheme(name, props.theme)\n return {\n color: theme.menu.highlightColor,\n cursor: 'pointer'\n }\n})\n\ninterface ExtendedSettingsProps {\n hideExtendedSettings: () => void\n expanded: boolean\n index: number\n rows: StateTypeReturnType\n duplicateRow: () => void\n extendedSettingsVisible: boolean\n name: string\n}\n\n// eslint-disable-next-line react/display-name\nexport const ExtendedSettingsWrapper = React.forwardRef<\n HTMLDivElement,\n ExtendedSettingsProps\n>(\n (\n {\n hideExtendedSettings,\n expanded,\n index,\n rows,\n duplicateRow,\n extendedSettingsVisible,\n name\n }: ExtendedSettingsProps,\n ref\n ) => {\n React.useEffect(() => {\n function closeListener(evt: KeyboardEvent) {\n if (evt.key === 'Escape') {\n hideExtendedSettings()\n }\n }\n window.addEventListener('keydown', closeListener)\n\n return () => {\n window.removeEventListener('keydown', closeListener)\n }\n }, [hideExtendedSettings])\n\n // render only the expanded, so only one extended settings exist\n if (!expanded) return null\n // render even if not yet visible, because of ref.\n return (\n \n \n
\n

Erweiterte Einstellungen

\n \n \n \n
\n
\n
\n \n \n Schließen\n \n
\n \n \n )\n }\n)\n","import { StateTypeReturnType } from '@edtr-io/plugin'\nimport * as React from 'react'\n\nimport { rowsState, rowState } from '../..'\nimport { MoveControls } from './move-controls'\nimport { Settings } from './settings'\n\nexport { ExtendedSettingsWrapper } from './extended-settings'\n\nexport interface SettingsProps {\n name: string\n expanded: boolean\n setShowExtendedSettings: (showExtendedSettings: boolean) => void\n}\n\nexport interface MoveControlsProps {\n name: string\n index: number\n rows: StateTypeReturnType\n row: StateTypeReturnType\n connectDragSource: Function //TODO fix me\n}\n\ntype ControlsProps = SettingsProps & MoveControlsProps\n\nexport const Controls = ({\n index,\n expanded,\n setShowExtendedSettings,\n name,\n rows,\n row,\n connectDragSource\n}: ControlsProps) => {\n return (\n \n \n \n \n \n )\n}\n","import { Plugin } from '@edtr-io/plugin'\nimport { DocumentState } from '@edtr-io/store'\nimport * as React from 'react'\nimport {\n ConnectDragPreview,\n ConnectDragSource,\n ConnectDropTarget,\n DragSource,\n DropTarget,\n DropTargetMonitor\n} from 'react-dnd'\nimport { NativeTypes } from 'react-dnd-html5-backend'\n\nimport { RowSourceProps, RowMenuProps } from './row'\n\nexport interface CollectedProps {\n connectDragSource: ConnectDragSource\n connectDragPreview: ConnectDragPreview\n isDragging: boolean\n}\n\nexport interface TargetProps {\n connectDropTarget: ConnectDropTarget\n}\n\nexport function connectDnD(\n Comp: React.ComponentType\n) {\n return DropTarget<\n {\n index: number\n moveRow: (from: number, to: number) => void\n insert: (index: number, data: DocumentState) => void\n plugins: Record\n },\n TargetProps\n >(\n ['row', NativeTypes.FILE, NativeTypes.URL],\n {\n hover(props, monitor, component) {\n if (!component) {\n return null\n }\n const node = component.getNode()\n if (!node) {\n return null\n }\n // set the boundingRect for later use (see isDraggingAbove)\n monitor.getItem().boundingRect = node.getBoundingClientRect()\n\n if (monitor.getItemType() === 'row') {\n const dragIndex = monitor.getItem().index\n const hoverIndex = props.index\n if (dragIndex === hoverIndex) {\n return\n }\n\n const draggingAbove = isDraggingAbove(monitor)\n if (dragIndex < hoverIndex && draggingAbove) {\n return\n }\n if (dragIndex > hoverIndex && !draggingAbove) {\n return\n }\n\n props.moveRow(dragIndex, hoverIndex)\n monitor.getItem().index = hoverIndex\n }\n },\n drop(props, monitor) {\n const type = monitor.getItemType()\n if (type !== NativeTypes.FILE && type !== NativeTypes.URL) {\n return\n }\n\n if (monitor.didDrop()) {\n // handled in nested dropzone\n return\n }\n const dropIndex = props.index\n\n let transfer: DataTransfer\n if (type === NativeTypes.FILE) {\n const files: File[] = monitor.getItem().files\n transfer = createFakeDataTransfer(files)\n } else {\n // NativeTypes.URL\n const urls: string[] = monitor.getItem().urls\n transfer = createFakeDataTransfer([], urls[0])\n }\n\n for (const key in props.plugins) {\n const { onPaste } = props.plugins[key]\n if (typeof onPaste === 'function') {\n const result = onPaste(transfer)\n if (result !== undefined) {\n if (isDraggingAbove(monitor)) {\n props.insert(dropIndex, { plugin: key, state: result.state })\n } else {\n props.insert(dropIndex + 1, {\n plugin: key,\n state: result.state\n })\n }\n return\n }\n }\n }\n }\n },\n connect => ({\n connectDropTarget: connect.dropTarget()\n })\n )(\n DragSource<\n { id: number; index: number },\n CollectedProps,\n { id: number; index: number }\n >(\n 'row',\n {\n beginDrag: props => ({\n id: props.id,\n index: props.index\n })\n },\n (connect, monitor) => ({\n connectDragSource: connect.dragSource(),\n connectDragPreview: connect.dragPreview(),\n isDragging: monitor.isDragging()\n })\n )(Comp)\n )\n}\nfunction isDraggingAbove(monitor: DropTargetMonitor) {\n // get bounding Rect set in hover\n const domBoundingRect = monitor.getItem().boundingRect\n\n const domMiddleY = (domBoundingRect.bottom - domBoundingRect.top) / 2\n const dropClientOffset = monitor.getClientOffset()\n const dragClientY = dropClientOffset\n ? dropClientOffset.y - domBoundingRect.top\n : 0\n\n return dragClientY < domMiddleY\n}\n\n// Needed until we get the correct dataTransfer (see e.g. https://github.com/react-dnd/react-dnd/issues/635)\nfunction createFakeDataTransfer(files: File[], text?: string) {\n class FakeDataTransfer extends DataTransfer {\n public dropEffect = 'all'\n public effectAllowed = 'all'\n public readonly files = (files as unknown) as FileList\n public readonly types = ['Files']\n public getData(type: string) {\n if (type.toLowerCase().startsWith('text')) {\n return text || ''\n }\n return ''\n }\n }\n return new FakeDataTransfer()\n}\n","import { useScopedDispatch, useScopedStore } from '@edtr-io/core'\nimport { StateTypeReturnType } from '@edtr-io/plugin'\nimport {\n change,\n findNextNode,\n findPreviousNode,\n getDocument,\n getFocusTree\n} from '@edtr-io/store'\nimport * as React from 'react'\n\nimport { rowsState, rowState } from '..'\n\nexport function RowRenderer({\n row,\n rows,\n index,\n renderIntoExtendedSettings,\n PrimarySettingsWrapper\n}: {\n row: StateTypeReturnType\n rows: StateTypeReturnType\n index: number\n renderIntoExtendedSettings: (children: React.ReactChild) => React.ReactNode\n PrimarySettingsWrapper: React.ComponentType\n}) {\n const dispatch = useScopedDispatch()\n const store = useScopedStore()\n const pluginProps = React.useMemo(() => {\n return {\n renderIntoExtendedSettings,\n PrimarySettingsWrapper,\n insert: (options?: { plugin: string; state?: unknown }) =>\n rows.insert(index + 1, options),\n replace: (options?: { plugin: string; state?: unknown }) => {\n rows.remove(index)\n rows.insert(index, options)\n },\n remove: () => {\n rows.remove(index)\n },\n mergeWithPrevious: (merge: (statePrevious: unknown) => unknown) => {\n if (index - 1 < 0) return\n\n const current = getDocument(row.id)(store.getState())\n\n let previous = getDocument(rows[index - 1].id)(store.getState())\n if (!previous || !current) return\n\n if (previous.plugin !== current.plugin) {\n // check if previous focus plugin is the same type\n const root = getFocusTree()(store.getState())\n if (!root) return\n\n const previousFocusId = findPreviousNode(root, row.id)\n if (!previousFocusId) return\n\n previous = getDocument(previousFocusId)(store.getState())\n if (!previous || previous.plugin !== current.plugin) return\n\n const merged = merge(previous.state)\n dispatch(\n change({\n id: previousFocusId,\n state: () => merged\n })\n )\n rows.remove(index)\n } else {\n merge(previous.state)\n setTimeout(() => rows.remove(index - 1))\n }\n },\n mergeWithNext: (merge: (statePrevious: unknown) => unknown) => {\n if (index + 1 === rows.length) return\n const current = getDocument(row.id)(store.getState())\n let next = getDocument(rows[index + 1].id)(store.getState())\n if (!next || !current) return\n if (next.plugin !== current.plugin) {\n // check if next focus plugin is the same type\n const root = getFocusTree()(store.getState())\n if (!root) return\n\n const nextFocusId = findNextNode(root, row.id)\n if (!nextFocusId) return\n\n // use that plugin for merge\n next = getDocument(nextFocusId)(store.getState())\n if (!next || next.plugin !== current.plugin) return\n }\n\n merge(next.state)\n setTimeout(() => {\n rows.remove(index + 1)\n })\n }\n }\n }, [\n store,\n PrimarySettingsWrapper,\n dispatch,\n index,\n renderIntoExtendedSettings,\n row.id,\n rows\n ])\n\n return {row.render(pluginProps)}\n}\n","import { styled, EdtrIcon, edtrRowsControls } from '@edtr-io/editor-ui'\nimport { ThemeProps } from '@edtr-io/ui'\nimport * as React from 'react'\n\nimport { createRowPluginTheme } from '..'\n\nconst StyledSeparator = styled.div<{ isFirst?: boolean }>(({ isFirst }) => {\n return {\n position: 'absolute',\n height: 'auto',\n width: '100%',\n transform: isFirst ? 'translateY(-100%)' : 'translateY(100%)',\n top: isFirst ? 0 : undefined,\n bottom: isFirst ? undefined : 0\n }\n})\n\nconst AddTrigger = styled.div<{ focused: boolean; name: string }>(\n ({\n name,\n focused,\n ...props\n }: ThemeProps & { focused: boolean; name: string }) => {\n const theme = createRowPluginTheme(name, props.theme)\n return {\n width: '26px',\n height: '26px',\n borderRadius: '13px',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n color: theme.color,\n backgroundColor: theme.backgroundColor,\n padding: '5px 0 10px',\n opacity: focused ? 0.6 : 0,\n transition: '250ms all ease-in-out 250ms',\n // position: inline ? 'absolute' : 'relative',\n zIndex: 70,\n\n '&:hover': {\n color: theme.highlightColor,\n opacity: 1,\n cursor: 'pointer'\n }\n }\n }\n)\n\nconst TriggerArea = styled.div({\n width: '100%',\n padding: '2px 0 4px',\n display: 'flex',\n justifyContent: 'center',\n\n '&:hover .add-trigger': {\n opacity: 0.6\n }\n})\n\nconst Icon = styled(EdtrIcon)({\n width: '26px'\n})\n\nexport const Add: React.FunctionComponent<{\n name: string\n focused: boolean\n onClick: () => void\n}> = props => {\n return (\n \n \n \n )\n}\n\nexport const Separator: React.FunctionComponent<{\n isFirst?: boolean\n name: string\n onClick: () => void\n focused?: boolean\n}> = ({ isFirst, onClick, name, focused }) => {\n return (\n \n \n \n \n \n )\n}\n","import { useScopedSelector } from '@edtr-io/core'\nimport { PrimarySettings } from '@edtr-io/editor-ui'\nimport { StatefulPluginEditorProps } from '@edtr-io/plugin'\nimport { isFocused } from '@edtr-io/store'\nimport { ThemeProvider, usePluginTheme } from '@edtr-io/ui'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { RowContainer } from '../row-container'\nimport { Controls, ExtendedSettingsWrapper } from './controls'\nimport { connectDnD, CollectedProps, TargetProps } from './dnd-hoc'\nimport { RowRenderer } from './render'\nimport { Separator } from './separator'\nimport { rowsPluginThemeFactory, rowsState } from '..'\n\nconst PrimarySettingsWrapper: React.FunctionComponent = props => {\n React.useEffect(() => {\n // eslint-disable-next-line no-console\n console.warn(\n 'PrimarySettingsWrapper of @edtr-io/plugin-rows is deprecated. Use PrimarySettings of @edtr-io/editor-ui instead.'\n )\n }, [])\n return \n}\nexport type RowExposedProps = StatefulPluginEditorProps & {\n moveRow: (from: number, to: number) => void\n insert: (index: number, options?: { plugin: string; state?: unknown }) => void\n index: number\n doc: { plugin: string; state?: unknown }\n}\n\nexport type RowSourceProps = RowExposedProps & CollectedProps & TargetProps\n\nconst RowSource = React.forwardRef<\n { getNode: () => HTMLDivElement | null },\n RowSourceProps & RowMenuProps\n>((props, ref) => {\n const [expandedState, setExpanded] = React.useState(false)\n const [showExtendedSettings, setShowExtendedSettings] = React.useState(false)\n const rows = props.state\n const index = props.index\n const row = rows[index]\n const focused = useScopedSelector(isFocused(row.id))\n\n // DnD\n const rowRef = React.useRef(null)\n\n React.useImperativeHandle(ref, () => {\n return { getNode: () => rowRef.current }\n })\n\n if (props.connectDragSource) {\n props.connectDragPreview(rowRef)\n props.connectDropTarget(rowRef)\n // const opacity = isDragging ? 0 : 1\n }\n\n const extendedSettingsNode = React.useRef(null)\n const settingsTheme = usePluginTheme(name, rowsPluginThemeFactory)\n\n const theme = React.useMemo(() => {\n return {\n editorUi: {\n overlay: {\n input: {\n backgroundColor: settingsTheme.backgroundColor,\n color: settingsTheme.menu.primary.color\n },\n button: {\n backgroundColor: settingsTheme.backgroundColor,\n color: settingsTheme.menu.primary.color,\n borderColor: settingsTheme.menu.primary.color\n },\n textarea: {\n backgroundColor: settingsTheme.backgroundColor,\n color: settingsTheme.menu.primary.color,\n borderColor: settingsTheme.menu.primary.color\n },\n checkbox: {\n color: settingsTheme.menu.primary.color,\n boxDeselectedColor: settingsTheme.backgroundColor,\n boxSelectedColor: settingsTheme.menu.primary.color\n }\n }\n }\n }\n }, [settingsTheme])\n React.useLayoutEffect(() => {\n if (!props.focused && !focused) {\n setExpanded(false)\n }\n }, [focused, props.focused])\n const expanded = (props.focused || focused) && expandedState\n return (\n \n {\n if (focused) {\n setExpanded(true)\n }\n }}\n >\n {\n if (!extendedSettingsNode.current) return null\n\n return createPortal(\n {children},\n extendedSettingsNode.current\n )\n }}\n PrimarySettingsWrapper={PrimarySettingsWrapper}\n />\n {\n setShowExtendedSettings(false)\n }}\n expanded={expanded}\n index={index}\n rows={rows}\n duplicateRow={() => rows.insert(index, props.doc)}\n ref={extendedSettingsNode}\n extendedSettingsVisible={showExtendedSettings}\n name={props.name}\n />\n {props.editable && (\n \n \n \n )}\n \n {\n props.openMenu(index + 1)\n }}\n />\n \n )\n})\nRowSource.displayName = 'RowSource'\n\nexport const Row = connectDnD(RowSource)\n\nexport interface RowMenuProps {\n openMenu: (insertIndex: number) => void\n}\n","import { useScopedStore } from '@edtr-io/core'\nimport { StatefulPluginEditorProps } from '@edtr-io/plugin'\nimport { getDocument } from '@edtr-io/store'\nimport * as React from 'react'\n\nimport { Menu } from './menu'\nimport { Row } from './row'\nimport { Separator } from './separator'\nimport { rowsState, PluginRegistry } from '..'\n\nexport const RowsEditor = (\n props: StatefulPluginEditorProps & {\n plugins?: PluginRegistry\n }\n) => {\n const rows = props.state\n const store = useScopedStore()\n const [menu, setMenu] = React.useState<\n | {\n index: number\n onClose: (pluginState: { plugin: string; state?: unknown }) => void\n }\n | undefined\n >(undefined)\n\n function openMenu(insertIndex: number) {\n setMenu({\n index: insertIndex,\n onClose: pluginState => {\n rows.insert(insertIndex, pluginState)\n setMenu(undefined)\n }\n })\n }\n\n return (\n
\n {\n openMenu(0)\n }}\n />\n {rows.map((row, index) => {\n const doc = getDocument(row.id)(store.getState())\n\n if (!doc) return null\n return (\n
\n {\n rows.move(from, to)\n }}\n insert={(index, options) => {\n rows.insert(index, options)\n }}\n openMenu={openMenu}\n />\n
\n )\n })}\n {menu ? (\n \n ) : null}\n
\n )\n}\n","import { useScopedStore } from '@edtr-io/core'\nimport { StatefulPluginEditorProps } from '@edtr-io/plugin'\nimport { getDocument } from '@edtr-io/store'\nimport * as React from 'react'\n\nimport { rowsState } from '.'\nimport { RowContainer } from './row-container'\n\nexport const RowsRenderer = (\n props: StatefulPluginEditorProps\n) => {\n const store = useScopedStore()\n\n return (\n \n {props.state.map(row => {\n const doc = getDocument(row.id)(store.getState())\n\n return (\n \n {row.render()}\n \n )\n })}\n \n )\n}\n","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-download';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f56d';\nvar svgPathData = 'M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm76.45 211.36l-96.42 95.7c-6.65 6.61-17.39 6.61-24.04 0l-96.42-95.7C73.42 337.29 80.54 320 94.82 320H160v-80c0-8.84 7.16-16 16-16h32c8.84 0 16 7.16 16 16v80h65.18c14.28 0 21.4 17.29 11.27 27.36zM377 105L279.1 7c-4.5-4.5-10.6-7-17-7H256v128h128v-6.1c0-6.3-2.5-12.4-7-16.9z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFileDownload = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-archive';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1c6';\nvar svgPathData = 'M377 105L279.1 7c-4.5-4.5-10.6-7-17-7H256v128h128v-6.1c0-6.3-2.5-12.4-7-16.9zM128.4 336c-17.9 0-32.4 12.1-32.4 27 0 15 14.6 27 32.5 27s32.4-12.1 32.4-27-14.6-27-32.5-27zM224 136V0h-63.6v32h-32V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zM95.9 32h32v32h-32zm32.3 384c-33.2 0-58-30.4-51.4-62.9L96.4 256v-32h32v-32h-32v-32h32v-32h-32V96h32V64h32v32h-32v32h32v32h-32v32h32v32h-32v32h22.1c5.7 0 10.7 4.1 11.8 9.7l17.3 87.7c6.4 32.4-18.4 62.6-51.4 62.6z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFileArchive = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-audio';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1c7';\nvar svgPathData = 'M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm-64 268c0 10.7-12.9 16-20.5 8.5L104 376H76c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h28l35.5-36.5c7.6-7.6 20.5-2.2 20.5 8.5v136zm33.2-47.6c9.1-9.3 9.1-24.1 0-33.4-22.1-22.8 12.2-56.2 34.4-33.5 27.2 27.9 27.2 72.4 0 100.4-21.8 22.3-56.9-10.4-34.4-33.5zm86-117.1c54.4 55.9 54.4 144.8 0 200.8-21.8 22.4-57-10.3-34.4-33.5 36.2-37.2 36.3-96.5 0-133.8-22.1-22.8 12.3-56.3 34.4-33.5zM384 121.9v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFileAudio = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'check-circle';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f058';\nvar svgPathData = 'M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCheckCircle = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-excel';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1c3';\nvar svgPathData = 'M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm60.1 106.5L224 336l60.1 93.5c5.1 8-.6 18.5-10.1 18.5h-34.9c-4.4 0-8.5-2.4-10.6-6.3C208.9 405.5 192 373 192 373c-6.4 14.8-10 20-36.6 68.8-2.1 3.9-6.1 6.3-10.5 6.3H110c-9.5 0-15.2-10.5-10.1-18.5l60.3-93.5-60.3-93.5c-5.2-8 .6-18.5 10.1-18.5h34.8c4.4 0 8.5 2.4 10.6 6.3 26.1 48.8 20 33.6 36.6 68.5 0 0 6.1-11.7 36.6-68.5 2.1-3.9 6.2-6.3 10.6-6.3H274c9.5-.1 15.2 10.4 10.1 18.4zM384 121.9v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFileExcel = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-image';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1c5';\nvar svgPathData = 'M384 121.941V128H256V0h6.059a24 24 0 0 1 16.97 7.029l97.941 97.941a24.002 24.002 0 0 1 7.03 16.971zM248 160c-13.2 0-24-10.8-24-24V0H24C10.745 0 0 10.745 0 24v464c0 13.255 10.745 24 24 24h336c13.255 0 24-10.745 24-24V160H248zm-135.455 16c26.51 0 48 21.49 48 48s-21.49 48-48 48-48-21.49-48-48 21.491-48 48-48zm208 240h-256l.485-48.485L104.545 328c4.686-4.686 11.799-4.201 16.485.485L160.545 368 264.06 264.485c4.686-4.686 12.284-4.686 16.971 0L320.545 304v112z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFileImage = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-pdf';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1c1';\nvar svgPathData = 'M181.9 256.1c-5-16-4.9-46.9-2-46.9 8.4 0 7.6 36.9 2 46.9zm-1.7 47.2c-7.7 20.2-17.3 43.3-28.4 62.7 18.3-7 39-17.2 62.9-21.9-12.7-9.6-24.9-23.4-34.5-40.8zM86.1 428.1c0 .8 13.2-5.4 34.9-40.2-6.7 6.3-29.1 24.5-34.9 40.2zM248 160h136v328c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V24C0 10.7 10.7 0 24 0h200v136c0 13.2 10.8 24 24 24zm-8 171.8c-20-12.2-33.3-29-42.7-53.8 4.5-18.5 11.6-46.6 6.2-64.2-4.7-29.4-42.4-26.5-47.8-6.8-5 18.3-.4 44.1 8.1 77-11.6 27.6-28.7 64.6-40.8 85.8-.1 0-.1.1-.2.1-27.1 13.9-73.6 44.5-54.5 68 5.6 6.9 16 10 21.5 10 17.9 0 35.7-18 61.1-61.8 25.8-8.5 54.1-19.1 79-23.2 21.7 11.8 47.1 19.5 64 19.5 29.2 0 31.2-32 19.7-43.4-13.9-13.6-54.3-9.7-73.6-7.2zM377 105L279 7c-4.5-4.5-10.6-7-17-7h-6v128h128v-6.1c0-6.3-2.5-12.4-7-16.9zm-74.1 255.3c4.1-2.7-2.5-11.9-42.8-9 37.1 15.8 42.8 9 42.8 9z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFilePdf = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'smile';\nvar width = 496;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f118';\nvar svgPathData = 'M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm80 168c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm-160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm194.8 170.2C334.3 380.4 292.5 400 248 400s-86.3-19.6-114.8-53.8c-13.6-16.3 11-36.7 24.6-20.5 22.4 26.9 55.2 42.2 90.2 42.2s67.8-15.4 90.2-42.2c13.4-16.2 38.1 4.2 24.6 20.5z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faSmile = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-word';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1c2';\nvar svgPathData = 'M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm57.1 120H305c7.7 0 13.4 7.1 11.7 14.7l-38 168c-1.2 5.5-6.1 9.3-11.7 9.3h-38c-5.5 0-10.3-3.8-11.6-9.1-25.8-103.5-20.8-81.2-25.6-110.5h-.5c-1.1 14.3-2.4 17.4-25.6 110.5-1.3 5.3-6.1 9.1-11.6 9.1H117c-5.6 0-10.5-3.9-11.7-9.4l-37.8-168c-1.7-7.5 4-14.6 11.7-14.6h24.5c5.7 0 10.7 4 11.8 9.7 15.6 78 20.1 109.5 21 122.2 1.6-10.2 7.3-32.7 29.4-122.7 1.3-5.4 6.1-9.1 11.7-9.1h29.1c5.6 0 10.4 3.8 11.7 9.2 24 100.4 28.8 124 29.6 129.4-.2-11.2-2.6-17.8 21.6-129.2 1-5.6 5.9-9.5 11.5-9.5zM384 121.9v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFileWord = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-video';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1c8';\nvar svgPathData = 'M384 121.941V128H256V0h6.059c6.365 0 12.47 2.529 16.971 7.029l97.941 97.941A24.005 24.005 0 0 1 384 121.941zM224 136V0H24C10.745 0 0 10.745 0 24v464c0 13.255 10.745 24 24 24h336c13.255 0 24-10.745 24-24V160H248c-13.2 0-24-10.8-24-24zm96 144.016v111.963c0 21.445-25.943 31.998-40.971 16.971L224 353.941V392c0 13.255-10.745 24-24 24H88c-13.255 0-24-10.745-24-24V280c0-13.255 10.745-24 24-24h112c13.255 0 24 10.745 24 24v38.059l55.029-55.013c15.011-15.01 40.971-4.491 40.971 16.97z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFileVideo = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-powerpoint';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1c4';\nvar svgPathData = 'M193.7 271.2c8.8 0 15.5 2.7 20.3 8.1 9.6 10.9 9.8 32.7-.2 44.1-4.9 5.6-11.9 8.5-21.1 8.5h-26.9v-60.7h27.9zM377 105L279 7c-4.5-4.5-10.6-7-17-7h-6v128h128v-6.1c0-6.3-2.5-12.4-7-16.9zm-153 31V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm53 165.2c0 90.3-88.8 77.6-111.1 77.6V436c0 6.6-5.4 12-12 12h-30.8c-6.6 0-12-5.4-12-12V236.2c0-6.6 5.4-12 12-12h81c44.5 0 72.9 32.8 72.9 77z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFilePowerpoint = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","import _extends from '@babel/runtime/helpers/esm/extends';\nimport _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose';\nimport _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';\nimport _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\nvar isIE = !!document.documentElement.currentStyle;\nvar HIDDEN_TEXTAREA_STYLE = {\n 'min-height': '0',\n 'max-height': 'none',\n height: '0',\n visibility: 'hidden',\n overflow: 'hidden',\n position: 'absolute',\n 'z-index': '-1000',\n top: '0',\n right: '0'\n};\nvar SIZING_STYLE = ['letter-spacing', 'line-height', 'font-family', 'font-weight', 'font-size', 'font-style', 'tab-size', 'text-rendering', 'text-transform', 'width', 'text-indent', 'padding-top', 'padding-right', 'padding-bottom', 'padding-left', 'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width', 'box-sizing'];\nvar computedStyleCache = {};\nvar hiddenTextarea = document.createElement('textarea');\n\nvar forceHiddenStyles = function forceHiddenStyles(node) {\n Object.keys(HIDDEN_TEXTAREA_STYLE).forEach(function (key) {\n node.style.setProperty(key, HIDDEN_TEXTAREA_STYLE[key], 'important');\n });\n};\n\n{\n forceHiddenStyles(hiddenTextarea);\n}\n\nfunction calculateNodeHeight(uiTextNode, uid, useCache, minRows, maxRows) {\n if (useCache === void 0) {\n useCache = false;\n }\n\n if (minRows === void 0) {\n minRows = null;\n }\n\n if (maxRows === void 0) {\n maxRows = null;\n }\n\n if (hiddenTextarea.parentNode === null) {\n document.body.appendChild(hiddenTextarea);\n } // Copy all CSS properties that have an impact on the height of the content in\n // the textbox\n\n\n var nodeStyling = calculateNodeStyling(uiTextNode, uid, useCache);\n\n if (nodeStyling === null) {\n return null;\n }\n\n var paddingSize = nodeStyling.paddingSize,\n borderSize = nodeStyling.borderSize,\n boxSizing = nodeStyling.boxSizing,\n sizingStyle = nodeStyling.sizingStyle; // Need to have the overflow attribute to hide the scrollbar otherwise\n // text-lines will not calculated properly as the shadow will technically be\n // narrower for content\n\n Object.keys(sizingStyle).forEach(function (key) {\n hiddenTextarea.style[key] = sizingStyle[key];\n });\n forceHiddenStyles(hiddenTextarea);\n hiddenTextarea.value = uiTextNode.value || uiTextNode.placeholder || 'x';\n var minHeight = -Infinity;\n var maxHeight = Infinity;\n var height = hiddenTextarea.scrollHeight;\n\n if (boxSizing === 'border-box') {\n // border-box: add border, since height = content + padding + border\n height = height + borderSize;\n } else if (boxSizing === 'content-box') {\n // remove padding, since height = content\n height = height - paddingSize;\n } // measure height of a textarea with a single row\n\n\n hiddenTextarea.value = 'x';\n var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize; // Stores the value's rows count rendered in `hiddenTextarea`,\n // regardless if `maxRows` or `minRows` props are passed\n\n var valueRowCount = Math.floor(height / singleRowHeight);\n\n if (minRows !== null) {\n minHeight = singleRowHeight * minRows;\n\n if (boxSizing === 'border-box') {\n minHeight = minHeight + paddingSize + borderSize;\n }\n\n height = Math.max(minHeight, height);\n }\n\n if (maxRows !== null) {\n maxHeight = singleRowHeight * maxRows;\n\n if (boxSizing === 'border-box') {\n maxHeight = maxHeight + paddingSize + borderSize;\n }\n\n height = Math.min(maxHeight, height);\n }\n\n var rowCount = Math.floor(height / singleRowHeight);\n return {\n height: height,\n minHeight: minHeight,\n maxHeight: maxHeight,\n rowCount: rowCount,\n valueRowCount: valueRowCount\n };\n}\n\nfunction calculateNodeStyling(node, uid, useCache) {\n if (useCache === void 0) {\n useCache = false;\n }\n\n if (useCache && computedStyleCache[uid]) {\n return computedStyleCache[uid];\n }\n\n var style = window.getComputedStyle(node);\n\n if (style === null) {\n return null;\n }\n\n var sizingStyle = SIZING_STYLE.reduce(function (obj, name) {\n obj[name] = style.getPropertyValue(name);\n return obj;\n }, {});\n var boxSizing = sizingStyle['box-sizing']; // probably node is detached from DOM, can't read computed dimensions\n\n if (boxSizing === '') {\n return null;\n } // IE (Edge has already correct behaviour) returns content width as computed width\n // so we need to add manually padding and border widths\n\n\n if (isIE && boxSizing === 'border-box') {\n sizingStyle.width = parseFloat(sizingStyle.width) + parseFloat(style['border-right-width']) + parseFloat(style['border-left-width']) + parseFloat(style['padding-right']) + parseFloat(style['padding-left']) + 'px';\n }\n\n var paddingSize = parseFloat(sizingStyle['padding-bottom']) + parseFloat(sizingStyle['padding-top']);\n var borderSize = parseFloat(sizingStyle['border-bottom-width']) + parseFloat(sizingStyle['border-top-width']);\n var nodeInfo = {\n sizingStyle: sizingStyle,\n paddingSize: paddingSize,\n borderSize: borderSize,\n boxSizing: boxSizing\n };\n\n if (useCache) {\n computedStyleCache[uid] = nodeInfo;\n }\n\n return nodeInfo;\n}\n\nvar purgeCache = function purgeCache(uid) {\n delete computedStyleCache[uid];\n};\n\nvar noop = function noop() {};\n\nvar uid = 0;\n\nvar TextareaAutosize =\n/*#__PURE__*/\nfunction (_React$Component) {\n _inheritsLoose(TextareaAutosize, _React$Component);\n\n function TextareaAutosize(props) {\n var _this;\n\n _this = _React$Component.call(this, props) || this;\n\n _this._onRef = function (node) {\n _this._ref = node;\n var inputRef = _this.props.inputRef;\n\n if (typeof inputRef === 'function') {\n inputRef(node);\n return;\n }\n\n inputRef.current = node;\n };\n\n _this._onChange = function (event) {\n if (!_this._controlled) {\n _this._resizeComponent();\n }\n\n _this.props.onChange(event, _assertThisInitialized(_assertThisInitialized(_this)));\n };\n\n _this._resizeComponent = function (callback) {\n if (callback === void 0) {\n callback = noop;\n }\n\n var nodeHeight = calculateNodeHeight(_this._ref, _this._uid, _this.props.useCacheForDOMMeasurements, _this.props.minRows, _this.props.maxRows);\n\n if (nodeHeight === null) {\n callback();\n return;\n }\n\n var height = nodeHeight.height,\n minHeight = nodeHeight.minHeight,\n maxHeight = nodeHeight.maxHeight,\n rowCount = nodeHeight.rowCount,\n valueRowCount = nodeHeight.valueRowCount;\n _this.rowCount = rowCount;\n _this.valueRowCount = valueRowCount;\n\n if (_this.state.height !== height || _this.state.minHeight !== minHeight || _this.state.maxHeight !== maxHeight) {\n _this.setState({\n height: height,\n minHeight: minHeight,\n maxHeight: maxHeight\n }, callback);\n\n return;\n }\n\n callback();\n };\n\n _this.state = {\n height: props.style && props.style.height || 0,\n minHeight: -Infinity,\n maxHeight: Infinity\n };\n _this._uid = uid++;\n _this._controlled = props.value !== undefined;\n _this._resizeLock = false;\n return _this;\n }\n\n var _proto = TextareaAutosize.prototype;\n\n _proto.render = function render() {\n var _this$props = this.props,\n _inputRef = _this$props.inputRef,\n _maxRows = _this$props.maxRows,\n _minRows = _this$props.minRows,\n _onHeightChange = _this$props.onHeightChange,\n _useCacheForDOMMeasurements = _this$props.useCacheForDOMMeasurements,\n props = _objectWithoutPropertiesLoose(_this$props, [\"inputRef\", \"maxRows\", \"minRows\", \"onHeightChange\", \"useCacheForDOMMeasurements\"]);\n\n props.style = _extends({}, props.style, {\n height: this.state.height\n });\n var maxHeight = Math.max(props.style.maxHeight || Infinity, this.state.maxHeight);\n\n if (maxHeight < this.state.height) {\n props.style.overflow = 'hidden';\n }\n\n return React.createElement(\"textarea\", _extends({}, props, {\n onChange: this._onChange,\n ref: this._onRef\n }));\n };\n\n _proto.componentDidMount = function componentDidMount() {\n var _this2 = this;\n\n this._resizeComponent(); // Working around Firefox bug which runs resize listeners even when other JS is running at the same moment\n // causing competing rerenders (due to setState in the listener) in React.\n // More can be found here - facebook/react#6324\n\n\n this._resizeListener = function () {\n if (_this2._resizeLock) {\n return;\n }\n\n _this2._resizeLock = true;\n\n _this2._resizeComponent(function () {\n _this2._resizeLock = false;\n });\n };\n\n window.addEventListener('resize', this._resizeListener);\n };\n\n _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {\n if (prevProps !== this.props) {\n this._resizeComponent();\n }\n\n if (this.state.height !== prevState.height) {\n this.props.onHeightChange(this.state.height, this);\n }\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n window.removeEventListener('resize', this._resizeListener);\n purgeCache(this._uid);\n };\n\n return TextareaAutosize;\n}(React.Component);\n\nTextareaAutosize.defaultProps = {\n inputRef: noop,\n onChange: noop,\n onHeightChange: noop,\n useCacheForDOMMeasurements: false\n};\nprocess.env.NODE_ENV !== \"production\" ? TextareaAutosize.propTypes = {\n inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({\n current: PropTypes.any\n })]),\n maxRows: PropTypes.number,\n minRows: PropTypes.number,\n onChange: PropTypes.func,\n onHeightChange: PropTypes.func,\n style: PropTypes.object,\n useCacheForDOMMeasurements: PropTypes.bool,\n value: PropTypes.string\n} : void 0;\n\nexport default TextareaAutosize;\n","import {\n RendererThemeProps,\n styled,\n createRendererUiTheme,\n SubmitButtonTheme\n} from '@edtr-io/ui'\nimport * as React from 'react'\n\nimport { Icon, faSmile, faCheckCircle } from './icon'\n\nenum ExerciseState {\n Default = 1,\n SolvedRight,\n SolvedWrong\n}\n\nconst createSubmitButtonTheme = createRendererUiTheme(\n theme => {\n return {\n backgroundColor: '#337ab7',\n hoverBackgroundColor: '#d9edf7',\n color: theme.backgroundColor,\n correctBackgroundColor: theme.success.background,\n wrongBackgroundColor: theme.danger.background\n }\n }\n)\n\nconst getBackgroundColor = (\n theme: SubmitButtonTheme,\n exerciseState: ExerciseState\n) => {\n switch (exerciseState) {\n case ExerciseState.Default: {\n return theme.backgroundColor\n }\n case ExerciseState.SolvedRight: {\n return theme.correctBackgroundColor\n }\n case ExerciseState.SolvedWrong: {\n return theme.wrongBackgroundColor\n }\n }\n}\n\nconst SubmitButtonComponent = styled.button<\n { exerciseState: ExerciseState } & RendererThemeProps\n>(({ exerciseState, ...props }) => {\n const theme = createSubmitButtonTheme('submitButton', props.theme)\n\n return {\n float: 'right',\n margin: '10px 0px',\n border: 'none',\n padding: '3px',\n backgroundColor: getBackgroundColor(theme, exerciseState),\n color: theme.color,\n transition: 'background-color .5s ease',\n outline: 'none',\n '&hover': {\n backgroundColor: theme.hoverBackgroundColor\n }\n }\n})\n\nexport class SubmitButton extends React.Component<{\n exerciseState: ExerciseState\n onClick?: () => void\n}> {\n public render() {\n return (\n \n {this.props.exerciseState === ExerciseState.SolvedRight ? (\n \n \n {' Stimmt!'}\n \n ) : (\n \n \n {' Stimmt’s?'}\n \n )}\n \n )\n }\n}\n","/**\n * @module @edtr-io/renderer-ui\n */\n/** Comment needed because of https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/337 */\nimport {\n createRendererUiTheme,\n ExpandableBoxTheme,\n RendererThemeProps,\n styled\n} from '@edtr-io/ui'\nimport * as React from 'react'\n\nimport { faSortDown, faSortUp, Icon } from './icon'\n\nexport const createExpandableBoxTheme = createRendererUiTheme<\n ExpandableBoxTheme\n>(theme => {\n return {\n containerBorderColor: 'transparent',\n toggleBackgroundColor: theme.primary.background,\n toggleBorderColor: 'transparent',\n toggleColor: theme.primary.background\n }\n})\n\nconst Wrapper = styled.div<{ collapsed: boolean }>(({ collapsed }) => {\n return {\n borderRadius: '5px',\n boxShadow: `0 5px 5px rgba(0, 0, 0, ${collapsed ? 0 : 0.05})`\n }\n})\n\nconst Toggle = styled.div<\n {\n collapsed: boolean\n editable?: boolean\n alwaysVisible?: boolean\n } & RendererThemeProps\n>(({ collapsed, editable, alwaysVisible, theme }) => {\n const { toggleBackgroundColor, toggleColor } = createExpandableBoxTheme(\n 'expandableBox',\n theme\n )\n\n return {\n backgroundColor:\n alwaysVisible || !collapsed ? toggleBackgroundColor : 'transparent',\n '& a': {\n color: toggleColor\n },\n padding: '10px 15px 10px 10px',\n marginBottom: '10px',\n position: 'relative',\n textAlign: 'left',\n borderRadius: alwaysVisible && collapsed ? '5px' : undefined,\n borderTopLeftRadius: '5px',\n borderTopRightRadius: '5px',\n cursor: editable ? undefined : 'pointer'\n }\n})\n\nconst Content = styled.div<{ collapsed: boolean }>(({ collapsed }) => {\n return {\n display: collapsed ? 'none' : 'block',\n position: 'relative',\n padding: '5px 0'\n }\n})\n\nconst StyledIcon = styled(Icon)<{ collapsed: boolean } & RendererThemeProps>(\n ({ collapsed, theme }) => {\n const { toggleColor } = createExpandableBoxTheme('expandableBox', theme)\n return {\n marginRight: '10px',\n marginBottom: collapsed ? '3px' : '-3px',\n color: toggleColor\n }\n }\n)\n\nexport function ExpandableBox({\n children,\n editable,\n alwaysVisible,\n title\n}: {\n children?: React.ReactNode\n editable?: boolean\n alwaysVisible?: boolean\n title: React.ReactNode\n}) {\n const [collapsed, setCollapsed] = React.useState(true)\n\n return (\n \n {\n setCollapsed(!collapsed)\n }}\n >\n \n \n {title}\n \n \n {children}\n \n )\n}\n","/**\n * @module @edtr-io/renderer-ui\n */\n/** Comment needed because of https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/337 */\nimport { styled } from '@edtr-io/ui'\nimport * as React from 'react'\n\nexport class Feedback extends React.Component {\n public render() {\n const { boxFree, children, isTrueAnswer, showOnLeft } = this.props\n const Container = boxFree ? this.BoxFreeContainer : this.BoxContainer\n\n return (\n \n {children}\n \n )\n }\n\n private BoxFreeContainer = styled.div<{\n correct?: boolean\n showOnLeft?: boolean\n }>(({ correct, showOnLeft }) => {\n return {\n color: correct ? '#95bc1a' : '#f7b07c',\n fontWeight: 'bold',\n textAlign: showOnLeft ? 'left' : 'right'\n }\n })\n\n private BoxContainer = styled.div<{ correct?: boolean }>({\n backgroundColor: '#fcf8e3',\n borderColor: '#faebcc',\n color: '#8a6d3b',\n padding: '15px'\n })\n}\n\nexport interface FeedbackProps {\n boxFree?: boolean\n isTrueAnswer?: boolean\n showOnLeft?: boolean\n}\n","/**\n * @module @edtr-io/renderer-ui\n */\n/** Comment needed because of https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/337 */\nimport * as R from 'ramda'\nimport * as React from 'react'\n\nexport class FetchDimensions extends React.Component<\n FetchDimensionsProps,\n FetchDimensionsState\n> {\n public state: FetchDimensionsState = {\n heights: R.times(() => null, this.props.length),\n widths: R.times(() => null, this.props.length),\n scrollHeights: R.times(() => null, this.props.length),\n scrollWidths: R.times(() => null, this.props.length),\n clientHeights: R.times(() => null, this.props.length),\n clientWidths: R.times(() => null, this.props.length)\n }\n\n public componentDidUpdate(): void {\n const all = R.all(height => typeof height === 'number', this.state.heights)\n\n if (all && !this.done) {\n this.done = true\n this.props.onDone(this.state as Dimensions)\n }\n }\n\n public render() {\n const createRef = (index: number) => (instance: HTMLElement | null) => {\n if (!instance) {\n return\n }\n\n this.setState(state => {\n if (typeof state.heights[index] === 'number') {\n return null\n }\n\n return {\n heights: R.update(index, instance.offsetHeight, state.heights),\n widths: R.update(index, instance.offsetWidth, state.widths),\n scrollHeights: R.update(\n index,\n instance.scrollHeight,\n state.scrollHeights\n ),\n scrollWidths: R.update(\n index,\n instance.scrollWidth,\n state.scrollWidths\n ),\n clientHeights: R.update(\n index,\n instance.clientHeight,\n state.clientHeights\n ),\n clientWidths: R.update(\n index,\n instance.clientWidth,\n state.clientWidths\n )\n }\n })\n }\n\n return this.props.render(createRef)\n }\n\n private done = false\n}\n\nexport interface FetchDimensionsProps {\n length: number\n render: (\n createRef: (index: number) => (instance: HTMLElement | null) => void\n ) => React.ReactNode\n onDone: (dimensions: Dimensions) => void\n}\n\nexport interface Dimensions {\n heights: number[]\n widths: number[]\n scrollHeights: number[]\n scrollWidths: number[]\n clientHeights: number[]\n clientWidths: number[]\n}\ninterface FetchDimensionsState {\n heights: (number | null)[]\n widths: (number | null)[]\n scrollHeights: (number | null)[]\n scrollWidths: (number | null)[]\n clientHeights: (number | null)[]\n clientWidths: (number | null)[]\n}\n","/**\n * @module @edtr-io/renderer-ui\n */\n/** Comment needed because of https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/337 */\nimport { styled } from '@edtr-io/ui'\nimport * as React from 'react'\nimport { IgnoreKeys } from 'react-hotkeys'\nimport TextareaAutosize, {\n TextareaAutosizeProps\n} from 'react-textarea-autosize'\n\nconst Textarea = styled(TextareaAutosize)({\n minHeight: '100px',\n width: '100%',\n margin: 'auto',\n padding: '10px',\n resize: 'none',\n fontFamily: 'Menlo, Monaco, \"Courier New\", monospace',\n border: 'none',\n outline: 'none',\n boxShadow: '0 1px 1px 0 rgba(0,0,0,0.50)',\n '&::-webkit-input-placeholder': {\n color: 'rgba(0,0,0,0.5)'\n }\n})\n\nconst StyledIgnoreKeys = styled(IgnoreKeys)({\n width: '100%'\n})\n\nexport function EditorTextarea(\n props: Omit\n) {\n return (\n \n \",v.noCloneChecked=!!qe.cloneNode(!0).lastChild.defaultValue;var Ce=/^key/,je=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Oe=/^([^.]*)(?:\\.(.+)|)/;function Se(){return!0}function De(){return!1}function Ee(e,t){return e===function(){try{return s.activeElement}catch(e){}}()==(\"focus\"===t)}function Ae(e,t,n,r,i,o){var s,a;if(\"object\"==typeof t){for(a in\"string\"!=typeof n&&(r=r||n,n=void 0),t)Ae(e,a,n,r,t[a],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&(\"string\"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=De;else if(!i)return e;return 1===o&&(s=i,(i=function(e){return T().off(e),s.apply(this,arguments)}).guid=s.guid||(s.guid=T.guid++)),e.each(function(){T.event.add(this,t,i,r,n)})}function Le(e,t,n){n?(Z.set(e,t,!1),T.event.add(e,t,{namespace:!1,handler:function(e){var r,i,o=Z.get(this,t);if(1&e.isTrigger&&this[t]){if(o.length)(T.event.special[t]||{}).delegateType&&e.stopPropagation();else if(o=l.call(arguments),Z.set(this,t,o),r=n(this,t),this[t](),o!==(i=Z.get(this,t))||r?Z.set(this,t,!1):i={},o!==i)return e.stopImmediatePropagation(),e.preventDefault(),i.value}else o.length&&(Z.set(this,t,{value:T.event.trigger(T.extend(o[0],T.Event.prototype),o.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Z.get(e,t)&&T.event.add(e,t,Se)}T.event={global:{},add:function(e,t,n,r,i){var o,s,a,l,c,u,f,p,h,d,m,g=Z.get(e);if(g)for(n.handler&&(n=(o=n).handler,i=o.selector),i&&T.find.matchesSelector(se,i),n.guid||(n.guid=T.guid++),(l=g.events)||(l=g.events={}),(s=g.handle)||(s=g.handle=function(t){return void 0!==T&&T.event.triggered!==t.type?T.event.dispatch.apply(e,arguments):void 0}),c=(t=(t||\"\").match(M)||[\"\"]).length;c--;)h=m=(a=Oe.exec(t[c])||[])[1],d=(a[2]||\"\").split(\".\").sort(),h&&(f=T.event.special[h]||{},h=(i?f.delegateType:f.bindType)||h,f=T.event.special[h]||{},u=T.extend({type:h,origType:m,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&T.expr.match.needsContext.test(i),namespace:d.join(\".\")},o),(p=l[h])||((p=l[h]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,d,s)||e.addEventListener&&e.addEventListener(h,s)),f.add&&(f.add.call(e,u),u.handler.guid||(u.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,u):p.push(u),T.event.global[h]=!0)},remove:function(e,t,n,r,i){var o,s,a,l,c,u,f,p,h,d,m,g=Z.hasData(e)&&Z.get(e);if(g&&(l=g.events)){for(c=(t=(t||\"\").match(M)||[\"\"]).length;c--;)if(h=m=(a=Oe.exec(t[c])||[])[1],d=(a[2]||\"\").split(\".\").sort(),h){for(f=T.event.special[h]||{},p=l[h=(r?f.delegateType:f.bindType)||h]||[],a=a[2]&&new RegExp(\"(^|\\\\.)\"+d.join(\"\\\\.(?:.*\\\\.|)\")+\"(\\\\.|$)\"),s=o=p.length;o--;)u=p[o],!i&&m!==u.origType||n&&n.guid!==u.guid||a&&!a.test(u.namespace)||r&&r!==u.selector&&(\"**\"!==r||!u.selector)||(p.splice(o,1),u.selector&&p.delegateCount--,f.remove&&f.remove.call(e,u));s&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,d,g.handle)||T.removeEvent(e,h,g.handle),delete l[h])}else for(h in l)T.event.remove(e,h+t[c],n,r,!0);T.isEmptyObject(l)&&Z.remove(e,\"handle events\")}},dispatch:function(e){var t,n,r,i,o,s,a=T.event.fix(e),l=new Array(arguments.length),c=(Z.get(this,\"events\")||{})[a.type]||[],u=T.event.special[a.type]||{};for(l[0]=a,t=1;t=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&(\"click\"!==e.type||!0!==c.disabled)){for(o=[],s={},n=0;n-1:T.find(i,this,null,[c]).length),s[i]&&o.push(r);o.length&&a.push({elem:c,handlers:o})}return c=this,l\\x20\\t\\r\\n\\f]*)[^>]*)\\/>/gi,Ne=/\\s*$/g;function Ie(e,t){return E(e,\"table\")&&E(11!==t.nodeType?t:t.firstChild,\"tr\")&&T(e).children(\"tbody\")[0]||e}function Me(e){return e.type=(null!==e.getAttribute(\"type\"))+\"/\"+e.type,e}function ze(e){return\"true/\"===(e.type||\"\").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute(\"type\"),e}function Pe(e,t){var n,r,i,o,s,a,l,c;if(1===t.nodeType){if(Z.hasData(e)&&(o=Z.access(e),s=Z.set(t,o),c=o.events))for(i in delete s.handle,s.events={},c)for(n=0,r=c[i].length;n1&&\"string\"==typeof d&&!v.checkClone&&Qe.test(d))return e.each(function(i){var o=e.eq(i);m&&(t[0]=d.call(this,i,o.html())),Fe(o,t,n,r)});if(p&&(o=(i=ke(t,e[0].ownerDocument,!1,e,r)).firstChild,1===i.childNodes.length&&(i=o),o||r)){for(a=(s=T.map(ye(i,\"script\"),Me)).length;f\")},clone:function(e,t,n){var r,i,o,s,a=e.cloneNode(!0),l=ae(e);if(!(v.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||T.isXMLDoc(e)))for(s=ye(a),r=0,i=(o=ye(e)).length;r0&&xe(s,!l&&ye(e,\"script\")),a},cleanData:function(e){for(var t,n,r,i=T.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[Z.expando]){if(t.events)for(r in t.events)i[r]?T.event.remove(n,r):T.removeEvent(n,r,t.handle);n[Z.expando]=void 0}n[J.expando]&&(n[J.expando]=void 0)}}}),T.fn.extend({detach:function(e){return Be(this,e,!0)},remove:function(e){return Be(this,e)},text:function(e){return W(this,function(e){return void 0===e?T.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Fe(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Ie(this,e).appendChild(e)})},prepend:function(){return Fe(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Ie(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Fe(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Fe(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(T.cleanData(ye(e,!1)),e.textContent=\"\");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return T.clone(this,e,t)})},html:function(e){return W(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if(\"string\"==typeof e&&!Ne.test(e)&&!be[(ge.exec(e)||[\"\",\"\"])[1].toLowerCase()]){e=T.htmlPrefilter(e);try{for(;n=0&&(l+=Math.max(0,Math.ceil(e[\"offset\"+t[0].toUpperCase()+t.slice(1)]-o-l-a-.5))||0),l}function ot(e,t,n){var r=We(e),i=(!v.boxSizingReliable()||n)&&\"border-box\"===T.css(e,\"boxSizing\",!1,r),o=i,s=Ue(e,t,r),a=\"offset\"+t[0].toUpperCase()+t.slice(1);if($e.test(s)){if(!n)return s;s=\"auto\"}return(!v.boxSizingReliable()&&i||\"auto\"===s||!parseFloat(s)&&\"inline\"===T.css(e,\"display\",!1,r))&&e.getClientRects().length&&(i=\"border-box\"===T.css(e,\"boxSizing\",!1,r),(o=a in e)&&(s=e[a])),(s=parseFloat(s)||0)+it(e,t,n||(i?\"border\":\"content\"),o,r,s)+\"px\"}function st(e,t,n,r,i){return new st.prototype.init(e,t,n,r,i)}T.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Ue(e,\"opacity\");return\"\"===n?\"1\":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,s,a=G(t),l=et.test(t),c=e.style;if(l||(t=Ze(a)),s=T.cssHooks[t]||T.cssHooks[a],void 0===n)return s&&\"get\"in s&&void 0!==(i=s.get(e,!1,r))?i:c[t];\"string\"===(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=fe(e,t,i),o=\"number\"),null!=n&&n==n&&(\"number\"!==o||l||(n+=i&&i[3]||(T.cssNumber[a]?\"\":\"px\")),v.clearCloneStyle||\"\"!==n||0!==t.indexOf(\"background\")||(c[t]=\"inherit\"),s&&\"set\"in s&&void 0===(n=s.set(e,n,r))||(l?c.setProperty(t,n):c[t]=n))}},css:function(e,t,n,r){var i,o,s,a=G(t);return et.test(t)||(t=Ze(a)),(s=T.cssHooks[t]||T.cssHooks[a])&&\"get\"in s&&(i=s.get(e,!0,n)),void 0===i&&(i=Ue(e,t,r)),\"normal\"===i&&t in nt&&(i=nt[t]),\"\"===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),T.each([\"height\",\"width\"],function(e,t){T.cssHooks[t]={get:function(e,n,r){if(n)return!Je.test(T.css(e,\"display\"))||e.getClientRects().length&&e.getBoundingClientRect().width?ot(e,t,r):ue(e,tt,function(){return ot(e,t,r)})},set:function(e,n,r){var i,o=We(e),s=!v.scrollboxSize()&&\"absolute\"===o.position,a=(s||r)&&\"border-box\"===T.css(e,\"boxSizing\",!1,o),l=r?it(e,t,r,a,o):0;return a&&s&&(l-=Math.ceil(e[\"offset\"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-it(e,t,\"border\",!1,o)-.5)),l&&(i=ie.exec(n))&&\"px\"!==(i[3]||\"px\")&&(e.style[t]=n,n=T.css(e,t)),rt(0,n,l)}}}),T.cssHooks.marginLeft=Ve(v.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Ue(e,\"marginLeft\"))||e.getBoundingClientRect().left-ue(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+\"px\"}),T.each({margin:\"\",padding:\"\",border:\"Width\"},function(e,t){T.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o=\"string\"==typeof n?n.split(\" \"):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},\"margin\"!==e&&(T.cssHooks[e+t].set=rt)}),T.fn.extend({css:function(e,t){return W(this,function(e,t,n){var r,i,o={},s=0;if(Array.isArray(t)){for(r=We(e),i=t.length;s1)}}),T.Tween=st,st.prototype={constructor:st,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||T.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(T.cssNumber[n]?\"\":\"px\")},cur:function(){var e=st.propHooks[this.prop];return e&&e.get?e.get(this):st.propHooks._default.get(this)},run:function(e){var t,n=st.propHooks[this.prop];return this.options.duration?this.pos=t=T.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):st.propHooks._default.set(this),this}},st.prototype.init.prototype=st.prototype,st.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=T.css(e.elem,e.prop,\"\"))&&\"auto\"!==t?t:0},set:function(e){T.fx.step[e.prop]?T.fx.step[e.prop](e):1!==e.elem.nodeType||!T.cssHooks[e.prop]&&null==e.elem.style[Ze(e.prop)]?e.elem[e.prop]=e.now:T.style(e.elem,e.prop,e.now+e.unit)}}},st.propHooks.scrollTop=st.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},T.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:\"swing\"},T.fx=st.prototype.init,T.fx.step={};var at,lt,ct=/^(?:toggle|show|hide)$/,ut=/queueHooks$/;function ft(){lt&&(!1===s.hidden&&n.requestAnimationFrame?n.requestAnimationFrame(ft):n.setTimeout(ft,T.fx.interval),T.fx.tick())}function pt(){return n.setTimeout(function(){at=void 0}),at=Date.now()}function ht(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i[\"margin\"+(n=oe[r])]=i[\"padding\"+n]=e;return t&&(i.opacity=i.width=e),i}function dt(e,t,n){for(var r,i=(mt.tweeners[t]||[]).concat(mt.tweeners[\"*\"]),o=0,s=i.length;o1)},removeAttr:function(e){return this.each(function(){T.removeAttr(this,e)})}}),T.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===e.getAttribute?T.prop(e,t,n):(1===o&&T.isXMLDoc(e)||(i=T.attrHooks[t.toLowerCase()]||(T.expr.match.bool.test(t)?gt:void 0)),void 0!==n?null===n?void T.removeAttr(e,t):i&&\"set\"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+\"\"),n):i&&\"get\"in i&&null!==(r=i.get(e,t))?r:null==(r=T.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!v.radioValue&&\"radio\"===t&&E(e,\"input\")){var n=e.value;return e.setAttribute(\"type\",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)for(;n=i[r++];)e.removeAttribute(n)}}),gt={set:function(e,t,n){return!1===t?T.removeAttr(e,n):e.setAttribute(n,n),n}},T.each(T.expr.match.bool.source.match(/\\w+/g),function(e,t){var n=vt[t]||T.find.attr;vt[t]=function(e,t,r){var i,o,s=t.toLowerCase();return r||(o=vt[s],vt[s]=i,i=null!=n(e,t,r)?s:null,vt[s]=o),i}});var bt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;function xt(e){return(e.match(M)||[]).join(\" \")}function qt(e){return e.getAttribute&&e.getAttribute(\"class\")||\"\"}function wt(e){return Array.isArray(e)?e:\"string\"==typeof e&&e.match(M)||[]}T.fn.extend({prop:function(e,t){return W(this,T.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[T.propFix[e]||e]})}}),T.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&T.isXMLDoc(e)||(t=T.propFix[t]||t,i=T.propHooks[t]),void 0!==n?i&&\"set\"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&\"get\"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=T.find.attr(e,\"tabindex\");return t?parseInt(t,10):bt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:\"htmlFor\",class:\"className\"}}),v.optSelected||(T.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),T.each([\"tabIndex\",\"readOnly\",\"maxLength\",\"cellSpacing\",\"cellPadding\",\"rowSpan\",\"colSpan\",\"useMap\",\"frameBorder\",\"contentEditable\"],function(){T.propFix[this.toLowerCase()]=this}),T.fn.extend({addClass:function(e){var t,n,r,i,o,s,a,l=0;if(b(e))return this.each(function(t){T(this).addClass(e.call(this,t,qt(this)))});if((t=wt(e)).length)for(;n=this[l++];)if(i=qt(n),r=1===n.nodeType&&\" \"+xt(i)+\" \"){for(s=0;o=t[s++];)r.indexOf(\" \"+o+\" \")<0&&(r+=o+\" \");i!==(a=xt(r))&&n.setAttribute(\"class\",a)}return this},removeClass:function(e){var t,n,r,i,o,s,a,l=0;if(b(e))return this.each(function(t){T(this).removeClass(e.call(this,t,qt(this)))});if(!arguments.length)return this.attr(\"class\",\"\");if((t=wt(e)).length)for(;n=this[l++];)if(i=qt(n),r=1===n.nodeType&&\" \"+xt(i)+\" \"){for(s=0;o=t[s++];)for(;r.indexOf(\" \"+o+\" \")>-1;)r=r.replace(\" \"+o+\" \",\" \");i!==(a=xt(r))&&n.setAttribute(\"class\",a)}return this},toggleClass:function(e,t){var n=typeof e,r=\"string\"===n||Array.isArray(e);return\"boolean\"==typeof t&&r?t?this.addClass(e):this.removeClass(e):b(e)?this.each(function(n){T(this).toggleClass(e.call(this,n,qt(this),t),t)}):this.each(function(){var t,i,o,s;if(r)for(i=0,o=T(this),s=wt(e);t=s[i++];)o.hasClass(t)?o.removeClass(t):o.addClass(t);else void 0!==e&&\"boolean\"!==n||((t=qt(this))&&Z.set(this,\"__className__\",t),this.setAttribute&&this.setAttribute(\"class\",t||!1===e?\"\":Z.get(this,\"__className__\")||\"\"))})},hasClass:function(e){var t,n,r=0;for(t=\" \"+e+\" \";n=this[r++];)if(1===n.nodeType&&(\" \"+xt(qt(n))+\" \").indexOf(t)>-1)return!0;return!1}});var Tt=/\\r/g;T.fn.extend({val:function(e){var t,n,r,i=this[0];return arguments.length?(r=b(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,T(this).val()):e)?i=\"\":\"number\"==typeof i?i+=\"\":Array.isArray(i)&&(i=T.map(i,function(e){return null==e?\"\":e+\"\"})),(t=T.valHooks[this.type]||T.valHooks[this.nodeName.toLowerCase()])&&\"set\"in t&&void 0!==t.set(this,i,\"value\")||(this.value=i))})):i?(t=T.valHooks[i.type]||T.valHooks[i.nodeName.toLowerCase()])&&\"get\"in t&&void 0!==(n=t.get(i,\"value\"))?n:\"string\"==typeof(n=i.value)?n.replace(Tt,\"\"):null==n?\"\":n:void 0}}),T.extend({valHooks:{option:{get:function(e){var t=T.find.attr(e,\"value\");return null!=t?t:xt(T.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,s=\"select-one\"===e.type,a=s?null:[],l=s?o+1:i.length;for(r=o<0?l:s?o:0;r-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),T.each([\"radio\",\"checkbox\"],function(){T.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=T.inArray(T(e).val(),t)>-1}},v.checkOn||(T.valHooks[this].get=function(e){return null===e.getAttribute(\"value\")?\"on\":e.value})}),v.focusin=\"onfocusin\"in n;var kt=/^(?:focusinfocus|focusoutblur)$/,Ct=function(e){e.stopPropagation()};T.extend(T.event,{trigger:function(e,t,r,i){var o,a,l,c,u,f,p,h,m=[r||s],g=d.call(e,\"type\")?e.type:e,v=d.call(e,\"namespace\")?e.namespace.split(\".\"):[];if(a=h=l=r=r||s,3!==r.nodeType&&8!==r.nodeType&&!kt.test(g+T.event.triggered)&&(g.indexOf(\".\")>-1&&(v=g.split(\".\"),g=v.shift(),v.sort()),u=g.indexOf(\":\")<0&&\"on\"+g,(e=e[T.expando]?e:new T.Event(g,\"object\"==typeof e&&e)).isTrigger=i?2:3,e.namespace=v.join(\".\"),e.rnamespace=e.namespace?new RegExp(\"(^|\\\\.)\"+v.join(\"\\\\.(?:.*\\\\.|)\")+\"(\\\\.|$)\"):null,e.result=void 0,e.target||(e.target=r),t=null==t?[e]:T.makeArray(t,[e]),p=T.event.special[g]||{},i||!p.trigger||!1!==p.trigger.apply(r,t))){if(!i&&!p.noBubble&&!y(r)){for(c=p.delegateType||g,kt.test(c+g)||(a=a.parentNode);a;a=a.parentNode)m.push(a),l=a;l===(r.ownerDocument||s)&&m.push(l.defaultView||l.parentWindow||n)}for(o=0;(a=m[o++])&&!e.isPropagationStopped();)h=a,e.type=o>1?c:p.bindType||g,(f=(Z.get(a,\"events\")||{})[e.type]&&Z.get(a,\"handle\"))&&f.apply(a,t),(f=u&&a[u])&&f.apply&&Y(a)&&(e.result=f.apply(a,t),!1===e.result&&e.preventDefault());return e.type=g,i||e.isDefaultPrevented()||p._default&&!1!==p._default.apply(m.pop(),t)||!Y(r)||u&&b(r[g])&&!y(r)&&((l=r[u])&&(r[u]=null),T.event.triggered=g,e.isPropagationStopped()&&h.addEventListener(g,Ct),r[g](),e.isPropagationStopped()&&h.removeEventListener(g,Ct),T.event.triggered=void 0,l&&(r[u]=l)),e.result}},simulate:function(e,t,n){var r=T.extend(new T.Event,n,{type:e,isSimulated:!0});T.event.trigger(r,null,t)}}),T.fn.extend({trigger:function(e,t){return this.each(function(){T.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return T.event.trigger(e,t,n,!0)}}),v.focusin||T.each({focus:\"focusin\",blur:\"focusout\"},function(e,t){var n=function(e){T.event.simulate(t,e.target,T.event.fix(e))};T.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=Z.access(r,t);i||r.addEventListener(e,n,!0),Z.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=Z.access(r,t)-1;i?Z.access(r,t,i):(r.removeEventListener(e,n,!0),Z.remove(r,t))}}});var jt=n.location,Ot=Date.now(),St=/\\?/;T.parseXML=function(e){var t;if(!e||\"string\"!=typeof e)return null;try{t=(new n.DOMParser).parseFromString(e,\"text/xml\")}catch(e){t=void 0}return t&&!t.getElementsByTagName(\"parsererror\").length||T.error(\"Invalid XML: \"+e),t};var Dt=/\\[\\]$/,Et=/\\r?\\n/g,At=/^(?:submit|button|image|reset|file)$/i,Lt=/^(?:input|select|textarea|keygen)/i;function _t(e,t,n,r){var i;if(Array.isArray(t))T.each(t,function(t,i){n||Dt.test(e)?r(e,i):_t(e+\"[\"+(\"object\"==typeof i&&null!=i?t:\"\")+\"]\",i,n,r)});else if(n||\"object\"!==w(t))r(e,t);else for(i in t)_t(e+\"[\"+i+\"]\",t[i],n,r)}T.param=function(e,t){var n,r=[],i=function(e,t){var n=b(t)?t():t;r[r.length]=encodeURIComponent(e)+\"=\"+encodeURIComponent(null==n?\"\":n)};if(null==e)return\"\";if(Array.isArray(e)||e.jquery&&!T.isPlainObject(e))T.each(e,function(){i(this.name,this.value)});else for(n in e)_t(n,e[n],t,i);return r.join(\"&\")},T.fn.extend({serialize:function(){return T.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=T.prop(this,\"elements\");return e?T.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!T(this).is(\":disabled\")&&Lt.test(this.nodeName)&&!At.test(e)&&(this.checked||!me.test(e))}).map(function(e,t){var n=T(this).val();return null==n?null:Array.isArray(n)?T.map(n,function(e){return{name:t.name,value:e.replace(Et,\"\\r\\n\")}}):{name:t.name,value:n.replace(Et,\"\\r\\n\")}}).get()}});var Nt=/%20/g,Qt=/#.*$/,Rt=/([?&])_=[^&]*/,It=/^(.*?):[ \\t]*([^\\r\\n]*)$/gm,Mt=/^(?:GET|HEAD)$/,zt=/^\\/\\//,Pt={},Ht={},Ft=\"*/\".concat(\"*\"),Bt=s.createElement(\"a\");function $t(e){return function(t,n){\"string\"!=typeof t&&(n=t,t=\"*\");var r,i=0,o=t.toLowerCase().match(M)||[];if(b(n))for(;r=o[i++];)\"+\"===r[0]?(r=r.slice(1)||\"*\",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function Wt(e,t,n,r){var i={},o=e===Ht;function s(a){var l;return i[a]=!0,T.each(e[a]||[],function(e,a){var c=a(t,n,r);return\"string\"!=typeof c||o||i[c]?o?!(l=c):void 0:(t.dataTypes.unshift(c),s(c),!1)}),l}return s(t.dataTypes[0])||!i[\"*\"]&&s(\"*\")}function Xt(e,t){var n,r,i=T.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&T.extend(!0,e,r),e}Bt.href=jt.href,T.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:jt.href,type:\"GET\",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(jt.protocol),global:!0,processData:!0,async:!0,contentType:\"application/x-www-form-urlencoded; charset=UTF-8\",accepts:{\"*\":Ft,text:\"text/plain\",html:\"text/html\",xml:\"application/xml, text/xml\",json:\"application/json, text/javascript\"},contents:{xml:/\\bxml\\b/,html:/\\bhtml/,json:/\\bjson\\b/},responseFields:{xml:\"responseXML\",text:\"responseText\",json:\"responseJSON\"},converters:{\"* text\":String,\"text html\":!0,\"text json\":JSON.parse,\"text xml\":T.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Xt(Xt(e,T.ajaxSettings),t):Xt(T.ajaxSettings,e)},ajaxPrefilter:$t(Pt),ajaxTransport:$t(Ht),ajax:function(e,t){\"object\"==typeof e&&(t=e,e=void 0),t=t||{};var r,i,o,a,l,c,u,f,p,h,d=T.ajaxSetup({},t),m=d.context||d,g=d.context&&(m.nodeType||m.jquery)?T(m):T.event,v=T.Deferred(),b=T.Callbacks(\"once memory\"),y=d.statusCode||{},x={},q={},w=\"canceled\",k={readyState:0,getResponseHeader:function(e){var t;if(u){if(!a)for(a={};t=It.exec(o);)a[t[1].toLowerCase()+\" \"]=(a[t[1].toLowerCase()+\" \"]||[]).concat(t[2]);t=a[e.toLowerCase()+\" \"]}return null==t?null:t.join(\", \")},getAllResponseHeaders:function(){return u?o:null},setRequestHeader:function(e,t){return null==u&&(e=q[e.toLowerCase()]=q[e.toLowerCase()]||e,x[e]=t),this},overrideMimeType:function(e){return null==u&&(d.mimeType=e),this},statusCode:function(e){var t;if(e)if(u)k.always(e[k.status]);else for(t in e)y[t]=[y[t],e[t]];return this},abort:function(e){var t=e||w;return r&&r.abort(t),C(0,t),this}};if(v.promise(k),d.url=((e||d.url||jt.href)+\"\").replace(zt,jt.protocol+\"//\"),d.type=t.method||t.type||d.method||d.type,d.dataTypes=(d.dataType||\"*\").toLowerCase().match(M)||[\"\"],null==d.crossDomain){c=s.createElement(\"a\");try{c.href=d.url,c.href=c.href,d.crossDomain=Bt.protocol+\"//\"+Bt.host!=c.protocol+\"//\"+c.host}catch(e){d.crossDomain=!0}}if(d.data&&d.processData&&\"string\"!=typeof d.data&&(d.data=T.param(d.data,d.traditional)),Wt(Pt,d,t,k),u)return k;for(p in(f=T.event&&d.global)&&0==T.active++&&T.event.trigger(\"ajaxStart\"),d.type=d.type.toUpperCase(),d.hasContent=!Mt.test(d.type),i=d.url.replace(Qt,\"\"),d.hasContent?d.data&&d.processData&&0===(d.contentType||\"\").indexOf(\"application/x-www-form-urlencoded\")&&(d.data=d.data.replace(Nt,\"+\")):(h=d.url.slice(i.length),d.data&&(d.processData||\"string\"==typeof d.data)&&(i+=(St.test(i)?\"&\":\"?\")+d.data,delete d.data),!1===d.cache&&(i=i.replace(Rt,\"$1\"),h=(St.test(i)?\"&\":\"?\")+\"_=\"+Ot+++h),d.url=i+h),d.ifModified&&(T.lastModified[i]&&k.setRequestHeader(\"If-Modified-Since\",T.lastModified[i]),T.etag[i]&&k.setRequestHeader(\"If-None-Match\",T.etag[i])),(d.data&&d.hasContent&&!1!==d.contentType||t.contentType)&&k.setRequestHeader(\"Content-Type\",d.contentType),k.setRequestHeader(\"Accept\",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(\"*\"!==d.dataTypes[0]?\", \"+Ft+\"; q=0.01\":\"\"):d.accepts[\"*\"]),d.headers)k.setRequestHeader(p,d.headers[p]);if(d.beforeSend&&(!1===d.beforeSend.call(m,k,d)||u))return k.abort();if(w=\"abort\",b.add(d.complete),k.done(d.success),k.fail(d.error),r=Wt(Ht,d,t,k)){if(k.readyState=1,f&&g.trigger(\"ajaxSend\",[k,d]),u)return k;d.async&&d.timeout>0&&(l=n.setTimeout(function(){k.abort(\"timeout\")},d.timeout));try{u=!1,r.send(x,C)}catch(e){if(u)throw e;C(-1,e)}}else C(-1,\"No Transport\");function C(e,t,s,a){var c,p,h,x,q,w=t;u||(u=!0,l&&n.clearTimeout(l),r=void 0,o=a||\"\",k.readyState=e>0?4:0,c=e>=200&&e<300||304===e,s&&(x=function(e,t,n){for(var r,i,o,s,a=e.contents,l=e.dataTypes;\"*\"===l[0];)l.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader(\"Content-Type\"));if(r)for(i in a)if(a[i]&&a[i].test(r)){l.unshift(i);break}if(l[0]in n)o=l[0];else{for(i in n){if(!l[0]||e.converters[i+\" \"+l[0]]){o=i;break}s||(s=i)}o=o||s}if(o)return o!==l[0]&&l.unshift(o),n[o]}(d,k,s)),x=function(e,t,n,r){var i,o,s,a,l,c={},u=e.dataTypes.slice();if(u[1])for(s in e.converters)c[s.toLowerCase()]=e.converters[s];for(o=u.shift();o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=u.shift())if(\"*\"===o)o=l;else if(\"*\"!==l&&l!==o){if(!(s=c[l+\" \"+o]||c[\"* \"+o]))for(i in c)if((a=i.split(\" \"))[1]===o&&(s=c[l+\" \"+a[0]]||c[\"* \"+a[0]])){!0===s?s=c[i]:!0!==c[i]&&(o=a[0],u.unshift(a[1]));break}if(!0!==s)if(s&&e.throws)t=s(t);else try{t=s(t)}catch(e){return{state:\"parsererror\",error:s?e:\"No conversion from \"+l+\" to \"+o}}}return{state:\"success\",data:t}}(d,x,k,c),c?(d.ifModified&&((q=k.getResponseHeader(\"Last-Modified\"))&&(T.lastModified[i]=q),(q=k.getResponseHeader(\"etag\"))&&(T.etag[i]=q)),204===e||\"HEAD\"===d.type?w=\"nocontent\":304===e?w=\"notmodified\":(w=x.state,p=x.data,c=!(h=x.error))):(h=w,!e&&w||(w=\"error\",e<0&&(e=0))),k.status=e,k.statusText=(t||w)+\"\",c?v.resolveWith(m,[p,w,k]):v.rejectWith(m,[k,w,h]),k.statusCode(y),y=void 0,f&&g.trigger(c?\"ajaxSuccess\":\"ajaxError\",[k,d,c?p:h]),b.fireWith(m,[k,w]),f&&(g.trigger(\"ajaxComplete\",[k,d]),--T.active||T.event.trigger(\"ajaxStop\")))}return k},getJSON:function(e,t,n){return T.get(e,t,n,\"json\")},getScript:function(e,t){return T.get(e,void 0,t,\"script\")}}),T.each([\"get\",\"post\"],function(e,t){T[t]=function(e,n,r,i){return b(n)&&(i=i||r,r=n,n=void 0),T.ajax(T.extend({url:e,type:t,dataType:i,data:n,success:r},T.isPlainObject(e)&&e))}}),T._evalUrl=function(e,t){return T.ajax({url:e,type:\"GET\",dataType:\"script\",cache:!0,async:!1,global:!1,converters:{\"text script\":function(){}},dataFilter:function(e){T.globalEval(e,t)}})},T.fn.extend({wrapAll:function(e){var t;return this[0]&&(b(e)&&(e=e.call(this[0])),t=T(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return b(e)?this.each(function(t){T(this).wrapInner(e.call(this,t))}):this.each(function(){var t=T(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b(e);return this.each(function(n){T(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not(\"body\").each(function(){T(this).replaceWith(this.childNodes)}),this}}),T.expr.pseudos.hidden=function(e){return!T.expr.pseudos.visible(e)},T.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},T.ajaxSettings.xhr=function(){try{return new n.XMLHttpRequest}catch(e){}};var Ut={0:200,1223:204},Vt=T.ajaxSettings.xhr();v.cors=!!Vt&&\"withCredentials\"in Vt,v.ajax=Vt=!!Vt,T.ajaxTransport(function(e){var t,r;if(v.cors||Vt&&!e.crossDomain)return{send:function(i,o){var s,a=e.xhr();if(a.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(s in e.xhrFields)a[s]=e.xhrFields[s];for(s in e.mimeType&&a.overrideMimeType&&a.overrideMimeType(e.mimeType),e.crossDomain||i[\"X-Requested-With\"]||(i[\"X-Requested-With\"]=\"XMLHttpRequest\"),i)a.setRequestHeader(s,i[s]);t=function(e){return function(){t&&(t=r=a.onload=a.onerror=a.onabort=a.ontimeout=a.onreadystatechange=null,\"abort\"===e?a.abort():\"error\"===e?\"number\"!=typeof a.status?o(0,\"error\"):o(a.status,a.statusText):o(Ut[a.status]||a.status,a.statusText,\"text\"!==(a.responseType||\"text\")||\"string\"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=t(),r=a.onerror=a.ontimeout=t(\"error\"),void 0!==a.onabort?a.onabort=r:a.onreadystatechange=function(){4===a.readyState&&n.setTimeout(function(){t&&r()})},t=t(\"abort\");try{a.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}}),T.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),T.ajaxSetup({accepts:{script:\"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript\"},contents:{script:/\\b(?:java|ecma)script\\b/},converters:{\"text script\":function(e){return T.globalEval(e),e}}}),T.ajaxPrefilter(\"script\",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type=\"GET\")}),T.ajaxTransport(\"script\",function(e){var t,n;if(e.crossDomain||e.scriptAttrs)return{send:function(r,i){t=T(\"\n if (val === '') return true;\n if (val === 'false') return false;\n if (val === 'true') return true;\n return val;\n}\n\nif (DOCUMENT && typeof DOCUMENT.querySelector === 'function') {\n var attrs = [['data-family-prefix', 'familyPrefix'], ['data-replacement-class', 'replacementClass'], ['data-auto-replace-svg', 'autoReplaceSvg'], ['data-auto-add-css', 'autoAddCss'], ['data-auto-a11y', 'autoA11y'], ['data-search-pseudo-elements', 'searchPseudoElements'], ['data-observe-mutations', 'observeMutations'], ['data-mutate-approach', 'mutateApproach'], ['data-keep-original-source', 'keepOriginalSource'], ['data-measure-performance', 'measurePerformance'], ['data-show-missing-icons', 'showMissingIcons']];\n attrs.forEach(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n attr = _ref2[0],\n key = _ref2[1];\n\n var val = coerce(getAttrConfig(attr));\n\n if (val !== undefined && val !== null) {\n initial[key] = val;\n }\n });\n}\n\nvar _default = {\n familyPrefix: DEFAULT_FAMILY_PREFIX,\n replacementClass: DEFAULT_REPLACEMENT_CLASS,\n autoReplaceSvg: true,\n autoAddCss: true,\n autoA11y: true,\n searchPseudoElements: false,\n observeMutations: true,\n mutateApproach: 'async',\n keepOriginalSource: true,\n measurePerformance: false,\n showMissingIcons: true\n};\n\nvar _config = _objectSpread({}, _default, initial);\n\nif (!_config.autoReplaceSvg) _config.observeMutations = false;\n\nvar config = _objectSpread({}, _config);\n\nWINDOW.FontAwesomeConfig = config;\n\nvar w = WINDOW || {};\nif (!w[NAMESPACE_IDENTIFIER]) w[NAMESPACE_IDENTIFIER] = {};\nif (!w[NAMESPACE_IDENTIFIER].styles) w[NAMESPACE_IDENTIFIER].styles = {};\nif (!w[NAMESPACE_IDENTIFIER].hooks) w[NAMESPACE_IDENTIFIER].hooks = {};\nif (!w[NAMESPACE_IDENTIFIER].shims) w[NAMESPACE_IDENTIFIER].shims = [];\nvar namespace = w[NAMESPACE_IDENTIFIER];\n\nvar functions = [];\n\nvar listener = function listener() {\n DOCUMENT.removeEventListener('DOMContentLoaded', listener);\n loaded = 1;\n functions.map(function (fn) {\n return fn();\n });\n};\n\nvar loaded = false;\n\nif (IS_DOM) {\n loaded = (DOCUMENT.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(DOCUMENT.readyState);\n if (!loaded) DOCUMENT.addEventListener('DOMContentLoaded', listener);\n}\n\nfunction domready (fn) {\n if (!IS_DOM) return;\n loaded ? setTimeout(fn, 0) : functions.push(fn);\n}\n\nvar PENDING = 'pending';\nvar SETTLED = 'settled';\nvar FULFILLED = 'fulfilled';\nvar REJECTED = 'rejected';\n\nvar NOOP = function NOOP() {};\n\nvar isNode = typeof global !== 'undefined' && typeof global.process !== 'undefined' && typeof global.process.emit === 'function';\nvar asyncSetTimer = typeof setImmediate === 'undefined' ? setTimeout : setImmediate;\nvar asyncQueue = [];\nvar asyncTimer;\n\nfunction asyncFlush() {\n // run promise callbacks\n for (var i = 0; i < asyncQueue.length; i++) {\n asyncQueue[i][0](asyncQueue[i][1]);\n } // reset async asyncQueue\n\n\n asyncQueue = [];\n asyncTimer = false;\n}\n\nfunction asyncCall(callback, arg) {\n asyncQueue.push([callback, arg]);\n\n if (!asyncTimer) {\n asyncTimer = true;\n asyncSetTimer(asyncFlush, 0);\n }\n}\n\nfunction invokeResolver(resolver, promise) {\n function resolvePromise(value) {\n resolve(promise, value);\n }\n\n function rejectPromise(reason) {\n reject(promise, reason);\n }\n\n try {\n resolver(resolvePromise, rejectPromise);\n } catch (e) {\n rejectPromise(e);\n }\n}\n\nfunction invokeCallback(subscriber) {\n var owner = subscriber.owner;\n var settled = owner._state;\n var value = owner._data;\n var callback = subscriber[settled];\n var promise = subscriber.then;\n\n if (typeof callback === 'function') {\n settled = FULFILLED;\n\n try {\n value = callback(value);\n } catch (e) {\n reject(promise, e);\n }\n }\n\n if (!handleThenable(promise, value)) {\n if (settled === FULFILLED) {\n resolve(promise, value);\n }\n\n if (settled === REJECTED) {\n reject(promise, value);\n }\n }\n}\n\nfunction handleThenable(promise, value) {\n var resolved;\n\n try {\n if (promise === value) {\n throw new TypeError('A promises callback cannot return that same promise.');\n }\n\n if (value && (typeof value === 'function' || _typeof(value) === 'object')) {\n // then should be retrieved only once\n var then = value.then;\n\n if (typeof then === 'function') {\n then.call(value, function (val) {\n if (!resolved) {\n resolved = true;\n\n if (value === val) {\n fulfill(promise, val);\n } else {\n resolve(promise, val);\n }\n }\n }, function (reason) {\n if (!resolved) {\n resolved = true;\n reject(promise, reason);\n }\n });\n return true;\n }\n }\n } catch (e) {\n if (!resolved) {\n reject(promise, e);\n }\n\n return true;\n }\n\n return false;\n}\n\nfunction resolve(promise, value) {\n if (promise === value || !handleThenable(promise, value)) {\n fulfill(promise, value);\n }\n}\n\nfunction fulfill(promise, value) {\n if (promise._state === PENDING) {\n promise._state = SETTLED;\n promise._data = value;\n asyncCall(publishFulfillment, promise);\n }\n}\n\nfunction reject(promise, reason) {\n if (promise._state === PENDING) {\n promise._state = SETTLED;\n promise._data = reason;\n asyncCall(publishRejection, promise);\n }\n}\n\nfunction publish(promise) {\n promise._then = promise._then.forEach(invokeCallback);\n}\n\nfunction publishFulfillment(promise) {\n promise._state = FULFILLED;\n publish(promise);\n}\n\nfunction publishRejection(promise) {\n promise._state = REJECTED;\n publish(promise);\n\n if (!promise._handled && isNode) {\n global.process.emit('unhandledRejection', promise._data, promise);\n }\n}\n\nfunction notifyRejectionHandled(promise) {\n global.process.emit('rejectionHandled', promise);\n}\n/**\n * @class\n */\n\n\nfunction P(resolver) {\n if (typeof resolver !== 'function') {\n throw new TypeError('Promise resolver ' + resolver + ' is not a function');\n }\n\n if (this instanceof P === false) {\n throw new TypeError('Failed to construct \\'Promise\\': Please use the \\'new\\' operator, this object constructor cannot be called as a function.');\n }\n\n this._then = [];\n invokeResolver(resolver, this);\n}\n\nP.prototype = {\n constructor: P,\n _state: PENDING,\n _then: null,\n _data: undefined,\n _handled: false,\n then: function then(onFulfillment, onRejection) {\n var subscriber = {\n owner: this,\n then: new this.constructor(NOOP),\n fulfilled: onFulfillment,\n rejected: onRejection\n };\n\n if ((onRejection || onFulfillment) && !this._handled) {\n this._handled = true;\n\n if (this._state === REJECTED && isNode) {\n asyncCall(notifyRejectionHandled, this);\n }\n }\n\n if (this._state === FULFILLED || this._state === REJECTED) {\n // already resolved, call callback async\n asyncCall(invokeCallback, subscriber);\n } else {\n // subscribe\n this._then.push(subscriber);\n }\n\n return subscriber.then;\n },\n catch: function _catch(onRejection) {\n return this.then(null, onRejection);\n }\n};\n\nP.all = function (promises) {\n if (!Array.isArray(promises)) {\n throw new TypeError('You must pass an array to Promise.all().');\n }\n\n return new P(function (resolve, reject) {\n var results = [];\n var remaining = 0;\n\n function resolver(index) {\n remaining++;\n return function (value) {\n results[index] = value;\n\n if (! --remaining) {\n resolve(results);\n }\n };\n }\n\n for (var i = 0, promise; i < promises.length; i++) {\n promise = promises[i];\n\n if (promise && typeof promise.then === 'function') {\n promise.then(resolver(i), reject);\n } else {\n results[i] = promise;\n }\n }\n\n if (!remaining) {\n resolve(results);\n }\n });\n};\n\nP.race = function (promises) {\n if (!Array.isArray(promises)) {\n throw new TypeError('You must pass an array to Promise.race().');\n }\n\n return new P(function (resolve, reject) {\n for (var i = 0, promise; i < promises.length; i++) {\n promise = promises[i];\n\n if (promise && typeof promise.then === 'function') {\n promise.then(resolve, reject);\n } else {\n resolve(promise);\n }\n }\n });\n};\n\nP.resolve = function (value) {\n if (value && _typeof(value) === 'object' && value.constructor === P) {\n return value;\n }\n\n return new P(function (resolve) {\n resolve(value);\n });\n};\n\nP.reject = function (reason) {\n return new P(function (resolve, reject) {\n reject(reason);\n });\n};\n\nvar picked = typeof Promise === 'function' ? Promise : P;\n\nvar d = UNITS_IN_GRID;\nvar meaninglessTransform = {\n size: 16,\n x: 0,\n y: 0,\n rotate: 0,\n flipX: false,\n flipY: false\n};\n\nfunction isReserved(name) {\n return ~RESERVED_CLASSES.indexOf(name);\n}\nfunction insertCss(css) {\n if (!css || !IS_DOM) {\n return;\n }\n\n var style = DOCUMENT.createElement('style');\n style.setAttribute('type', 'text/css');\n style.innerHTML = css;\n var headChildren = DOCUMENT.head.childNodes;\n var beforeChild = null;\n\n for (var i = headChildren.length - 1; i > -1; i--) {\n var child = headChildren[i];\n var tagName = (child.tagName || '').toUpperCase();\n\n if (['STYLE', 'LINK'].indexOf(tagName) > -1) {\n beforeChild = child;\n }\n }\n\n DOCUMENT.head.insertBefore(style, beforeChild);\n return css;\n}\nvar idPool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\nfunction nextUniqueId() {\n var size = 12;\n var id = '';\n\n while (size-- > 0) {\n id += idPool[Math.random() * 62 | 0];\n }\n\n return id;\n}\nfunction toArray(obj) {\n var array = [];\n\n for (var i = (obj || []).length >>> 0; i--;) {\n array[i] = obj[i];\n }\n\n return array;\n}\nfunction classArray(node) {\n if (node.classList) {\n return toArray(node.classList);\n } else {\n return (node.getAttribute('class') || '').split(' ').filter(function (i) {\n return i;\n });\n }\n}\nfunction getIconName(familyPrefix, cls) {\n var parts = cls.split('-');\n var prefix = parts[0];\n var iconName = parts.slice(1).join('-');\n\n if (prefix === familyPrefix && iconName !== '' && !isReserved(iconName)) {\n return iconName;\n } else {\n return null;\n }\n}\nfunction htmlEscape(str) {\n return \"\".concat(str).replace(/&/g, '&').replace(/\"/g, '"').replace(/'/g, ''').replace(//g, '>');\n}\nfunction joinAttributes(attributes) {\n return Object.keys(attributes || {}).reduce(function (acc, attributeName) {\n return acc + \"\".concat(attributeName, \"=\\\"\").concat(htmlEscape(attributes[attributeName]), \"\\\" \");\n }, '').trim();\n}\nfunction joinStyles(styles) {\n return Object.keys(styles || {}).reduce(function (acc, styleName) {\n return acc + \"\".concat(styleName, \": \").concat(styles[styleName], \";\");\n }, '');\n}\nfunction transformIsMeaningful(transform) {\n return transform.size !== meaninglessTransform.size || transform.x !== meaninglessTransform.x || transform.y !== meaninglessTransform.y || transform.rotate !== meaninglessTransform.rotate || transform.flipX || transform.flipY;\n}\nfunction transformForSvg(_ref) {\n var transform = _ref.transform,\n containerWidth = _ref.containerWidth,\n iconWidth = _ref.iconWidth;\n var outer = {\n transform: \"translate(\".concat(containerWidth / 2, \" 256)\")\n };\n var innerTranslate = \"translate(\".concat(transform.x * 32, \", \").concat(transform.y * 32, \") \");\n var innerScale = \"scale(\".concat(transform.size / 16 * (transform.flipX ? -1 : 1), \", \").concat(transform.size / 16 * (transform.flipY ? -1 : 1), \") \");\n var innerRotate = \"rotate(\".concat(transform.rotate, \" 0 0)\");\n var inner = {\n transform: \"\".concat(innerTranslate, \" \").concat(innerScale, \" \").concat(innerRotate)\n };\n var path = {\n transform: \"translate(\".concat(iconWidth / 2 * -1, \" -256)\")\n };\n return {\n outer: outer,\n inner: inner,\n path: path\n };\n}\nfunction transformForCss(_ref2) {\n var transform = _ref2.transform,\n _ref2$width = _ref2.width,\n width = _ref2$width === void 0 ? UNITS_IN_GRID : _ref2$width,\n _ref2$height = _ref2.height,\n height = _ref2$height === void 0 ? UNITS_IN_GRID : _ref2$height,\n _ref2$startCentered = _ref2.startCentered,\n startCentered = _ref2$startCentered === void 0 ? false : _ref2$startCentered;\n var val = '';\n\n if (startCentered && IS_IE) {\n val += \"translate(\".concat(transform.x / d - width / 2, \"em, \").concat(transform.y / d - height / 2, \"em) \");\n } else if (startCentered) {\n val += \"translate(calc(-50% + \".concat(transform.x / d, \"em), calc(-50% + \").concat(transform.y / d, \"em)) \");\n } else {\n val += \"translate(\".concat(transform.x / d, \"em, \").concat(transform.y / d, \"em) \");\n }\n\n val += \"scale(\".concat(transform.size / d * (transform.flipX ? -1 : 1), \", \").concat(transform.size / d * (transform.flipY ? -1 : 1), \") \");\n val += \"rotate(\".concat(transform.rotate, \"deg) \");\n return val;\n}\n\nvar ALL_SPACE = {\n x: 0,\n y: 0,\n width: '100%',\n height: '100%'\n};\n\nfunction fillBlack(abstract) {\n var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n\n if (abstract.attributes && (abstract.attributes.fill || force)) {\n abstract.attributes.fill = 'black';\n }\n\n return abstract;\n}\n\nfunction deGroup(abstract) {\n if (abstract.tag === 'g') {\n return abstract.children;\n } else {\n return [abstract];\n }\n}\n\nfunction makeIconMasking (_ref) {\n var children = _ref.children,\n attributes = _ref.attributes,\n main = _ref.main,\n mask = _ref.mask,\n transform = _ref.transform;\n var mainWidth = main.width,\n mainPath = main.icon;\n var maskWidth = mask.width,\n maskPath = mask.icon;\n var trans = transformForSvg({\n transform: transform,\n containerWidth: maskWidth,\n iconWidth: mainWidth\n });\n var maskRect = {\n tag: 'rect',\n attributes: _objectSpread({}, ALL_SPACE, {\n fill: 'white'\n })\n };\n var maskInnerGroupChildrenMixin = mainPath.children ? {\n children: mainPath.children.map(fillBlack)\n } : {};\n var maskInnerGroup = {\n tag: 'g',\n attributes: _objectSpread({}, trans.inner),\n children: [fillBlack(_objectSpread({\n tag: mainPath.tag,\n attributes: _objectSpread({}, mainPath.attributes, trans.path)\n }, maskInnerGroupChildrenMixin))]\n };\n var maskOuterGroup = {\n tag: 'g',\n attributes: _objectSpread({}, trans.outer),\n children: [maskInnerGroup]\n };\n var maskId = \"mask-\".concat(nextUniqueId());\n var clipId = \"clip-\".concat(nextUniqueId());\n var maskTag = {\n tag: 'mask',\n attributes: _objectSpread({}, ALL_SPACE, {\n id: maskId,\n maskUnits: 'userSpaceOnUse',\n maskContentUnits: 'userSpaceOnUse'\n }),\n children: [maskRect, maskOuterGroup]\n };\n var defs = {\n tag: 'defs',\n children: [{\n tag: 'clipPath',\n attributes: {\n id: clipId\n },\n children: deGroup(maskPath)\n }, maskTag]\n };\n children.push(defs, {\n tag: 'rect',\n attributes: _objectSpread({\n fill: 'currentColor',\n 'clip-path': \"url(#\".concat(clipId, \")\"),\n mask: \"url(#\".concat(maskId, \")\")\n }, ALL_SPACE)\n });\n return {\n children: children,\n attributes: attributes\n };\n}\n\nfunction makeIconStandard (_ref) {\n var children = _ref.children,\n attributes = _ref.attributes,\n main = _ref.main,\n transform = _ref.transform,\n styles = _ref.styles;\n var styleString = joinStyles(styles);\n\n if (styleString.length > 0) {\n attributes['style'] = styleString;\n }\n\n if (transformIsMeaningful(transform)) {\n var trans = transformForSvg({\n transform: transform,\n containerWidth: main.width,\n iconWidth: main.width\n });\n children.push({\n tag: 'g',\n attributes: _objectSpread({}, trans.outer),\n children: [{\n tag: 'g',\n attributes: _objectSpread({}, trans.inner),\n children: [{\n tag: main.icon.tag,\n children: main.icon.children,\n attributes: _objectSpread({}, main.icon.attributes, trans.path)\n }]\n }]\n });\n } else {\n children.push(main.icon);\n }\n\n return {\n children: children,\n attributes: attributes\n };\n}\n\nfunction asIcon (_ref) {\n var children = _ref.children,\n main = _ref.main,\n mask = _ref.mask,\n attributes = _ref.attributes,\n styles = _ref.styles,\n transform = _ref.transform;\n\n if (transformIsMeaningful(transform) && main.found && !mask.found) {\n var width = main.width,\n height = main.height;\n var offset = {\n x: width / height / 2,\n y: 0.5\n };\n attributes['style'] = joinStyles(_objectSpread({}, styles, {\n 'transform-origin': \"\".concat(offset.x + transform.x / 16, \"em \").concat(offset.y + transform.y / 16, \"em\")\n }));\n }\n\n return [{\n tag: 'svg',\n attributes: attributes,\n children: children\n }];\n}\n\nfunction asSymbol (_ref) {\n var prefix = _ref.prefix,\n iconName = _ref.iconName,\n children = _ref.children,\n attributes = _ref.attributes,\n symbol = _ref.symbol;\n var id = symbol === true ? \"\".concat(prefix, \"-\").concat(config.familyPrefix, \"-\").concat(iconName) : symbol;\n return [{\n tag: 'svg',\n attributes: {\n style: 'display: none;'\n },\n children: [{\n tag: 'symbol',\n attributes: _objectSpread({}, attributes, {\n id: id\n }),\n children: children\n }]\n }];\n}\n\nfunction makeInlineSvgAbstract(params) {\n var _params$icons = params.icons,\n main = _params$icons.main,\n mask = _params$icons.mask,\n prefix = params.prefix,\n iconName = params.iconName,\n transform = params.transform,\n symbol = params.symbol,\n title = params.title,\n extra = params.extra,\n _params$watchable = params.watchable,\n watchable = _params$watchable === void 0 ? false : _params$watchable;\n\n var _ref = mask.found ? mask : main,\n width = _ref.width,\n height = _ref.height;\n\n var widthClass = \"fa-w-\".concat(Math.ceil(width / height * 16));\n var attrClass = [config.replacementClass, iconName ? \"\".concat(config.familyPrefix, \"-\").concat(iconName) : '', widthClass].filter(function (c) {\n return extra.classes.indexOf(c) === -1;\n }).concat(extra.classes).join(' ');\n var content = {\n children: [],\n attributes: _objectSpread({}, extra.attributes, {\n 'data-prefix': prefix,\n 'data-icon': iconName,\n 'class': attrClass,\n 'role': extra.attributes.role || 'img',\n 'xmlns': 'http://www.w3.org/2000/svg',\n 'viewBox': \"0 0 \".concat(width, \" \").concat(height)\n })\n };\n\n if (watchable) {\n content.attributes[DATA_FA_I2SVG] = '';\n }\n\n if (title) content.children.push({\n tag: 'title',\n attributes: {\n id: content.attributes['aria-labelledby'] || \"title-\".concat(nextUniqueId())\n },\n children: [title]\n });\n\n var args = _objectSpread({}, content, {\n prefix: prefix,\n iconName: iconName,\n main: main,\n mask: mask,\n transform: transform,\n symbol: symbol,\n styles: extra.styles\n });\n\n var _ref2 = mask.found && main.found ? makeIconMasking(args) : makeIconStandard(args),\n children = _ref2.children,\n attributes = _ref2.attributes;\n\n args.children = children;\n args.attributes = attributes;\n\n if (symbol) {\n return asSymbol(args);\n } else {\n return asIcon(args);\n }\n}\nfunction makeLayersTextAbstract(params) {\n var content = params.content,\n width = params.width,\n height = params.height,\n transform = params.transform,\n title = params.title,\n extra = params.extra,\n _params$watchable2 = params.watchable,\n watchable = _params$watchable2 === void 0 ? false : _params$watchable2;\n\n var attributes = _objectSpread({}, extra.attributes, title ? {\n 'title': title\n } : {}, {\n 'class': extra.classes.join(' ')\n });\n\n if (watchable) {\n attributes[DATA_FA_I2SVG] = '';\n }\n\n var styles = _objectSpread({}, extra.styles);\n\n if (transformIsMeaningful(transform)) {\n styles['transform'] = transformForCss({\n transform: transform,\n startCentered: true,\n width: width,\n height: height\n });\n styles['-webkit-transform'] = styles['transform'];\n }\n\n var styleString = joinStyles(styles);\n\n if (styleString.length > 0) {\n attributes['style'] = styleString;\n }\n\n var val = [];\n val.push({\n tag: 'span',\n attributes: attributes,\n children: [content]\n });\n\n if (title) {\n val.push({\n tag: 'span',\n attributes: {\n class: 'sr-only'\n },\n children: [title]\n });\n }\n\n return val;\n}\nfunction makeLayersCounterAbstract(params) {\n var content = params.content,\n title = params.title,\n extra = params.extra;\n\n var attributes = _objectSpread({}, extra.attributes, title ? {\n 'title': title\n } : {}, {\n 'class': extra.classes.join(' ')\n });\n\n var styleString = joinStyles(extra.styles);\n\n if (styleString.length > 0) {\n attributes['style'] = styleString;\n }\n\n var val = [];\n val.push({\n tag: 'span',\n attributes: attributes,\n children: [content]\n });\n\n if (title) {\n val.push({\n tag: 'span',\n attributes: {\n class: 'sr-only'\n },\n children: [title]\n });\n }\n\n return val;\n}\n\nvar noop$1 = function noop() {};\n\nvar p = config.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : {\n mark: noop$1,\n measure: noop$1\n};\nvar preamble = \"FA \\\"5.12.1\\\"\";\n\nvar begin = function begin(name) {\n p.mark(\"\".concat(preamble, \" \").concat(name, \" begins\"));\n return function () {\n return end(name);\n };\n};\n\nvar end = function end(name) {\n p.mark(\"\".concat(preamble, \" \").concat(name, \" ends\"));\n p.measure(\"\".concat(preamble, \" \").concat(name), \"\".concat(preamble, \" \").concat(name, \" begins\"), \"\".concat(preamble, \" \").concat(name, \" ends\"));\n};\n\nvar perf = {\n begin: begin,\n end: end\n};\n\n/**\n * Internal helper to bind a function known to have 4 arguments\n * to a given context.\n */\n\nvar bindInternal4 = function bindInternal4(func, thisContext) {\n return function (a, b, c, d) {\n return func.call(thisContext, a, b, c, d);\n };\n};\n\n/**\n * # Reduce\n *\n * A fast object `.reduce()` implementation.\n *\n * @param {Object} subject The object to reduce over.\n * @param {Function} fn The reducer function.\n * @param {mixed} initialValue The initial value for the reducer, defaults to subject[0].\n * @param {Object} thisContext The context for the reducer.\n * @return {mixed} The final result.\n */\n\n\nvar reduce = function fastReduceObject(subject, fn, initialValue, thisContext) {\n var keys = Object.keys(subject),\n length = keys.length,\n iterator = thisContext !== undefined ? bindInternal4(fn, thisContext) : fn,\n i,\n key,\n result;\n\n if (initialValue === undefined) {\n i = 1;\n result = subject[keys[0]];\n } else {\n i = 0;\n result = initialValue;\n }\n\n for (; i < length; i++) {\n key = keys[i];\n result = iterator(result, subject[key], key, subject);\n }\n\n return result;\n};\n\nfunction toHex(unicode) {\n var result = '';\n\n for (var i = 0; i < unicode.length; i++) {\n var hex = unicode.charCodeAt(i).toString(16);\n result += ('000' + hex).slice(-4);\n }\n\n return result;\n}\n\nfunction defineIcons(prefix, icons) {\n var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var _params$skipHooks = params.skipHooks,\n skipHooks = _params$skipHooks === void 0 ? false : _params$skipHooks;\n var normalized = Object.keys(icons).reduce(function (acc, iconName) {\n var icon = icons[iconName];\n var expanded = !!icon.icon;\n\n if (expanded) {\n acc[icon.iconName] = icon.icon;\n } else {\n acc[iconName] = icon;\n }\n\n return acc;\n }, {});\n\n if (typeof namespace.hooks.addPack === 'function' && !skipHooks) {\n namespace.hooks.addPack(prefix, normalized);\n } else {\n namespace.styles[prefix] = _objectSpread({}, namespace.styles[prefix] || {}, normalized);\n }\n /**\n * Font Awesome 4 used the prefix of `fa` for all icons. With the introduction\n * of new styles we needed to differentiate between them. Prefix `fa` is now an alias\n * for `fas` so we'll easy the upgrade process for our users by automatically defining\n * this as well.\n */\n\n\n if (prefix === 'fas') {\n defineIcons('fa', icons);\n }\n}\n\nvar styles = namespace.styles,\n shims = namespace.shims;\nvar _byUnicode = {};\nvar _byLigature = {};\nvar _byOldName = {};\nvar build = function build() {\n var lookup = function lookup(reducer) {\n return reduce(styles, function (o, style, prefix) {\n o[prefix] = reduce(style, reducer, {});\n return o;\n }, {});\n };\n\n _byUnicode = lookup(function (acc, icon, iconName) {\n if (icon[3]) {\n acc[icon[3]] = iconName;\n }\n\n return acc;\n });\n _byLigature = lookup(function (acc, icon, iconName) {\n var ligatures = icon[2];\n acc[iconName] = iconName;\n ligatures.forEach(function (ligature) {\n acc[ligature] = iconName;\n });\n return acc;\n });\n var hasRegular = 'far' in styles;\n _byOldName = reduce(shims, function (acc, shim) {\n var oldName = shim[0];\n var prefix = shim[1];\n var iconName = shim[2];\n\n if (prefix === 'far' && !hasRegular) {\n prefix = 'fas';\n }\n\n acc[oldName] = {\n prefix: prefix,\n iconName: iconName\n };\n return acc;\n }, {});\n};\nbuild();\nfunction byUnicode(prefix, unicode) {\n return (_byUnicode[prefix] || {})[unicode];\n}\nfunction byLigature(prefix, ligature) {\n return (_byLigature[prefix] || {})[ligature];\n}\nfunction byOldName(name) {\n return _byOldName[name] || {\n prefix: null,\n iconName: null\n };\n}\n\nvar styles$1 = namespace.styles;\nvar emptyCanonicalIcon = function emptyCanonicalIcon() {\n return {\n prefix: null,\n iconName: null,\n rest: []\n };\n};\nfunction getCanonicalIcon(values) {\n return values.reduce(function (acc, cls) {\n var iconName = getIconName(config.familyPrefix, cls);\n\n if (styles$1[cls]) {\n acc.prefix = cls;\n } else if (config.autoFetchSvg && ['fas', 'far', 'fal', 'fad', 'fab', 'fa'].indexOf(cls) > -1) {\n acc.prefix = cls;\n } else if (iconName) {\n var shim = acc.prefix === 'fa' ? byOldName(iconName) : {};\n acc.iconName = shim.iconName || iconName;\n acc.prefix = shim.prefix || acc.prefix;\n } else if (cls !== config.replacementClass && cls.indexOf('fa-w-') !== 0) {\n acc.rest.push(cls);\n }\n\n return acc;\n }, emptyCanonicalIcon());\n}\nfunction iconFromMapping(mapping, prefix, iconName) {\n if (mapping && mapping[prefix] && mapping[prefix][iconName]) {\n return {\n prefix: prefix,\n iconName: iconName,\n icon: mapping[prefix][iconName]\n };\n }\n}\n\nfunction toHtml(abstractNodes) {\n var tag = abstractNodes.tag,\n _abstractNodes$attrib = abstractNodes.attributes,\n attributes = _abstractNodes$attrib === void 0 ? {} : _abstractNodes$attrib,\n _abstractNodes$childr = abstractNodes.children,\n children = _abstractNodes$childr === void 0 ? [] : _abstractNodes$childr;\n\n if (typeof abstractNodes === 'string') {\n return htmlEscape(abstractNodes);\n } else {\n return \"<\".concat(tag, \" \").concat(joinAttributes(attributes), \">\").concat(children.map(toHtml).join(''), \"\");\n }\n}\n\nvar noop$2 = function noop() {};\n\nfunction isWatched(node) {\n var i2svg = node.getAttribute ? node.getAttribute(DATA_FA_I2SVG) : null;\n return typeof i2svg === 'string';\n}\n\nfunction getMutator() {\n if (config.autoReplaceSvg === true) {\n return mutators.replace;\n }\n\n var mutator = mutators[config.autoReplaceSvg];\n return mutator || mutators.replace;\n}\n\nvar mutators = {\n replace: function replace(mutation) {\n var node = mutation[0];\n var abstract = mutation[1];\n var newOuterHTML = abstract.map(function (a) {\n return toHtml(a);\n }).join('\\n');\n\n if (node.parentNode && node.outerHTML) {\n node.outerHTML = newOuterHTML + (config.keepOriginalSource && node.tagName.toLowerCase() !== 'svg' ? \"\") : '');\n } else if (node.parentNode) {\n var newNode = document.createElement('span');\n node.parentNode.replaceChild(newNode, node);\n newNode.outerHTML = newOuterHTML;\n }\n },\n nest: function nest(mutation) {\n var node = mutation[0];\n var abstract = mutation[1]; // If we already have a replaced node we do not want to continue nesting within it.\n // Short-circuit to the standard replacement\n\n if (~classArray(node).indexOf(config.replacementClass)) {\n return mutators.replace(mutation);\n }\n\n var forSvg = new RegExp(\"\".concat(config.familyPrefix, \"-.*\"));\n delete abstract[0].attributes.style;\n delete abstract[0].attributes.id;\n var splitClasses = abstract[0].attributes.class.split(' ').reduce(function (acc, cls) {\n if (cls === config.replacementClass || cls.match(forSvg)) {\n acc.toSvg.push(cls);\n } else {\n acc.toNode.push(cls);\n }\n\n return acc;\n }, {\n toNode: [],\n toSvg: []\n });\n abstract[0].attributes.class = splitClasses.toSvg.join(' ');\n var newInnerHTML = abstract.map(function (a) {\n return toHtml(a);\n }).join('\\n');\n node.setAttribute('class', splitClasses.toNode.join(' '));\n node.setAttribute(DATA_FA_I2SVG, '');\n node.innerHTML = newInnerHTML;\n }\n};\n\nfunction performOperationSync(op) {\n op();\n}\n\nfunction perform(mutations, callback) {\n var callbackFunction = typeof callback === 'function' ? callback : noop$2;\n\n if (mutations.length === 0) {\n callbackFunction();\n } else {\n var frame = performOperationSync;\n\n if (config.mutateApproach === MUTATION_APPROACH_ASYNC) {\n frame = WINDOW.requestAnimationFrame || performOperationSync;\n }\n\n frame(function () {\n var mutator = getMutator();\n var mark = perf.begin('mutate');\n mutations.map(mutator);\n mark();\n callbackFunction();\n });\n }\n}\nvar disabled = false;\nfunction disableObservation() {\n disabled = true;\n}\nfunction enableObservation() {\n disabled = false;\n}\nvar mo = null;\nfunction observe(options) {\n if (!MUTATION_OBSERVER) {\n return;\n }\n\n if (!config.observeMutations) {\n return;\n }\n\n var treeCallback = options.treeCallback,\n nodeCallback = options.nodeCallback,\n pseudoElementsCallback = options.pseudoElementsCallback,\n _options$observeMutat = options.observeMutationsRoot,\n observeMutationsRoot = _options$observeMutat === void 0 ? DOCUMENT : _options$observeMutat;\n mo = new MUTATION_OBSERVER(function (objects) {\n if (disabled) return;\n toArray(objects).forEach(function (mutationRecord) {\n if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) {\n if (config.searchPseudoElements) {\n pseudoElementsCallback(mutationRecord.target);\n }\n\n treeCallback(mutationRecord.target);\n }\n\n if (mutationRecord.type === 'attributes' && mutationRecord.target.parentNode && config.searchPseudoElements) {\n pseudoElementsCallback(mutationRecord.target.parentNode);\n }\n\n if (mutationRecord.type === 'attributes' && isWatched(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) {\n if (mutationRecord.attributeName === 'class') {\n var _getCanonicalIcon = getCanonicalIcon(classArray(mutationRecord.target)),\n prefix = _getCanonicalIcon.prefix,\n iconName = _getCanonicalIcon.iconName;\n\n if (prefix) mutationRecord.target.setAttribute('data-prefix', prefix);\n if (iconName) mutationRecord.target.setAttribute('data-icon', iconName);\n } else {\n nodeCallback(mutationRecord.target);\n }\n }\n });\n });\n if (!IS_DOM) return;\n mo.observe(observeMutationsRoot, {\n childList: true,\n attributes: true,\n characterData: true,\n subtree: true\n });\n}\nfunction disconnect() {\n if (!mo) return;\n mo.disconnect();\n}\n\nfunction styleParser (node) {\n var style = node.getAttribute('style');\n var val = [];\n\n if (style) {\n val = style.split(';').reduce(function (acc, style) {\n var styles = style.split(':');\n var prop = styles[0];\n var value = styles.slice(1);\n\n if (prop && value.length > 0) {\n acc[prop] = value.join(':').trim();\n }\n\n return acc;\n }, {});\n }\n\n return val;\n}\n\nfunction classParser (node) {\n var existingPrefix = node.getAttribute('data-prefix');\n var existingIconName = node.getAttribute('data-icon');\n var innerText = node.innerText !== undefined ? node.innerText.trim() : '';\n var val = getCanonicalIcon(classArray(node));\n\n if (existingPrefix && existingIconName) {\n val.prefix = existingPrefix;\n val.iconName = existingIconName;\n }\n\n if (val.prefix && innerText.length > 1) {\n val.iconName = byLigature(val.prefix, node.innerText);\n } else if (val.prefix && innerText.length === 1) {\n val.iconName = byUnicode(val.prefix, toHex(node.innerText));\n }\n\n return val;\n}\n\nvar parseTransformString = function parseTransformString(transformString) {\n var transform = {\n size: 16,\n x: 0,\n y: 0,\n flipX: false,\n flipY: false,\n rotate: 0\n };\n\n if (!transformString) {\n return transform;\n } else {\n return transformString.toLowerCase().split(' ').reduce(function (acc, n) {\n var parts = n.toLowerCase().split('-');\n var first = parts[0];\n var rest = parts.slice(1).join('-');\n\n if (first && rest === 'h') {\n acc.flipX = true;\n return acc;\n }\n\n if (first && rest === 'v') {\n acc.flipY = true;\n return acc;\n }\n\n rest = parseFloat(rest);\n\n if (isNaN(rest)) {\n return acc;\n }\n\n switch (first) {\n case 'grow':\n acc.size = acc.size + rest;\n break;\n\n case 'shrink':\n acc.size = acc.size - rest;\n break;\n\n case 'left':\n acc.x = acc.x - rest;\n break;\n\n case 'right':\n acc.x = acc.x + rest;\n break;\n\n case 'up':\n acc.y = acc.y - rest;\n break;\n\n case 'down':\n acc.y = acc.y + rest;\n break;\n\n case 'rotate':\n acc.rotate = acc.rotate + rest;\n break;\n }\n\n return acc;\n }, transform);\n }\n};\nfunction transformParser (node) {\n return parseTransformString(node.getAttribute('data-fa-transform'));\n}\n\nfunction symbolParser (node) {\n var symbol = node.getAttribute('data-fa-symbol');\n return symbol === null ? false : symbol === '' ? true : symbol;\n}\n\nfunction attributesParser (node) {\n var extraAttributes = toArray(node.attributes).reduce(function (acc, attr) {\n if (acc.name !== 'class' && acc.name !== 'style') {\n acc[attr.name] = attr.value;\n }\n\n return acc;\n }, {});\n var title = node.getAttribute('title');\n\n if (config.autoA11y) {\n if (title) {\n extraAttributes['aria-labelledby'] = \"\".concat(config.replacementClass, \"-title-\").concat(nextUniqueId());\n } else {\n extraAttributes['aria-hidden'] = 'true';\n extraAttributes['focusable'] = 'false';\n }\n }\n\n return extraAttributes;\n}\n\nfunction maskParser (node) {\n var mask = node.getAttribute('data-fa-mask');\n\n if (!mask) {\n return emptyCanonicalIcon();\n } else {\n return getCanonicalIcon(mask.split(' ').map(function (i) {\n return i.trim();\n }));\n }\n}\n\nfunction blankMeta() {\n return {\n iconName: null,\n title: null,\n prefix: null,\n transform: meaninglessTransform,\n symbol: false,\n mask: null,\n extra: {\n classes: [],\n styles: {},\n attributes: {}\n }\n };\n}\nfunction parseMeta(node) {\n var _classParser = classParser(node),\n iconName = _classParser.iconName,\n prefix = _classParser.prefix,\n extraClasses = _classParser.rest;\n\n var extraStyles = styleParser(node);\n var transform = transformParser(node);\n var symbol = symbolParser(node);\n var extraAttributes = attributesParser(node);\n var mask = maskParser(node);\n return {\n iconName: iconName,\n title: node.getAttribute('title'),\n prefix: prefix,\n transform: transform,\n symbol: symbol,\n mask: mask,\n extra: {\n classes: extraClasses,\n styles: extraStyles,\n attributes: extraAttributes\n }\n };\n}\n\nfunction MissingIcon(error) {\n this.name = 'MissingIcon';\n this.message = error || 'Icon unavailable';\n this.stack = new Error().stack;\n}\nMissingIcon.prototype = Object.create(Error.prototype);\nMissingIcon.prototype.constructor = MissingIcon;\n\nvar FILL = {\n fill: 'currentColor'\n};\nvar ANIMATION_BASE = {\n attributeType: 'XML',\n repeatCount: 'indefinite',\n dur: '2s'\n};\nvar RING = {\n tag: 'path',\n attributes: _objectSpread({}, FILL, {\n d: 'M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z'\n })\n};\n\nvar OPACITY_ANIMATE = _objectSpread({}, ANIMATION_BASE, {\n attributeName: 'opacity'\n});\n\nvar DOT = {\n tag: 'circle',\n attributes: _objectSpread({}, FILL, {\n cx: '256',\n cy: '364',\n r: '28'\n }),\n children: [{\n tag: 'animate',\n attributes: _objectSpread({}, ANIMATION_BASE, {\n attributeName: 'r',\n values: '28;14;28;28;14;28;'\n })\n }, {\n tag: 'animate',\n attributes: _objectSpread({}, OPACITY_ANIMATE, {\n values: '1;0;1;1;0;1;'\n })\n }]\n};\nvar QUESTION = {\n tag: 'path',\n attributes: _objectSpread({}, FILL, {\n opacity: '1',\n d: 'M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z'\n }),\n children: [{\n tag: 'animate',\n attributes: _objectSpread({}, OPACITY_ANIMATE, {\n values: '1;0;0;0;0;1;'\n })\n }]\n};\nvar EXCLAMATION = {\n tag: 'path',\n attributes: _objectSpread({}, FILL, {\n opacity: '0',\n d: 'M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z'\n }),\n children: [{\n tag: 'animate',\n attributes: _objectSpread({}, OPACITY_ANIMATE, {\n values: '0;0;1;1;0;0;'\n })\n }]\n};\nvar missing = {\n tag: 'g',\n children: [RING, DOT, QUESTION, EXCLAMATION]\n};\n\nvar styles$2 = namespace.styles;\nfunction asFoundIcon(icon) {\n var width = icon[0];\n var height = icon[1];\n\n var _icon$slice = icon.slice(4),\n _icon$slice2 = _slicedToArray(_icon$slice, 1),\n vectorData = _icon$slice2[0];\n\n var element = null;\n\n if (Array.isArray(vectorData)) {\n element = {\n tag: 'g',\n attributes: {\n class: \"\".concat(config.familyPrefix, \"-\").concat(DUOTONE_CLASSES.GROUP)\n },\n children: [{\n tag: 'path',\n attributes: {\n class: \"\".concat(config.familyPrefix, \"-\").concat(DUOTONE_CLASSES.SECONDARY),\n fill: 'currentColor',\n d: vectorData[0]\n }\n }, {\n tag: 'path',\n attributes: {\n class: \"\".concat(config.familyPrefix, \"-\").concat(DUOTONE_CLASSES.PRIMARY),\n fill: 'currentColor',\n d: vectorData[1]\n }\n }]\n };\n } else {\n element = {\n tag: 'path',\n attributes: {\n fill: 'currentColor',\n d: vectorData\n }\n };\n }\n\n return {\n found: true,\n width: width,\n height: height,\n icon: element\n };\n}\nfunction findIcon(iconName, prefix) {\n return new picked(function (resolve, reject) {\n var val = {\n found: false,\n width: 512,\n height: 512,\n icon: missing\n };\n\n if (iconName && prefix && styles$2[prefix] && styles$2[prefix][iconName]) {\n var icon = styles$2[prefix][iconName];\n return resolve(asFoundIcon(icon));\n }\n\n var headers = {};\n\n if (_typeof(WINDOW.FontAwesomeKitConfig) === 'object' && typeof window.FontAwesomeKitConfig.token === 'string') {\n headers['fa-kit-token'] = WINDOW.FontAwesomeKitConfig.token;\n }\n\n if (iconName && prefix && !config.showMissingIcons) {\n reject(new MissingIcon(\"Icon is missing for prefix \".concat(prefix, \" with icon name \").concat(iconName)));\n } else {\n resolve(val);\n }\n });\n}\n\nvar styles$3 = namespace.styles;\n\nfunction generateSvgReplacementMutation(node, nodeMeta) {\n var iconName = nodeMeta.iconName,\n title = nodeMeta.title,\n prefix = nodeMeta.prefix,\n transform = nodeMeta.transform,\n symbol = nodeMeta.symbol,\n mask = nodeMeta.mask,\n extra = nodeMeta.extra;\n return new picked(function (resolve, reject) {\n picked.all([findIcon(iconName, prefix), findIcon(mask.iconName, mask.prefix)]).then(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n main = _ref2[0],\n mask = _ref2[1];\n\n resolve([node, makeInlineSvgAbstract({\n icons: {\n main: main,\n mask: mask\n },\n prefix: prefix,\n iconName: iconName,\n transform: transform,\n symbol: symbol,\n mask: mask,\n title: title,\n extra: extra,\n watchable: true\n })]);\n });\n });\n}\n\nfunction generateLayersText(node, nodeMeta) {\n var title = nodeMeta.title,\n transform = nodeMeta.transform,\n extra = nodeMeta.extra;\n var width = null;\n var height = null;\n\n if (IS_IE) {\n var computedFontSize = parseInt(getComputedStyle(node).fontSize, 10);\n var boundingClientRect = node.getBoundingClientRect();\n width = boundingClientRect.width / computedFontSize;\n height = boundingClientRect.height / computedFontSize;\n }\n\n if (config.autoA11y && !title) {\n extra.attributes['aria-hidden'] = 'true';\n }\n\n return picked.resolve([node, makeLayersTextAbstract({\n content: node.innerHTML,\n width: width,\n height: height,\n transform: transform,\n title: title,\n extra: extra,\n watchable: true\n })]);\n}\n\nfunction generateMutation(node) {\n var nodeMeta = parseMeta(node);\n\n if (~nodeMeta.extra.classes.indexOf(LAYERS_TEXT_CLASSNAME)) {\n return generateLayersText(node, nodeMeta);\n } else {\n return generateSvgReplacementMutation(node, nodeMeta);\n }\n}\n\nfunction onTree(root) {\n var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n if (!IS_DOM) return;\n var htmlClassList = DOCUMENT.documentElement.classList;\n\n var hclAdd = function hclAdd(suffix) {\n return htmlClassList.add(\"\".concat(HTML_CLASS_I2SVG_BASE_CLASS, \"-\").concat(suffix));\n };\n\n var hclRemove = function hclRemove(suffix) {\n return htmlClassList.remove(\"\".concat(HTML_CLASS_I2SVG_BASE_CLASS, \"-\").concat(suffix));\n };\n\n var prefixes = config.autoFetchSvg ? Object.keys(PREFIX_TO_STYLE) : Object.keys(styles$3);\n var prefixesDomQuery = [\".\".concat(LAYERS_TEXT_CLASSNAME, \":not([\").concat(DATA_FA_I2SVG, \"])\")].concat(prefixes.map(function (p) {\n return \".\".concat(p, \":not([\").concat(DATA_FA_I2SVG, \"])\");\n })).join(', ');\n\n if (prefixesDomQuery.length === 0) {\n return;\n }\n\n var candidates = [];\n\n try {\n candidates = toArray(root.querySelectorAll(prefixesDomQuery));\n } catch (e) {// noop\n }\n\n if (candidates.length > 0) {\n hclAdd('pending');\n hclRemove('complete');\n } else {\n return;\n }\n\n var mark = perf.begin('onTree');\n var mutations = candidates.reduce(function (acc, node) {\n try {\n var mutation = generateMutation(node);\n\n if (mutation) {\n acc.push(mutation);\n }\n } catch (e) {\n if (!PRODUCTION) {\n if (e instanceof MissingIcon) {\n console.error(e);\n }\n }\n }\n\n return acc;\n }, []);\n return new picked(function (resolve, reject) {\n picked.all(mutations).then(function (resolvedMutations) {\n perform(resolvedMutations, function () {\n hclAdd('active');\n hclAdd('complete');\n hclRemove('pending');\n if (typeof callback === 'function') callback();\n mark();\n resolve();\n });\n }).catch(function () {\n mark();\n reject();\n });\n });\n}\nfunction onNode(node) {\n var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n generateMutation(node).then(function (mutation) {\n if (mutation) {\n perform([mutation], callback);\n }\n });\n}\n\nfunction replaceForPosition(node, position) {\n var pendingAttribute = \"\".concat(DATA_FA_PSEUDO_ELEMENT_PENDING).concat(position.replace(':', '-'));\n return new picked(function (resolve, reject) {\n if (node.getAttribute(pendingAttribute) !== null) {\n // This node is already being processed\n return resolve();\n }\n\n var children = toArray(node.children);\n var alreadyProcessedPseudoElement = children.filter(function (c) {\n return c.getAttribute(DATA_FA_PSEUDO_ELEMENT) === position;\n })[0];\n var styles = WINDOW.getComputedStyle(node, position);\n var fontFamily = styles.getPropertyValue('font-family').match(FONT_FAMILY_PATTERN);\n var fontWeight = styles.getPropertyValue('font-weight');\n var content = styles.getPropertyValue('content');\n\n if (alreadyProcessedPseudoElement && !fontFamily) {\n // If we've already processed it but the current computed style does not result in a font-family,\n // that probably means that a class name that was previously present to make the icon has been\n // removed. So we now should delete the icon.\n node.removeChild(alreadyProcessedPseudoElement);\n return resolve();\n } else if (fontFamily && content !== 'none' && content !== '') {\n var prefix = ~['Solid', 'Regular', 'Light', 'Duotone', 'Brands'].indexOf(fontFamily[1]) ? STYLE_TO_PREFIX[fontFamily[1].toLowerCase()] : FONT_WEIGHT_TO_PREFIX[fontWeight];\n var hexValue = toHex(content.length === 3 ? content.substr(1, 1) : content);\n var iconName = byUnicode(prefix, hexValue);\n var iconIdentifier = iconName; // Only convert the pseudo element in this :before/:after position into an icon if we haven't\n // already done so with the same prefix and iconName\n\n if (iconName && (!alreadyProcessedPseudoElement || alreadyProcessedPseudoElement.getAttribute(DATA_PREFIX) !== prefix || alreadyProcessedPseudoElement.getAttribute(DATA_ICON) !== iconIdentifier)) {\n node.setAttribute(pendingAttribute, iconIdentifier);\n\n if (alreadyProcessedPseudoElement) {\n // Delete the old one, since we're replacing it with a new one\n node.removeChild(alreadyProcessedPseudoElement);\n }\n\n var meta = blankMeta();\n var extra = meta.extra;\n extra.attributes[DATA_FA_PSEUDO_ELEMENT] = position;\n findIcon(iconName, prefix).then(function (main) {\n var abstract = makeInlineSvgAbstract(_objectSpread({}, meta, {\n icons: {\n main: main,\n mask: emptyCanonicalIcon()\n },\n prefix: prefix,\n iconName: iconIdentifier,\n extra: extra,\n watchable: true\n }));\n var element = DOCUMENT.createElement('svg');\n\n if (position === ':before') {\n node.insertBefore(element, node.firstChild);\n } else {\n node.appendChild(element);\n }\n\n element.outerHTML = abstract.map(function (a) {\n return toHtml(a);\n }).join('\\n');\n node.removeAttribute(pendingAttribute);\n resolve();\n }).catch(reject);\n } else {\n resolve();\n }\n } else {\n resolve();\n }\n });\n}\n\nfunction replace(node) {\n return picked.all([replaceForPosition(node, ':before'), replaceForPosition(node, ':after')]);\n}\n\nfunction processable(node) {\n return node.parentNode !== document.head && !~TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS.indexOf(node.tagName.toUpperCase()) && !node.getAttribute(DATA_FA_PSEUDO_ELEMENT) && (!node.parentNode || node.parentNode.tagName !== 'svg');\n}\n\nfunction searchPseudoElements (root) {\n if (!IS_DOM) return;\n return new picked(function (resolve, reject) {\n var operations = toArray(root.querySelectorAll('*')).filter(processable).map(replace);\n var end = perf.begin('searchPseudoElements');\n disableObservation();\n picked.all(operations).then(function () {\n end();\n enableObservation();\n resolve();\n }).catch(function () {\n end();\n enableObservation();\n reject();\n });\n });\n}\n\nvar baseStyles = \"svg:not(:root).svg-inline--fa {\\n overflow: visible;\\n}\\n\\n.svg-inline--fa {\\n display: inline-block;\\n font-size: inherit;\\n height: 1em;\\n overflow: visible;\\n vertical-align: -0.125em;\\n}\\n.svg-inline--fa.fa-lg {\\n vertical-align: -0.225em;\\n}\\n.svg-inline--fa.fa-w-1 {\\n width: 0.0625em;\\n}\\n.svg-inline--fa.fa-w-2 {\\n width: 0.125em;\\n}\\n.svg-inline--fa.fa-w-3 {\\n width: 0.1875em;\\n}\\n.svg-inline--fa.fa-w-4 {\\n width: 0.25em;\\n}\\n.svg-inline--fa.fa-w-5 {\\n width: 0.3125em;\\n}\\n.svg-inline--fa.fa-w-6 {\\n width: 0.375em;\\n}\\n.svg-inline--fa.fa-w-7 {\\n width: 0.4375em;\\n}\\n.svg-inline--fa.fa-w-8 {\\n width: 0.5em;\\n}\\n.svg-inline--fa.fa-w-9 {\\n width: 0.5625em;\\n}\\n.svg-inline--fa.fa-w-10 {\\n width: 0.625em;\\n}\\n.svg-inline--fa.fa-w-11 {\\n width: 0.6875em;\\n}\\n.svg-inline--fa.fa-w-12 {\\n width: 0.75em;\\n}\\n.svg-inline--fa.fa-w-13 {\\n width: 0.8125em;\\n}\\n.svg-inline--fa.fa-w-14 {\\n width: 0.875em;\\n}\\n.svg-inline--fa.fa-w-15 {\\n width: 0.9375em;\\n}\\n.svg-inline--fa.fa-w-16 {\\n width: 1em;\\n}\\n.svg-inline--fa.fa-w-17 {\\n width: 1.0625em;\\n}\\n.svg-inline--fa.fa-w-18 {\\n width: 1.125em;\\n}\\n.svg-inline--fa.fa-w-19 {\\n width: 1.1875em;\\n}\\n.svg-inline--fa.fa-w-20 {\\n width: 1.25em;\\n}\\n.svg-inline--fa.fa-pull-left {\\n margin-right: 0.3em;\\n width: auto;\\n}\\n.svg-inline--fa.fa-pull-right {\\n margin-left: 0.3em;\\n width: auto;\\n}\\n.svg-inline--fa.fa-border {\\n height: 1.5em;\\n}\\n.svg-inline--fa.fa-li {\\n width: 2em;\\n}\\n.svg-inline--fa.fa-fw {\\n width: 1.25em;\\n}\\n\\n.fa-layers svg.svg-inline--fa {\\n bottom: 0;\\n left: 0;\\n margin: auto;\\n position: absolute;\\n right: 0;\\n top: 0;\\n}\\n\\n.fa-layers {\\n display: inline-block;\\n height: 1em;\\n position: relative;\\n text-align: center;\\n vertical-align: -0.125em;\\n width: 1em;\\n}\\n.fa-layers svg.svg-inline--fa {\\n -webkit-transform-origin: center center;\\n transform-origin: center center;\\n}\\n\\n.fa-layers-counter, .fa-layers-text {\\n display: inline-block;\\n position: absolute;\\n text-align: center;\\n}\\n\\n.fa-layers-text {\\n left: 50%;\\n top: 50%;\\n -webkit-transform: translate(-50%, -50%);\\n transform: translate(-50%, -50%);\\n -webkit-transform-origin: center center;\\n transform-origin: center center;\\n}\\n\\n.fa-layers-counter {\\n background-color: #ff253a;\\n border-radius: 1em;\\n -webkit-box-sizing: border-box;\\n box-sizing: border-box;\\n color: #fff;\\n height: 1.5em;\\n line-height: 1;\\n max-width: 5em;\\n min-width: 1.5em;\\n overflow: hidden;\\n padding: 0.25em;\\n right: 0;\\n text-overflow: ellipsis;\\n top: 0;\\n -webkit-transform: scale(0.25);\\n transform: scale(0.25);\\n -webkit-transform-origin: top right;\\n transform-origin: top right;\\n}\\n\\n.fa-layers-bottom-right {\\n bottom: 0;\\n right: 0;\\n top: auto;\\n -webkit-transform: scale(0.25);\\n transform: scale(0.25);\\n -webkit-transform-origin: bottom right;\\n transform-origin: bottom right;\\n}\\n\\n.fa-layers-bottom-left {\\n bottom: 0;\\n left: 0;\\n right: auto;\\n top: auto;\\n -webkit-transform: scale(0.25);\\n transform: scale(0.25);\\n -webkit-transform-origin: bottom left;\\n transform-origin: bottom left;\\n}\\n\\n.fa-layers-top-right {\\n right: 0;\\n top: 0;\\n -webkit-transform: scale(0.25);\\n transform: scale(0.25);\\n -webkit-transform-origin: top right;\\n transform-origin: top right;\\n}\\n\\n.fa-layers-top-left {\\n left: 0;\\n right: auto;\\n top: 0;\\n -webkit-transform: scale(0.25);\\n transform: scale(0.25);\\n -webkit-transform-origin: top left;\\n transform-origin: top left;\\n}\\n\\n.fa-lg {\\n font-size: 1.3333333333em;\\n line-height: 0.75em;\\n vertical-align: -0.0667em;\\n}\\n\\n.fa-xs {\\n font-size: 0.75em;\\n}\\n\\n.fa-sm {\\n font-size: 0.875em;\\n}\\n\\n.fa-1x {\\n font-size: 1em;\\n}\\n\\n.fa-2x {\\n font-size: 2em;\\n}\\n\\n.fa-3x {\\n font-size: 3em;\\n}\\n\\n.fa-4x {\\n font-size: 4em;\\n}\\n\\n.fa-5x {\\n font-size: 5em;\\n}\\n\\n.fa-6x {\\n font-size: 6em;\\n}\\n\\n.fa-7x {\\n font-size: 7em;\\n}\\n\\n.fa-8x {\\n font-size: 8em;\\n}\\n\\n.fa-9x {\\n font-size: 9em;\\n}\\n\\n.fa-10x {\\n font-size: 10em;\\n}\\n\\n.fa-fw {\\n text-align: center;\\n width: 1.25em;\\n}\\n\\n.fa-ul {\\n list-style-type: none;\\n margin-left: 2.5em;\\n padding-left: 0;\\n}\\n.fa-ul > li {\\n position: relative;\\n}\\n\\n.fa-li {\\n left: -2em;\\n position: absolute;\\n text-align: center;\\n width: 2em;\\n line-height: inherit;\\n}\\n\\n.fa-border {\\n border: solid 0.08em #eee;\\n border-radius: 0.1em;\\n padding: 0.2em 0.25em 0.15em;\\n}\\n\\n.fa-pull-left {\\n float: left;\\n}\\n\\n.fa-pull-right {\\n float: right;\\n}\\n\\n.fa.fa-pull-left,\\n.fas.fa-pull-left,\\n.far.fa-pull-left,\\n.fal.fa-pull-left,\\n.fab.fa-pull-left {\\n margin-right: 0.3em;\\n}\\n.fa.fa-pull-right,\\n.fas.fa-pull-right,\\n.far.fa-pull-right,\\n.fal.fa-pull-right,\\n.fab.fa-pull-right {\\n margin-left: 0.3em;\\n}\\n\\n.fa-spin {\\n -webkit-animation: fa-spin 2s infinite linear;\\n animation: fa-spin 2s infinite linear;\\n}\\n\\n.fa-pulse {\\n -webkit-animation: fa-spin 1s infinite steps(8);\\n animation: fa-spin 1s infinite steps(8);\\n}\\n\\n@-webkit-keyframes fa-spin {\\n 0% {\\n -webkit-transform: rotate(0deg);\\n transform: rotate(0deg);\\n }\\n 100% {\\n -webkit-transform: rotate(360deg);\\n transform: rotate(360deg);\\n }\\n}\\n\\n@keyframes fa-spin {\\n 0% {\\n -webkit-transform: rotate(0deg);\\n transform: rotate(0deg);\\n }\\n 100% {\\n -webkit-transform: rotate(360deg);\\n transform: rotate(360deg);\\n }\\n}\\n.fa-rotate-90 {\\n -ms-filter: \\\"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)\\\";\\n -webkit-transform: rotate(90deg);\\n transform: rotate(90deg);\\n}\\n\\n.fa-rotate-180 {\\n -ms-filter: \\\"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)\\\";\\n -webkit-transform: rotate(180deg);\\n transform: rotate(180deg);\\n}\\n\\n.fa-rotate-270 {\\n -ms-filter: \\\"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)\\\";\\n -webkit-transform: rotate(270deg);\\n transform: rotate(270deg);\\n}\\n\\n.fa-flip-horizontal {\\n -ms-filter: \\\"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)\\\";\\n -webkit-transform: scale(-1, 1);\\n transform: scale(-1, 1);\\n}\\n\\n.fa-flip-vertical {\\n -ms-filter: \\\"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)\\\";\\n -webkit-transform: scale(1, -1);\\n transform: scale(1, -1);\\n}\\n\\n.fa-flip-both, .fa-flip-horizontal.fa-flip-vertical {\\n -ms-filter: \\\"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)\\\";\\n -webkit-transform: scale(-1, -1);\\n transform: scale(-1, -1);\\n}\\n\\n:root .fa-rotate-90,\\n:root .fa-rotate-180,\\n:root .fa-rotate-270,\\n:root .fa-flip-horizontal,\\n:root .fa-flip-vertical,\\n:root .fa-flip-both {\\n -webkit-filter: none;\\n filter: none;\\n}\\n\\n.fa-stack {\\n display: inline-block;\\n height: 2em;\\n position: relative;\\n width: 2.5em;\\n}\\n\\n.fa-stack-1x,\\n.fa-stack-2x {\\n bottom: 0;\\n left: 0;\\n margin: auto;\\n position: absolute;\\n right: 0;\\n top: 0;\\n}\\n\\n.svg-inline--fa.fa-stack-1x {\\n height: 1em;\\n width: 1.25em;\\n}\\n.svg-inline--fa.fa-stack-2x {\\n height: 2em;\\n width: 2.5em;\\n}\\n\\n.fa-inverse {\\n color: #fff;\\n}\\n\\n.sr-only {\\n border: 0;\\n clip: rect(0, 0, 0, 0);\\n height: 1px;\\n margin: -1px;\\n overflow: hidden;\\n padding: 0;\\n position: absolute;\\n width: 1px;\\n}\\n\\n.sr-only-focusable:active, .sr-only-focusable:focus {\\n clip: auto;\\n height: auto;\\n margin: 0;\\n overflow: visible;\\n position: static;\\n width: auto;\\n}\\n\\n.svg-inline--fa .fa-primary {\\n fill: var(--fa-primary-color, currentColor);\\n opacity: 1;\\n opacity: var(--fa-primary-opacity, 1);\\n}\\n\\n.svg-inline--fa .fa-secondary {\\n fill: var(--fa-secondary-color, currentColor);\\n opacity: 0.4;\\n opacity: var(--fa-secondary-opacity, 0.4);\\n}\\n\\n.svg-inline--fa.fa-swap-opacity .fa-primary {\\n opacity: 0.4;\\n opacity: var(--fa-secondary-opacity, 0.4);\\n}\\n\\n.svg-inline--fa.fa-swap-opacity .fa-secondary {\\n opacity: 1;\\n opacity: var(--fa-primary-opacity, 1);\\n}\\n\\n.svg-inline--fa mask .fa-primary,\\n.svg-inline--fa mask .fa-secondary {\\n fill: black;\\n}\\n\\n.fad.fa-inverse {\\n color: #fff;\\n}\";\n\nfunction css () {\n var dfp = DEFAULT_FAMILY_PREFIX;\n var drc = DEFAULT_REPLACEMENT_CLASS;\n var fp = config.familyPrefix;\n var rc = config.replacementClass;\n var s = baseStyles;\n\n if (fp !== dfp || rc !== drc) {\n var dPatt = new RegExp(\"\\\\.\".concat(dfp, \"\\\\-\"), 'g');\n var customPropPatt = new RegExp(\"\\\\--\".concat(dfp, \"\\\\-\"), 'g');\n var rPatt = new RegExp(\"\\\\.\".concat(drc), 'g');\n s = s.replace(dPatt, \".\".concat(fp, \"-\")).replace(customPropPatt, \"--\".concat(fp, \"-\")).replace(rPatt, \".\".concat(rc));\n }\n\n return s;\n}\n\nvar Library =\n/*#__PURE__*/\nfunction () {\n function Library() {\n _classCallCheck(this, Library);\n\n this.definitions = {};\n }\n\n _createClass(Library, [{\n key: \"add\",\n value: function add() {\n var _this = this;\n\n for (var _len = arguments.length, definitions = new Array(_len), _key = 0; _key < _len; _key++) {\n definitions[_key] = arguments[_key];\n }\n\n var additions = definitions.reduce(this._pullDefinitions, {});\n Object.keys(additions).forEach(function (key) {\n _this.definitions[key] = _objectSpread({}, _this.definitions[key] || {}, additions[key]);\n defineIcons(key, additions[key]);\n build();\n });\n }\n }, {\n key: \"reset\",\n value: function reset() {\n this.definitions = {};\n }\n }, {\n key: \"_pullDefinitions\",\n value: function _pullDefinitions(additions, definition) {\n var normalized = definition.prefix && definition.iconName && definition.icon ? {\n 0: definition\n } : definition;\n Object.keys(normalized).map(function (key) {\n var _normalized$key = normalized[key],\n prefix = _normalized$key.prefix,\n iconName = _normalized$key.iconName,\n icon = _normalized$key.icon;\n if (!additions[prefix]) additions[prefix] = {};\n additions[prefix][iconName] = icon;\n });\n return additions;\n }\n }]);\n\n return Library;\n}();\n\nfunction ensureCss() {\n if (config.autoAddCss && !_cssInserted) {\n insertCss(css());\n\n _cssInserted = true;\n }\n}\n\nfunction apiObject(val, abstractCreator) {\n Object.defineProperty(val, 'abstract', {\n get: abstractCreator\n });\n Object.defineProperty(val, 'html', {\n get: function get() {\n return val.abstract.map(function (a) {\n return toHtml(a);\n });\n }\n });\n Object.defineProperty(val, 'node', {\n get: function get() {\n if (!IS_DOM) return;\n var container = DOCUMENT.createElement('div');\n container.innerHTML = val.html;\n return container.children;\n }\n });\n return val;\n}\n\nfunction findIconDefinition(iconLookup) {\n var _iconLookup$prefix = iconLookup.prefix,\n prefix = _iconLookup$prefix === void 0 ? 'fa' : _iconLookup$prefix,\n iconName = iconLookup.iconName;\n if (!iconName) return;\n return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);\n}\n\nfunction resolveIcons(next) {\n return function (maybeIconDefinition) {\n var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var iconDefinition = (maybeIconDefinition || {}).icon ? maybeIconDefinition : findIconDefinition(maybeIconDefinition || {});\n var mask = params.mask;\n\n if (mask) {\n mask = (mask || {}).icon ? mask : findIconDefinition(mask || {});\n }\n\n return next(iconDefinition, _objectSpread({}, params, {\n mask: mask\n }));\n };\n}\n\nvar library = new Library();\nvar noAuto = function noAuto() {\n config.autoReplaceSvg = false;\n config.observeMutations = false;\n disconnect();\n};\nvar _cssInserted = false;\nvar dom = {\n i2svg: function i2svg() {\n var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (IS_DOM) {\n ensureCss();\n var _params$node = params.node,\n node = _params$node === void 0 ? DOCUMENT : _params$node,\n _params$callback = params.callback,\n callback = _params$callback === void 0 ? function () {} : _params$callback;\n\n if (config.searchPseudoElements) {\n searchPseudoElements(node);\n }\n\n return onTree(node, callback);\n } else {\n return picked.reject('Operation requires a DOM of some kind.');\n }\n },\n css: css,\n insertCss: function insertCss$$1() {\n if (!_cssInserted) {\n insertCss(css());\n\n _cssInserted = true;\n }\n },\n watch: function watch() {\n var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var autoReplaceSvgRoot = params.autoReplaceSvgRoot,\n observeMutationsRoot = params.observeMutationsRoot;\n\n if (config.autoReplaceSvg === false) {\n config.autoReplaceSvg = true;\n }\n\n config.observeMutations = true;\n domready(function () {\n autoReplace({\n autoReplaceSvgRoot: autoReplaceSvgRoot\n });\n observe({\n treeCallback: onTree,\n nodeCallback: onNode,\n pseudoElementsCallback: searchPseudoElements,\n observeMutationsRoot: observeMutationsRoot\n });\n });\n }\n};\nvar parse = {\n transform: function transform(transformString) {\n return parseTransformString(transformString);\n }\n};\nvar icon = resolveIcons(function (iconDefinition) {\n var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var _params$transform = params.transform,\n transform = _params$transform === void 0 ? meaninglessTransform : _params$transform,\n _params$symbol = params.symbol,\n symbol = _params$symbol === void 0 ? false : _params$symbol,\n _params$mask = params.mask,\n mask = _params$mask === void 0 ? null : _params$mask,\n _params$title = params.title,\n title = _params$title === void 0 ? null : _params$title,\n _params$classes = params.classes,\n classes = _params$classes === void 0 ? [] : _params$classes,\n _params$attributes = params.attributes,\n attributes = _params$attributes === void 0 ? {} : _params$attributes,\n _params$styles = params.styles,\n styles = _params$styles === void 0 ? {} : _params$styles;\n if (!iconDefinition) return;\n var prefix = iconDefinition.prefix,\n iconName = iconDefinition.iconName,\n icon = iconDefinition.icon;\n return apiObject(_objectSpread({\n type: 'icon'\n }, iconDefinition), function () {\n ensureCss();\n\n if (config.autoA11y) {\n if (title) {\n attributes['aria-labelledby'] = \"\".concat(config.replacementClass, \"-title-\").concat(nextUniqueId());\n } else {\n attributes['aria-hidden'] = 'true';\n attributes['focusable'] = 'false';\n }\n }\n\n return makeInlineSvgAbstract({\n icons: {\n main: asFoundIcon(icon),\n mask: mask ? asFoundIcon(mask.icon) : {\n found: false,\n width: null,\n height: null,\n icon: {}\n }\n },\n prefix: prefix,\n iconName: iconName,\n transform: _objectSpread({}, meaninglessTransform, transform),\n symbol: symbol,\n title: title,\n extra: {\n attributes: attributes,\n styles: styles,\n classes: classes\n }\n });\n });\n});\nvar text = function text(content) {\n var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var _params$transform2 = params.transform,\n transform = _params$transform2 === void 0 ? meaninglessTransform : _params$transform2,\n _params$title2 = params.title,\n title = _params$title2 === void 0 ? null : _params$title2,\n _params$classes2 = params.classes,\n classes = _params$classes2 === void 0 ? [] : _params$classes2,\n _params$attributes2 = params.attributes,\n attributes = _params$attributes2 === void 0 ? {} : _params$attributes2,\n _params$styles2 = params.styles,\n styles = _params$styles2 === void 0 ? {} : _params$styles2;\n return apiObject({\n type: 'text',\n content: content\n }, function () {\n ensureCss();\n return makeLayersTextAbstract({\n content: content,\n transform: _objectSpread({}, meaninglessTransform, transform),\n title: title,\n extra: {\n attributes: attributes,\n styles: styles,\n classes: [\"\".concat(config.familyPrefix, \"-layers-text\")].concat(_toConsumableArray(classes))\n }\n });\n });\n};\nvar counter = function counter(content) {\n var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var _params$title3 = params.title,\n title = _params$title3 === void 0 ? null : _params$title3,\n _params$classes3 = params.classes,\n classes = _params$classes3 === void 0 ? [] : _params$classes3,\n _params$attributes3 = params.attributes,\n attributes = _params$attributes3 === void 0 ? {} : _params$attributes3,\n _params$styles3 = params.styles,\n styles = _params$styles3 === void 0 ? {} : _params$styles3;\n return apiObject({\n type: 'counter',\n content: content\n }, function () {\n ensureCss();\n return makeLayersCounterAbstract({\n content: content.toString(),\n title: title,\n extra: {\n attributes: attributes,\n styles: styles,\n classes: [\"\".concat(config.familyPrefix, \"-layers-counter\")].concat(_toConsumableArray(classes))\n }\n });\n });\n};\nvar layer = function layer(assembler) {\n var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var _params$classes4 = params.classes,\n classes = _params$classes4 === void 0 ? [] : _params$classes4;\n return apiObject({\n type: 'layer'\n }, function () {\n ensureCss();\n var children = [];\n assembler(function (args) {\n Array.isArray(args) ? args.map(function (a) {\n children = children.concat(a.abstract);\n }) : children = children.concat(args.abstract);\n });\n return [{\n tag: 'span',\n attributes: {\n class: [\"\".concat(config.familyPrefix, \"-layers\")].concat(_toConsumableArray(classes)).join(' ')\n },\n children: children\n }];\n });\n};\nvar api = {\n noAuto: noAuto,\n config: config,\n dom: dom,\n library: library,\n parse: parse,\n findIconDefinition: findIconDefinition,\n icon: icon,\n text: text,\n counter: counter,\n layer: layer,\n toHtml: toHtml\n};\n\nvar autoReplace = function autoReplace() {\n var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var _params$autoReplaceSv = params.autoReplaceSvgRoot,\n autoReplaceSvgRoot = _params$autoReplaceSv === void 0 ? DOCUMENT : _params$autoReplaceSv;\n if ((Object.keys(namespace.styles).length > 0 || config.autoFetchSvg) && IS_DOM && config.autoReplaceSvg) api.dom.i2svg({\n node: autoReplaceSvgRoot\n });\n};\n\nexport { icon, noAuto, config, toHtml, layer, text, counter, library, dom, parse, findIconDefinition };\n","import { parse, icon } from '@fortawesome/fontawesome-svg-core';\nimport PropTypes from 'prop-types';\nimport React from 'react';\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n}\n\nfunction _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n}\n\n// Get CSS class list from a props object\nfunction classList(props) {\n var _classes;\n\n var spin = props.spin,\n pulse = props.pulse,\n fixedWidth = props.fixedWidth,\n inverse = props.inverse,\n border = props.border,\n listItem = props.listItem,\n flip = props.flip,\n size = props.size,\n rotation = props.rotation,\n pull = props.pull; // map of CSS class names to properties\n\n var classes = (_classes = {\n 'fa-spin': spin,\n 'fa-pulse': pulse,\n 'fa-fw': fixedWidth,\n 'fa-inverse': inverse,\n 'fa-border': border,\n 'fa-li': listItem,\n 'fa-flip-horizontal': flip === 'horizontal' || flip === 'both',\n 'fa-flip-vertical': flip === 'vertical' || flip === 'both'\n }, _defineProperty(_classes, \"fa-\".concat(size), typeof size !== 'undefined' && size !== null), _defineProperty(_classes, \"fa-rotate-\".concat(rotation), typeof rotation !== 'undefined' && rotation !== null), _defineProperty(_classes, \"fa-pull-\".concat(pull), typeof pull !== 'undefined' && pull !== null), _defineProperty(_classes, 'fa-swap-opacity', props.swapOpacity), _classes); // map over all the keys in the classes object\n // return an array of the keys where the value for the key is not null\n\n return Object.keys(classes).map(function (key) {\n return classes[key] ? key : null;\n }).filter(function (key) {\n return key;\n });\n}\n\n// Camelize taken from humps\n// humps is copyright © 2012+ Dom Christie\n// Released under the MIT license.\n// Performant way to determine if object coerces to a number\nfunction _isNumerical(obj) {\n obj = obj - 0; // eslint-disable-next-line no-self-compare\n\n return obj === obj;\n}\n\nfunction camelize(string) {\n if (_isNumerical(string)) {\n return string;\n } // eslint-disable-next-line no-useless-escape\n\n\n string = string.replace(/[\\-_\\s]+(.)?/g, function (match, chr) {\n return chr ? chr.toUpperCase() : '';\n }); // Ensure 1st char is always lowercase\n\n return string.substr(0, 1).toLowerCase() + string.substr(1);\n}\n\nfunction capitalize(val) {\n return val.charAt(0).toUpperCase() + val.slice(1);\n}\n\nfunction styleToObject(style) {\n return style.split(';').map(function (s) {\n return s.trim();\n }).filter(function (s) {\n return s;\n }).reduce(function (acc, pair) {\n var i = pair.indexOf(':');\n var prop = camelize(pair.slice(0, i));\n var value = pair.slice(i + 1).trim();\n prop.startsWith('webkit') ? acc[capitalize(prop)] = value : acc[prop] = value;\n return acc;\n }, {});\n}\n\nfunction convert(createElement, element) {\n var extraProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n if (typeof element === 'string') {\n return element;\n }\n\n var children = (element.children || []).map(function (child) {\n return convert(createElement, child);\n });\n /* eslint-disable dot-notation */\n\n var mixins = Object.keys(element.attributes || {}).reduce(function (acc, key) {\n var val = element.attributes[key];\n\n switch (key) {\n case 'class':\n acc.attrs['className'] = val;\n delete element.attributes['class'];\n break;\n\n case 'style':\n acc.attrs['style'] = styleToObject(val);\n break;\n\n default:\n if (key.indexOf('aria-') === 0 || key.indexOf('data-') === 0) {\n acc.attrs[key.toLowerCase()] = val;\n } else {\n acc.attrs[camelize(key)] = val;\n }\n\n }\n\n return acc;\n }, {\n attrs: {}\n });\n\n var _extraProps$style = extraProps.style,\n existingStyle = _extraProps$style === void 0 ? {} : _extraProps$style,\n remaining = _objectWithoutProperties(extraProps, [\"style\"]);\n\n mixins.attrs['style'] = _objectSpread2({}, mixins.attrs['style'], {}, existingStyle);\n /* eslint-enable */\n\n return createElement.apply(void 0, [element.tag, _objectSpread2({}, mixins.attrs, {}, remaining)].concat(_toConsumableArray(children)));\n}\n\nvar PRODUCTION = false;\n\ntry {\n PRODUCTION = process.env.NODE_ENV === 'production';\n} catch (e) {}\n\nfunction log () {\n if (!PRODUCTION && console && typeof console.error === 'function') {\n var _console;\n\n (_console = console).error.apply(_console, arguments);\n }\n}\n\n// Normalize icon arguments\nfunction normalizeIconArgs(icon) {\n // if the icon is null, there's nothing to do\n if (icon === null) {\n return null;\n } // if the icon is an object and has a prefix and an icon name, return it\n\n\n if (_typeof(icon) === 'object' && icon.prefix && icon.iconName) {\n return icon;\n } // if it's an array with length of two\n\n\n if (Array.isArray(icon) && icon.length === 2) {\n // use the first item as prefix, second as icon name\n return {\n prefix: icon[0],\n iconName: icon[1]\n };\n } // if it's a string, use it as the icon name\n\n\n if (typeof icon === 'string') {\n return {\n prefix: 'fas',\n iconName: icon\n };\n }\n}\n\n// creates an object with a key of key\n// and a value of value\n// if certain conditions are met\nfunction objectWithKey(key, value) {\n // if the value is a non-empty array\n // or it's not an array but it is truthy\n // then create the object with the key and the value\n // if not, return an empty array\n return Array.isArray(value) && value.length > 0 || !Array.isArray(value) && value ? _defineProperty({}, key, value) : {};\n}\n\nfunction FontAwesomeIcon(props) {\n var iconArgs = props.icon,\n maskArgs = props.mask,\n symbol = props.symbol,\n className = props.className,\n title = props.title;\n var iconLookup = normalizeIconArgs(iconArgs);\n var classes = objectWithKey('classes', [].concat(_toConsumableArray(classList(props)), _toConsumableArray(className.split(' '))));\n var transform = objectWithKey('transform', typeof props.transform === 'string' ? parse.transform(props.transform) : props.transform);\n var mask = objectWithKey('mask', normalizeIconArgs(maskArgs));\n var renderedIcon = icon(iconLookup, _objectSpread2({}, classes, {}, transform, {}, mask, {\n symbol: symbol,\n title: title\n }));\n\n if (!renderedIcon) {\n log('Could not find icon', iconLookup);\n return null;\n }\n\n var abstract = renderedIcon.abstract;\n var extraProps = {};\n Object.keys(props).forEach(function (key) {\n // eslint-disable-next-line no-prototype-builtins\n if (!FontAwesomeIcon.defaultProps.hasOwnProperty(key)) {\n extraProps[key] = props[key];\n }\n });\n return convertCurry(abstract[0], extraProps);\n}\nFontAwesomeIcon.displayName = 'FontAwesomeIcon';\nFontAwesomeIcon.propTypes = {\n border: PropTypes.bool,\n className: PropTypes.string,\n mask: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string]),\n fixedWidth: PropTypes.bool,\n inverse: PropTypes.bool,\n flip: PropTypes.oneOf(['horizontal', 'vertical', 'both']),\n icon: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string]),\n listItem: PropTypes.bool,\n pull: PropTypes.oneOf(['right', 'left']),\n pulse: PropTypes.bool,\n rotation: PropTypes.oneOf([90, 180, 270]),\n size: PropTypes.oneOf(['lg', 'xs', 'sm', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x']),\n spin: PropTypes.bool,\n symbol: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n title: PropTypes.string,\n transform: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n swapOpacity: PropTypes.bool\n};\nFontAwesomeIcon.defaultProps = {\n border: false,\n className: '',\n mask: null,\n fixedWidth: false,\n inverse: false,\n flip: null,\n icon: null,\n listItem: false,\n pull: null,\n pulse: false,\n rotation: null,\n size: null,\n spin: false,\n symbol: false,\n title: '',\n transform: null,\n swapOpacity: false\n};\nvar convertCurry = convert.bind(null, React.createElement);\n\nexport { FontAwesomeIcon };\n","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-download';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f56d';\nvar svgPathData = 'M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm76.45 211.36l-96.42 95.7c-6.65 6.61-17.39 6.61-24.04 0l-96.42-95.7C73.42 337.29 80.54 320 94.82 320H160v-80c0-8.84 7.16-16 16-16h32c8.84 0 16 7.16 16 16v80h65.18c14.28 0 21.4 17.29 11.27 27.36zM377 105L279.1 7c-4.5-4.5-10.6-7-17-7H256v128h128v-6.1c0-6.3-2.5-12.4-7-16.9z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFileDownload = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-archive';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1c6';\nvar svgPathData = 'M377 105L279.1 7c-4.5-4.5-10.6-7-17-7H256v128h128v-6.1c0-6.3-2.5-12.4-7-16.9zM128.4 336c-17.9 0-32.4 12.1-32.4 27 0 15 14.6 27 32.5 27s32.4-12.1 32.4-27-14.6-27-32.5-27zM224 136V0h-63.6v32h-32V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zM95.9 32h32v32h-32zm32.3 384c-33.2 0-58-30.4-51.4-62.9L96.4 256v-32h32v-32h-32v-32h32v-32h-32V96h32V64h32v32h-32v32h32v32h-32v32h32v32h-32v32h22.1c5.7 0 10.7 4.1 11.8 9.7l17.3 87.7c6.4 32.4-18.4 62.6-51.4 62.6z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFileArchive = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-audio';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1c7';\nvar svgPathData = 'M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm-64 268c0 10.7-12.9 16-20.5 8.5L104 376H76c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h28l35.5-36.5c7.6-7.6 20.5-2.2 20.5 8.5v136zm33.2-47.6c9.1-9.3 9.1-24.1 0-33.4-22.1-22.8 12.2-56.2 34.4-33.5 27.2 27.9 27.2 72.4 0 100.4-21.8 22.3-56.9-10.4-34.4-33.5zm86-117.1c54.4 55.9 54.4 144.8 0 200.8-21.8 22.4-57-10.3-34.4-33.5 36.2-37.2 36.3-96.5 0-133.8-22.1-22.8 12.3-56.3 34.4-33.5zM384 121.9v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFileAudio = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'check-circle';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f058';\nvar svgPathData = 'M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCheckCircle = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-excel';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1c3';\nvar svgPathData = 'M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm60.1 106.5L224 336l60.1 93.5c5.1 8-.6 18.5-10.1 18.5h-34.9c-4.4 0-8.5-2.4-10.6-6.3C208.9 405.5 192 373 192 373c-6.4 14.8-10 20-36.6 68.8-2.1 3.9-6.1 6.3-10.5 6.3H110c-9.5 0-15.2-10.5-10.1-18.5l60.3-93.5-60.3-93.5c-5.2-8 .6-18.5 10.1-18.5h34.8c4.4 0 8.5 2.4 10.6 6.3 26.1 48.8 20 33.6 36.6 68.5 0 0 6.1-11.7 36.6-68.5 2.1-3.9 6.2-6.3 10.6-6.3H274c9.5-.1 15.2 10.4 10.1 18.4zM384 121.9v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFileExcel = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-image';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1c5';\nvar svgPathData = 'M384 121.941V128H256V0h6.059a24 24 0 0 1 16.97 7.029l97.941 97.941a24.002 24.002 0 0 1 7.03 16.971zM248 160c-13.2 0-24-10.8-24-24V0H24C10.745 0 0 10.745 0 24v464c0 13.255 10.745 24 24 24h336c13.255 0 24-10.745 24-24V160H248zm-135.455 16c26.51 0 48 21.49 48 48s-21.49 48-48 48-48-21.49-48-48 21.491-48 48-48zm208 240h-256l.485-48.485L104.545 328c4.686-4.686 11.799-4.201 16.485.485L160.545 368 264.06 264.485c4.686-4.686 12.284-4.686 16.971 0L320.545 304v112z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFileImage = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-pdf';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1c1';\nvar svgPathData = 'M181.9 256.1c-5-16-4.9-46.9-2-46.9 8.4 0 7.6 36.9 2 46.9zm-1.7 47.2c-7.7 20.2-17.3 43.3-28.4 62.7 18.3-7 39-17.2 62.9-21.9-12.7-9.6-24.9-23.4-34.5-40.8zM86.1 428.1c0 .8 13.2-5.4 34.9-40.2-6.7 6.3-29.1 24.5-34.9 40.2zM248 160h136v328c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V24C0 10.7 10.7 0 24 0h200v136c0 13.2 10.8 24 24 24zm-8 171.8c-20-12.2-33.3-29-42.7-53.8 4.5-18.5 11.6-46.6 6.2-64.2-4.7-29.4-42.4-26.5-47.8-6.8-5 18.3-.4 44.1 8.1 77-11.6 27.6-28.7 64.6-40.8 85.8-.1 0-.1.1-.2.1-27.1 13.9-73.6 44.5-54.5 68 5.6 6.9 16 10 21.5 10 17.9 0 35.7-18 61.1-61.8 25.8-8.5 54.1-19.1 79-23.2 21.7 11.8 47.1 19.5 64 19.5 29.2 0 31.2-32 19.7-43.4-13.9-13.6-54.3-9.7-73.6-7.2zM377 105L279 7c-4.5-4.5-10.6-7-17-7h-6v128h128v-6.1c0-6.3-2.5-12.4-7-16.9zm-74.1 255.3c4.1-2.7-2.5-11.9-42.8-9 37.1 15.8 42.8 9 42.8 9z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFilePdf = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'smile';\nvar width = 496;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f118';\nvar svgPathData = 'M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm80 168c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm-160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm194.8 170.2C334.3 380.4 292.5 400 248 400s-86.3-19.6-114.8-53.8c-13.6-16.3 11-36.7 24.6-20.5 22.4 26.9 55.2 42.2 90.2 42.2s67.8-15.4 90.2-42.2c13.4-16.2 38.1 4.2 24.6 20.5z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faSmile = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-word';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1c2';\nvar svgPathData = 'M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm57.1 120H305c7.7 0 13.4 7.1 11.7 14.7l-38 168c-1.2 5.5-6.1 9.3-11.7 9.3h-38c-5.5 0-10.3-3.8-11.6-9.1-25.8-103.5-20.8-81.2-25.6-110.5h-.5c-1.1 14.3-2.4 17.4-25.6 110.5-1.3 5.3-6.1 9.1-11.6 9.1H117c-5.6 0-10.5-3.9-11.7-9.4l-37.8-168c-1.7-7.5 4-14.6 11.7-14.6h24.5c5.7 0 10.7 4 11.8 9.7 15.6 78 20.1 109.5 21 122.2 1.6-10.2 7.3-32.7 29.4-122.7 1.3-5.4 6.1-9.1 11.7-9.1h29.1c5.6 0 10.4 3.8 11.7 9.2 24 100.4 28.8 124 29.6 129.4-.2-11.2-2.6-17.8 21.6-129.2 1-5.6 5.9-9.5 11.5-9.5zM384 121.9v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFileWord = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-video';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1c8';\nvar svgPathData = 'M384 121.941V128H256V0h6.059c6.365 0 12.47 2.529 16.971 7.029l97.941 97.941A24.005 24.005 0 0 1 384 121.941zM224 136V0H24C10.745 0 0 10.745 0 24v464c0 13.255 10.745 24 24 24h336c13.255 0 24-10.745 24-24V160H248c-13.2 0-24-10.8-24-24zm96 144.016v111.963c0 21.445-25.943 31.998-40.971 16.971L224 353.941V392c0 13.255-10.745 24-24 24H88c-13.255 0-24-10.745-24-24V280c0-13.255 10.745-24 24-24h112c13.255 0 24 10.745 24 24v38.059l55.029-55.013c15.011-15.01 40.971-4.491 40.971 16.97z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFileVideo = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-powerpoint';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1c4';\nvar svgPathData = 'M193.7 271.2c8.8 0 15.5 2.7 20.3 8.1 9.6 10.9 9.8 32.7-.2 44.1-4.9 5.6-11.9 8.5-21.1 8.5h-26.9v-60.7h27.9zM377 105L279 7c-4.5-4.5-10.6-7-17-7h-6v128h128v-6.1c0-6.3-2.5-12.4-7-16.9zm-153 31V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm53 165.2c0 90.3-88.8 77.6-111.1 77.6V436c0 6.6-5.4 12-12 12h-30.8c-6.6 0-12-5.4-12-12V236.2c0-6.6 5.4-12 12-12h81c44.5 0 72.9 32.8 72.9 77z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFilePowerpoint = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'check';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f00c';\nvar svgPathData = 'M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCheck = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'cut';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f0c4';\nvar svgPathData = 'M278.06 256L444.48 89.57c4.69-4.69 4.69-12.29 0-16.97-32.8-32.8-85.99-32.8-118.79 0L210.18 188.12l-24.86-24.86c4.31-10.92 6.68-22.81 6.68-35.26 0-53.02-42.98-96-96-96S0 74.98 0 128s42.98 96 96 96c4.54 0 8.99-.32 13.36-.93L142.29 256l-32.93 32.93c-4.37-.61-8.83-.93-13.36-.93-53.02 0-96 42.98-96 96s42.98 96 96 96 96-42.98 96-96c0-12.45-2.37-24.34-6.68-35.26l24.86-24.86L325.69 439.4c32.8 32.8 85.99 32.8 118.79 0 4.69-4.68 4.69-12.28 0-16.97L278.06 256zM96 160c-17.64 0-32-14.36-32-32s14.36-32 32-32 32 14.36 32 32-14.36 32-32 32zm0 256c-17.64 0-32-14.36-32-32s14.36-32 32-32 32 14.36 32 32-14.36 32-32 32z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCut = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'cog';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f013';\nvar svgPathData = 'M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCog = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'copy';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f0c5';\nvar svgPathData = 'M320 448v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V120c0-13.255 10.745-24 24-24h72v296c0 30.879 25.121 56 56 56h168zm0-344V0H152c-13.255 0-24 10.745-24 24v368c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24V128H344c-13.2 0-24-10.8-24-24zm120.971-31.029L375.029 7.029A24 24 0 0 0 358.059 0H352v96h96v-6.059a24 24 0 0 0-7.029-16.97z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCopy = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'file-alt';\nvar width = 384;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f15c';\nvar svgPathData = 'M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm64 236c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12v8zm0-64c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12v8zm0-72v8c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12zm96-114.1v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFileAlt = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'images';\nvar width = 576;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f302';\nvar svgPathData = 'M480 416v16c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V176c0-26.51 21.49-48 48-48h16v208c0 44.112 35.888 80 80 80h336zm96-80V80c0-26.51-21.49-48-48-48H144c-26.51 0-48 21.49-48 48v256c0 26.51 21.49 48 48 48h384c26.51 0 48-21.49 48-48zM256 128c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-96 144l55.515-55.515c4.686-4.686 12.284-4.686 16.971 0L272 256l135.515-135.515c4.686-4.686 12.284-4.686 16.971 0L512 208v112H160v-48z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faImages = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'photo-video';\nvar width = 640;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f87c';\nvar svgPathData = 'M608 0H160a32 32 0 0 0-32 32v96h160V64h192v320h128a32 32 0 0 0 32-32V32a32 32 0 0 0-32-32zM232 103a9 9 0 0 1-9 9h-30a9 9 0 0 1-9-9V73a9 9 0 0 1 9-9h30a9 9 0 0 1 9 9zm352 208a9 9 0 0 1-9 9h-30a9 9 0 0 1-9-9v-30a9 9 0 0 1 9-9h30a9 9 0 0 1 9 9zm0-104a9 9 0 0 1-9 9h-30a9 9 0 0 1-9-9v-30a9 9 0 0 1 9-9h30a9 9 0 0 1 9 9zm0-104a9 9 0 0 1-9 9h-30a9 9 0 0 1-9-9V73a9 9 0 0 1 9-9h30a9 9 0 0 1 9 9zm-168 57H32a32 32 0 0 0-32 32v288a32 32 0 0 0 32 32h384a32 32 0 0 0 32-32V192a32 32 0 0 0-32-32zM96 224a32 32 0 1 1-32 32 32 32 0 0 1 32-32zm288 224H64v-32l64-64 32 32 128-128 96 96z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faPhotoVideo = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'link';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f0c1';\nvar svgPathData = 'M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faLink = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'minus';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f068';\nvar svgPathData = 'M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faMinus = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'paste';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f0ea';\nvar svgPathData = 'M128 184c0-30.879 25.122-56 56-56h136V56c0-13.255-10.745-24-24-24h-80.61C204.306 12.89 183.637 0 160 0s-44.306 12.89-55.39 32H24C10.745 32 0 42.745 0 56v336c0 13.255 10.745 24 24 24h104V184zm32-144c13.255 0 24 10.745 24 24s-10.745 24-24 24-24-10.745-24-24 10.745-24 24-24zm184 248h104v200c0 13.255-10.745 24-24 24H184c-13.255 0-24-10.745-24-24V184c0-13.255 10.745-24 24-24h136v104c0 13.2 10.8 24 24 24zm104-38.059V256h-96v-96h6.059a24 24 0 0 1 16.97 7.029l65.941 65.941a24.002 24.002 0 0 1 7.03 16.971z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faPaste = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'pencil-alt';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f303';\nvar svgPathData = 'M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faPencilAlt = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'plus';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f067';\nvar svgPathData = 'M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faPlus = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'spinner';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f110';\nvar svgPathData = 'M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faSpinner = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'table';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f0ce';\nvar svgPathData = 'M464 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48zM224 416H64v-96h160v96zm0-160H64v-96h160v96zm224 160H288v-96h160v96zm0-160H288v-96h160v96z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faTable = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'times';\nvar width = 352;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f00d';\nvar svgPathData = 'M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faTimes = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'trash-alt';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f2ed';\nvar svgPathData = 'M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faTrashAlt = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'film';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f008';\nvar svgPathData = 'M488 64h-8v20c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12V64H96v20c0 6.6-5.4 12-12 12H44c-6.6 0-12-5.4-12-12V64h-8C10.7 64 0 74.7 0 88v336c0 13.3 10.7 24 24 24h8v-20c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v20h320v-20c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v20h8c13.3 0 24-10.7 24-24V88c0-13.3-10.7-24-24-24zM96 372c0 6.6-5.4 12-12 12H44c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm0-96c0 6.6-5.4 12-12 12H44c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm0-96c0 6.6-5.4 12-12 12H44c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm272 208c0 6.6-5.4 12-12 12H156c-6.6 0-12-5.4-12-12v-96c0-6.6 5.4-12 12-12h200c6.6 0 12 5.4 12 12v96zm0-168c0 6.6-5.4 12-12 12H156c-6.6 0-12-5.4-12-12v-96c0-6.6 5.4-12 12-12h200c6.6 0 12 5.4 12 12v96zm112 152c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm0-96c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm0-96c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faFilm = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'caret-square-up';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f151';\nvar svgPathData = 'M0 432V80c0-26.51 21.49-48 48-48h352c26.51 0 48 21.49 48 48v352c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48zm355.515-140.485l-123.03-123.03c-4.686-4.686-12.284-4.686-16.971 0L92.485 291.515c-7.56 7.56-2.206 20.485 8.485 20.485h246.059c10.691 0 16.045-12.926 8.486-20.485z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCaretSquareUp = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'caret-square-down';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f150';\nvar svgPathData = 'M448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zM92.5 220.5l123 123c4.7 4.7 12.3 4.7 17 0l123-123c7.6-7.6 2.2-20.5-8.5-20.5H101c-10.7 0-16.1 12.9-8.5 20.5z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCaretSquareDown = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'sort-up';\nvar width = 320;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f0de';\nvar svgPathData = 'M279 224H41c-21.4 0-32.1-25.9-17-41L143 64c9.4-9.4 24.6-9.4 33.9 0l119 119c15.2 15.1 4.5 41-16.9 41z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faSortUp = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'sort-down';\nvar width = 320;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f0dd';\nvar svgPathData = 'M41 288h238c21.4 0 32.1 25.9 17 41L177 448c-9.4 9.4-24.6 9.4-33.9 0L24 329c-15.1-15.1-4.4-41 17-41z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faSortDown = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'toolbox';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f552';\nvar svgPathData = 'M502.63 214.63l-45.25-45.25c-6-6-14.14-9.37-22.63-9.37H384V80c0-26.51-21.49-48-48-48H176c-26.51 0-48 21.49-48 48v80H77.25c-8.49 0-16.62 3.37-22.63 9.37L9.37 214.63c-6 6-9.37 14.14-9.37 22.63V320h128v-16c0-8.84 7.16-16 16-16h32c8.84 0 16 7.16 16 16v16h128v-16c0-8.84 7.16-16 16-16h32c8.84 0 16 7.16 16 16v16h128v-82.75c0-8.48-3.37-16.62-9.37-22.62zM320 160H192V96h128v64zm64 208c0 8.84-7.16 16-16 16h-32c-8.84 0-16-7.16-16-16v-16H192v16c0 8.84-7.16 16-16 16h-32c-8.84 0-16-7.16-16-16v-16H0v96c0 17.67 14.33 32 32 32h448c17.67 0 32-14.33 32-32v-96H384v16z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faToolbox = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'ellipsis-h';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f141';\nvar svgPathData = 'M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faEllipsisH = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'search';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f002';\nvar svgPathData = 'M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faSearch = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'cloud-upload-alt';\nvar width = 640;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f382';\nvar svgPathData = 'M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4zM393.4 288H328v112c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V288h-65.4c-14.3 0-21.4-17.2-11.3-27.3l105.4-105.4c6.2-6.2 16.4-6.2 22.6 0l105.4 105.4c10.1 10.1 2.9 27.3-11.3 27.3z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCloudUploadAlt = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'question-circle';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f059';\nvar svgPathData = 'M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zM262.655 90c-54.497 0-89.255 22.957-116.549 63.758-3.536 5.286-2.353 12.415 2.715 16.258l34.699 26.31c5.205 3.947 12.621 3.008 16.665-2.122 17.864-22.658 30.113-35.797 57.303-35.797 20.429 0 45.698 13.148 45.698 32.958 0 14.976-12.363 22.667-32.534 33.976C247.128 238.528 216 254.941 216 296v4c0 6.627 5.373 12 12 12h56c6.627 0 12-5.373 12-12v-1.333c0-28.462 83.186-29.647 83.186-106.667 0-58.002-60.165-102-116.531-102zM256 338c-25.365 0-46 20.635-46 46 0 25.364 20.635 46 46 46s46-20.636 46-46c0-25.365-20.635-46-46-46z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faQuestionCircle = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'anchor';\nvar width = 576;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f13d';\nvar svgPathData = 'M12.971 352h32.394C67.172 454.735 181.944 512 288 512c106.229 0 220.853-57.38 242.635-160h32.394c10.691 0 16.045-12.926 8.485-20.485l-67.029-67.029c-4.686-4.686-12.284-4.686-16.971 0l-67.029 67.029c-7.56 7.56-2.206 20.485 8.485 20.485h35.146c-20.29 54.317-84.963 86.588-144.117 94.015V256h52c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12h-52v-5.47c37.281-13.178 63.995-48.725 64-90.518C384.005 43.772 341.605.738 289.37.01 235.723-.739 192 42.525 192 96c0 41.798 26.716 77.35 64 90.53V192h-52c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h52v190.015c-58.936-7.399-123.82-39.679-144.117-94.015h35.146c10.691 0 16.045-12.926 8.485-20.485l-67.029-67.029c-4.686-4.686-12.284-4.686-16.971 0L4.485 331.515C-3.074 339.074 2.28 352 12.971 352zM288 64c17.645 0 32 14.355 32 32s-14.355 32-32 32-32-14.355-32-32 14.355-32 32-32z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faAnchor = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'quote-right';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f10e';\nvar svgPathData = 'M464 32H336c-26.5 0-48 21.5-48 48v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48zm-288 0H48C21.5 32 0 53.5 0 80v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faQuoteRight = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'equals';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f52c';\nvar svgPathData = 'M416 304H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32zm0-192H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faEquals = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'cubes';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1b3';\nvar svgPathData = 'M488.6 250.2L392 214V105.5c0-15-9.3-28.4-23.4-33.7l-100-37.5c-8.1-3.1-17.1-3.1-25.3 0l-100 37.5c-14.1 5.3-23.4 18.7-23.4 33.7V214l-96.6 36.2C9.3 255.5 0 268.9 0 283.9V394c0 13.6 7.7 26.1 19.9 32.2l100 50c10.1 5.1 22.1 5.1 32.2 0l103.9-52 103.9 52c10.1 5.1 22.1 5.1 32.2 0l100-50c12.2-6.1 19.9-18.6 19.9-32.2V283.9c0-15-9.3-28.4-23.4-33.7zM358 214.8l-85 31.9v-68.2l85-37v73.3zM154 104.1l102-38.2 102 38.2v.6l-102 41.4-102-41.4v-.6zm84 291.1l-85 42.5v-79.1l85-38.8v75.4zm0-112l-102 41.4-102-41.4v-.6l102-38.2 102 38.2v.6zm240 112l-85 42.5v-79.1l85-38.8v75.4zm0-112l-102 41.4-102-41.4v-.6l102-38.2 102 38.2v.6z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCubes = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'code';\nvar width = 640;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f121';\nvar svgPathData = 'M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCode = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'lightbulb';\nvar width = 352;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f0eb';\nvar svgPathData = 'M96.06 454.35c.01 6.29 1.87 12.45 5.36 17.69l17.09 25.69a31.99 31.99 0 0 0 26.64 14.28h61.71a31.99 31.99 0 0 0 26.64-14.28l17.09-25.69a31.989 31.989 0 0 0 5.36-17.69l.04-38.35H96.01l.05 38.35zM0 176c0 44.37 16.45 84.85 43.56 115.78 16.52 18.85 42.36 58.23 52.21 91.45.04.26.07.52.11.78h160.24c.04-.26.07-.51.11-.78 9.85-33.22 35.69-72.6 52.21-91.45C335.55 260.85 352 220.37 352 176 352 78.61 272.91-.3 175.45 0 73.44.31 0 82.97 0 176zm176-80c-44.11 0-80 35.89-80 80 0 8.84-7.16 16-16 16s-16-7.16-16-16c0-61.76 50.24-112 112-112 8.84 0 16 7.16 16 16s-7.16 16-16 16z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faLightbulb = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'keyboard';\nvar width = 576;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f11c';\nvar svgPathData = 'M528 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h480c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM128 180v-40c0-6.627-5.373-12-12-12H76c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12H76c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm288 0v-40c0-6.627-5.373-12-12-12H172c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h232c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faKeyboard = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'dot-circle';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f192';\nvar svgPathData = 'M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm80 248c0 44.112-35.888 80-80 80s-80-35.888-80-80 35.888-80 80-80 80 35.888 80 80z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faDotCircle = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'check-square';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f14a';\nvar svgPathData = 'M400 480H48c-26.51 0-48-21.49-48-48V80c0-26.51 21.49-48 48-48h352c26.51 0 48 21.49 48 48v352c0 26.51-21.49 48-48 48zm-204.686-98.059l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.248-16.379-6.249-22.628 0L184 302.745l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.25 16.379 6.25 22.628.001z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faCheckSquare = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'paragraph';\nvar width = 448;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1dd';\nvar svgPathData = 'M448 48v32a16 16 0 0 1-16 16h-48v368a16 16 0 0 1-16 16h-32a16 16 0 0 1-16-16V96h-32v368a16 16 0 0 1-16 16h-32a16 16 0 0 1-16-16V352h-32a160 160 0 0 1 0-320h240a16 16 0 0 1 16 16z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faParagraph = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'redo-alt';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f2f9';\nvar svgPathData = 'M256.455 8c66.269.119 126.437 26.233 170.859 68.685l35.715-35.715C478.149 25.851 504 36.559 504 57.941V192c0 13.255-10.745 24-24 24H345.941c-21.382 0-32.09-25.851-16.971-40.971l41.75-41.75c-30.864-28.899-70.801-44.907-113.23-45.273-92.398-.798-170.283 73.977-169.484 169.442C88.764 348.009 162.184 424 256 424c41.127 0 79.997-14.678 110.629-41.556 4.743-4.161 11.906-3.908 16.368.553l39.662 39.662c4.872 4.872 4.631 12.815-.482 17.433C378.202 479.813 319.926 504 256 504 119.034 504 8.001 392.967 8 256.002 7.999 119.193 119.646 7.755 256.455 8z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faRedoAlt = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'random';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f074';\nvar svgPathData = 'M504.971 359.029c9.373 9.373 9.373 24.569 0 33.941l-80 79.984c-15.01 15.01-40.971 4.49-40.971-16.971V416h-58.785a12.004 12.004 0 0 1-8.773-3.812l-70.556-75.596 53.333-57.143L352 336h32v-39.981c0-21.438 25.943-31.998 40.971-16.971l80 79.981zM12 176h84l52.781 56.551 53.333-57.143-70.556-75.596A11.999 11.999 0 0 0 122.785 96H12c-6.627 0-12 5.373-12 12v56c0 6.627 5.373 12 12 12zm372 0v39.984c0 21.46 25.961 31.98 40.971 16.971l80-79.984c9.373-9.373 9.373-24.569 0-33.941l-80-79.981C409.943 24.021 384 34.582 384 56.019V96h-58.785a12.004 12.004 0 0 0-8.773 3.812L96 336H12c-6.627 0-12 5.373-12 12v56c0 6.627 5.373 12 12 12h110.785c3.326 0 6.503-1.381 8.773-3.812L352 176h32z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faRandom = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'external-link-alt';\nvar width = 512;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f35d';\nvar svgPathData = 'M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faExternalLinkAlt = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nvar prefix = 'fas';\nvar iconName = 'newspaper';\nvar width = 576;\nvar height = 512;\nvar ligatures = [];\nvar unicode = 'f1ea';\nvar svgPathData = 'M552 64H88c-13.255 0-24 10.745-24 24v8H24c-13.255 0-24 10.745-24 24v272c0 30.928 25.072 56 56 56h472c26.51 0 48-21.49 48-48V88c0-13.255-10.745-24-24-24zM56 400a8 8 0 0 1-8-8V144h16v248a8 8 0 0 1-8 8zm236-16H140c-6.627 0-12-5.373-12-12v-8c0-6.627 5.373-12 12-12h152c6.627 0 12 5.373 12 12v8c0 6.627-5.373 12-12 12zm208 0H348c-6.627 0-12-5.373-12-12v-8c0-6.627 5.373-12 12-12h152c6.627 0 12 5.373 12 12v8c0 6.627-5.373 12-12 12zm-208-96H140c-6.627 0-12-5.373-12-12v-8c0-6.627 5.373-12 12-12h152c6.627 0 12 5.373 12 12v8c0 6.627-5.373 12-12 12zm208 0H348c-6.627 0-12-5.373-12-12v-8c0-6.627 5.373-12 12-12h152c6.627 0 12 5.373 12 12v8c0 6.627-5.373 12-12 12zm0-96H140c-6.627 0-12-5.373-12-12v-40c0-6.627 5.373-12 12-12h360c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12z';\n\nexports.definition = {\n prefix: prefix,\n iconName: iconName,\n icon: [\n width,\n height,\n ligatures,\n unicode,\n svgPathData\n ]};\n\nexports.faNewspaper = exports.definition;\nexports.prefix = prefix;\nexports.iconName = iconName;\nexports.width = width;\nexports.height = height;\nexports.ligatures = ligatures;\nexports.unicode = unicode;\nexports.svgPathData = svgPathData;","import StyledComponents__default, { ThemeContext as ThemeContext$1, ThemeProvider as ThemeProvider$1 } from 'styled-components';\nimport { mergeDeepRight, pick } from 'ramda';\nimport { useContext, createElement, useMemo } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nexport { faFileDownload } from '@fortawesome/free-solid-svg-icons/faFileDownload';\nexport { faFileArchive } from '@fortawesome/free-solid-svg-icons/faFileArchive';\nexport { faFileAudio } from '@fortawesome/free-solid-svg-icons/faFileAudio';\nexport { faCheckCircle } from '@fortawesome/free-solid-svg-icons/faCheckCircle';\nexport { faFileExcel } from '@fortawesome/free-solid-svg-icons/faFileExcel';\nexport { faFileImage } from '@fortawesome/free-solid-svg-icons/faFileImage';\nexport { faFilePdf } from '@fortawesome/free-solid-svg-icons/faFilePdf';\nexport { faSmile } from '@fortawesome/free-solid-svg-icons/faSmile';\nexport { faFileWord } from '@fortawesome/free-solid-svg-icons/faFileWord';\nexport { faFileVideo } from '@fortawesome/free-solid-svg-icons/faFileVideo';\nexport { faFilePowerpoint } from '@fortawesome/free-solid-svg-icons/faFilePowerpoint';\nexport { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';\nexport { faCut } from '@fortawesome/free-solid-svg-icons/faCut';\nexport { faCog } from '@fortawesome/free-solid-svg-icons/faCog';\nexport { faCopy } from '@fortawesome/free-solid-svg-icons/faCopy';\nexport { faFileAlt } from '@fortawesome/free-solid-svg-icons/faFileAlt';\nexport { faImages } from '@fortawesome/free-solid-svg-icons/faImages';\nexport { faPhotoVideo } from '@fortawesome/free-solid-svg-icons/faPhotoVideo';\nexport { faLink } from '@fortawesome/free-solid-svg-icons/faLink';\nexport { faMinus } from '@fortawesome/free-solid-svg-icons/faMinus';\nexport { faPaste } from '@fortawesome/free-solid-svg-icons/faPaste';\nexport { faPencilAlt } from '@fortawesome/free-solid-svg-icons/faPencilAlt';\nexport { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';\nexport { faSpinner } from '@fortawesome/free-solid-svg-icons/faSpinner';\nexport { faTable } from '@fortawesome/free-solid-svg-icons/faTable';\nexport { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';\nexport { faTrashAlt } from '@fortawesome/free-solid-svg-icons/faTrashAlt';\nexport { faFilm } from '@fortawesome/free-solid-svg-icons/faFilm';\nexport { faCaretSquareUp } from '@fortawesome/free-solid-svg-icons/faCaretSquareUp';\nexport { faCaretSquareDown } from '@fortawesome/free-solid-svg-icons/faCaretSquareDown';\nexport { faSortUp } from '@fortawesome/free-solid-svg-icons/faSortUp';\nexport { faSortDown } from '@fortawesome/free-solid-svg-icons/faSortDown';\nexport { faToolbox } from '@fortawesome/free-solid-svg-icons/faToolbox';\nexport { faEllipsisH } from '@fortawesome/free-solid-svg-icons/faEllipsisH';\nexport { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';\nexport { faCloudUploadAlt } from '@fortawesome/free-solid-svg-icons/faCloudUploadAlt';\nexport { faQuestionCircle } from '@fortawesome/free-solid-svg-icons/faQuestionCircle';\nexport { faAnchor } from '@fortawesome/free-solid-svg-icons/faAnchor';\nexport { faQuoteRight } from '@fortawesome/free-solid-svg-icons/faQuoteRight';\nexport { faEquals } from '@fortawesome/free-solid-svg-icons/faEquals';\nexport { faCubes } from '@fortawesome/free-solid-svg-icons/faCubes';\nexport { faCode } from '@fortawesome/free-solid-svg-icons/faCode';\nexport { faLightbulb } from '@fortawesome/free-solid-svg-icons/faLightbulb';\nexport { faKeyboard } from '@fortawesome/free-solid-svg-icons/faKeyboard';\nexport { faDotCircle } from '@fortawesome/free-solid-svg-icons/faDotCircle';\nexport { faCheckSquare } from '@fortawesome/free-solid-svg-icons/faCheckSquare';\nexport { faParagraph } from '@fortawesome/free-solid-svg-icons/faParagraph';\nexport { faRedoAlt } from '@fortawesome/free-solid-svg-icons/faRedoAlt';\nexport { faRandom } from '@fortawesome/free-solid-svg-icons/faRandom';\nexport { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons/faExternalLinkAlt';\nexport { faNewspaper } from '@fortawesome/free-solid-svg-icons/faNewspaper';\n\n/** @public */\n\nvar defaultEditorTheme = {\n primary: {\n color: '#ffffff',\n background: 'rgb(70, 155, 255)'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n },\n color: '#EEEEEE',\n backgroundColor: 'rgba(51,51,51,0.95)'\n};\n/**\r\n * React Hook for the editor theming\r\n *\r\n * @returns An object containing the current {@link EditorTheme | editor theme} and {@link EditorUiTheme | editor UI theme}\r\n * @public\r\n */\n\nfunction useEditorTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link EditorThemeProps} to the current theme of the specified editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link EditorThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createEditorUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.editor), theme.editorUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of an editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useEditorUiTheme(key, createDefaultTheme) {\n var theme = useEditorTheme();\n return createEditorUiTheme(key, createDefaultTheme)(theme);\n}\n\n/**\r\n * Font Awesome Icon component\r\n *\r\n * @param props - Most of {@link https://github.com/FortAwesome/react-fontawesome | FontAwesomeIconProps}\r\n * @public\r\n */\n\nfunction Icon(props) {\n var allowedProps = pick(['icon', 'mask', 'className', 'color', 'spin', 'pulse', 'border', 'fixedWidth', 'inverse', 'listItem', 'flip', 'size', 'pull', 'rotation', 'transform', 'symbol', 'style', 'tabIndex', 'title'], props);\n return createElement(FontAwesomeIcon, Object.assign({}, allowedProps));\n}\n/**\r\n * Creates an icon component\r\n *\r\n * @param i - The icon to use\r\n * @returns A component for the specified icon\r\n * @public\r\n */\n\nfunction createIcon(i) {\n return function I() {\n return createElement(Icon, {\n icon: i,\n size: \"4x\"\n });\n };\n}\nvar EdtrSVG = /*#__PURE__*/StyledComponents__default.svg({\n display: 'inline-block',\n verticalAlign: 'middle',\n overflow: 'hidden'\n});\n/**\r\n * Edtr.io icon component\r\n *\r\n * @param props - An Edtr.io icon definition and an optional className\r\n * @returns The icon\r\n * @public\r\n */\n\nfunction EdtrIcon(props) {\n return createElement(EdtrSVG, {\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n className: props.className\n }, createElement(\"path\", {\n fill: \"currentcolor\",\n d: props.icon\n }));\n}\n/** @public */\n\nvar edtrAlignBlock = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignCenter = 'M7 16c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zm-3 5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm3-5c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignRight = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zm-6-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignLeft = 'M14 15H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zm0-8H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zM4 13h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0 8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrClose = 'M18.3,5.71 C17.91,5.32 17.28,5.32 16.89,5.71 L12,10.59 L7.11,5.7 C6.72,5.31 6.09,5.31 5.7,5.7 C5.31,6.09 5.31,6.72 5.7,7.11 L10.59,12 L5.7,16.89 C5.31,17.28 5.31,17.91 5.7,18.3 C6.09,18.69 6.72,18.69 7.11,18.3 L12,13.41 L16.89,18.3 C17.28,18.69 17.91,18.69 18.3,18.3 C18.69,17.91 18.69,17.28 18.3,16.89 L13.41,12 L18.3,7.11 C18.68,6.73 18.68,6.09 18.3,5.71 Z';\n/** @public */\n\nvar edtrFormula = 'M9.796061,6.84358189 L9.546061,9.73358189 L11.366061,9.73358189 C11.9183457,9.73358189 12.366061,10.1812971 12.366061,10.7335819 L12.366061,10.7335819 C12.366061,11.2858666 11.9183457,11.7335819 11.366061,11.7335819 L9.366061,11.7335819 L8.926061,16.8035819 C8.726061,19.0035819 6.786061,20.6335819 4.586061,20.4335819 C3.95133688,20.3777262 3.21218763,20.0027937 2.36861326,19.3087844 L2.3686112,19.3087869 C1.93754177,18.9541458 1.8755844,18.3172015 2.23022554,17.8861321 C2.25098506,17.8608987 2.27295601,17.8366869 2.296061,17.8135819 L2.296061,17.8135819 C2.68943711,17.4202058 3.31879167,17.3943638 3.74309403,17.7541652 C4.42335978,18.3310001 5.0243456,18.5341427 5.546061,18.3635819 C6.326061,18.1235819 6.876061,17.4335819 6.946061,16.6235819 L7.366061,11.7335819 L5.366061,11.7335819 C4.81377625,11.7335819 4.366061,11.2858666 4.366061,10.7335819 L4.366061,10.7335819 C4.366061,10.1812971 4.81377625,9.73358189 5.366061,9.73358189 L7.546061,9.73358189 L7.816061,6.66358189 C8.006061,4.46358189 9.936061,2.83358189 12.146061,3.01358189 C12.7876823,3.06959645 13.5343235,3.45039469 14.3859845,4.15597662 L14.3859731,4.15599041 C14.8171452,4.51320676 14.8770982,5.1523219 14.5198819,5.58349402 C14.4997127,5.60783893 14.4784158,5.63122712 14.456061,5.65358189 L14.456061,5.65358189 C14.077745,6.03189793 13.4644763,6.03223098 13.0857495,5.65432608 C12.6951429,5.26458609 12.3219165,5.05433484 11.966061,5.02358189 C10.866061,4.92358189 9.896061,5.73358189 9.796061,6.84358189 Z M20.841061,12.6785819 L20.841061,12.6785819 C20.4517003,12.2892211 19.8204217,12.2892211 19.431061,12.6785819 L17.306061,14.8035819 L15.1860786,12.6835995 C14.7931405,12.2906614 14.1567565,12.2884206 13.761061,12.6785819 L13.761061,12.6785819 C13.3689485,13.0652103 13.3645027,13.6965046 13.7511312,14.0886171 C13.7527745,14.0902837 13.7544236,14.0919445 13.7560786,14.0935995 L15.896061,16.2335819 L13.7610785,18.3385997 C13.3717179,18.7224956 13.3672879,19.3493438 13.7511838,19.7387045 C13.7544529,19.7420201 13.7577454,19.7453127 13.761061,19.7485819 L13.761061,19.7485819 C14.1567565,20.1387432 14.7931405,20.1365024 15.1860786,19.7435643 L17.306061,17.6235819 L19.431061,19.7485819 C19.8204217,20.1379426 20.4517003,20.1379426 20.841061,19.7485819 L20.841061,19.7485819 C21.2290435,19.3605994 21.2290435,18.7315555 20.841061,18.343573 C20.8402306,18.3427426 20.8393988,18.3419137 20.8385654,18.3410863 L18.716061,16.2335819 L20.8435477,14.0910599 C21.2319346,13.6999283 21.2308227,13.0683435 20.841061,12.6785819 Z';\n/** @public */\n\nvar edtrText = 'M2.5 5.5C2.5 6.33 3.17 7 4 7h3.5v10.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V7H14c.83 0 1.5-.67 1.5-1.5S14.83 4 14 4H4c-.83 0-1.5.67-1.5 1.5zM20 9h-6c-.83 0-1.5.67-1.5 1.5S13.17 12 14 12h1.5v5.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V12H20c.83 0 1.5-.67 1.5-1.5S20.83 9 20 9z';\n/** @public */\n\nvar edtrLink = 'M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1zm2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1z';\n/** @public */\n\nvar edtrQuote = 'M7.17 17c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94zm10 0c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94z';\n/** @public */\n\nvar edtrListNumbered = 'M8 7h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm12 10H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zm0-6H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zM4.5 16h-2c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5h-.5c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h2c.28 0 .5-.22.5-.5v-3c0-.28-.22-.5-.5-.5zm-2-11H3v2.5c0 .28.22.5.5.5s.5-.22.5-.5v-3c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5s.22.5.5.5zm2 5h-2c-.28 0-.5.22-.5.5s.22.5.5.5h1.3l-1.68 1.96c-.08.09-.12.21-.12.32v.22c0 .28.22.5.5.5h2c.28 0 .5-.22.5-.5s-.22-.5-.5-.5H3.2l1.68-1.96c.08-.09.12-.21.12-.32v-.22c0-.28-.22-.5-.5-.5z';\n/** @public */\n\nvar edtrListBullets = 'M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM8 19h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm0-6h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zM7 6c0 .55.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrItalic = 'M10 5.5c0 .83.67 1.5 1.5 1.5h.71l-3.42 8H7.5c-.83 0-1.5.67-1.5 1.5S6.67 18 7.5 18h5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5h-.71l3.42-8h1.29c.83 0 1.5-.67 1.5-1.5S17.33 4 16.5 4h-5c-.83 0-1.5.67-1.5 1.5z';\n/** @public */\n\nvar edtrColorText = 'M10.63 3.93L6.06 15.58c-.27.68.23 1.42.97 1.42.43 0 .82-.27.98-.68L8.87 14h6.25l.87 2.32c.15.41.54.68.98.68.73 0 1.24-.74.97-1.42L13.37 3.93C13.14 3.37 12.6 3 12 3c-.6 0-1.15.37-1.37.93zM9.62 12L12 5.67 14.38 12H9.62z';\n/** @public */\n\nvar edtrFill = 'M16.56 8.94L8.32.7C7.93.31 7.3.31 6.91.7c-.39.39-.39 1.02 0 1.41l1.68 1.68-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z';\n/** @public */\n\nvar edtrBold = 'M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H8c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h5.78c2.07 0 3.96-1.69 3.97-3.77.01-1.53-.85-2.84-2.15-3.44zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z';\n/** @public */\n\nvar edtrPlus = 'M12,2 C6.48,2 2,6.48 2,12 C2,17.52 6.48,22 12,22 C17.52,22 22,17.52 22,12 C22,6.48 17.52,2 12,2 Z M16,13 L13,13 L13,16 C13,16.55 12.55,17 12,17 C11.45,17 11,16.55 11,16 L11,13 L8,13 C7.45,13 7,12.55 7,12 C7,11.45 7.45,11 8,11 L11,11 L11,8 C11,7.45 11.45,7 12,7 C12.55,7 13,7.45 13,8 L13,11 L16,11 C16.55,11 17,11.45 17,12 C17,12.55 16.55,13 16,13 Z';\n/** @public */\n\nvar edtrSearch = 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z';\n/** @public */\n\nvar edtrDefaultPlugin = 'M20.6190476,11.5238095 L19.1904762,11.5238095 L19.1904762,7.71428571 C19.1904762,6.65714286 18.3333333,5.80952381 17.2857143,5.80952381 L13.4761905,5.80952381 L13.4761905,4.38095238 C13.4761905,3.06598869 12.4102018,2 11.0952381,2 C9.78027441,2 8.71428571,3.06598869 8.71428571,4.38095238 L8.71428571,5.80952381 L4.9047619,5.80952381 C3.85279095,5.80952381 3,6.66231476 3,7.71428571 L3,11.3333333 L4.42857143,11.3333333 C5.85714286,11.3333333 7,12.4761905 7,13.9047619 C7,15.3333333 5.85714286,16.4761905 4.42857143,16.4761905 L3,16.4761905 L3,20.0952381 C3,21.147209 3.85279095,22 4.9047619,22 L8.52380952,22 L8.52380952,20.5714286 C8.52380952,19.1428571 9.66666667,18 11.0952381,18 C12.5238095,18 13.6666667,19.1428571 13.6666667,20.5714286 L13.6666667,22 L17.2857143,22 C18.3376852,22 19.1904762,21.147209 19.1904762,20.0952381 L19.1904762,16.2857143 L20.6190476,16.2857143 C21.9340113,16.2857143 23,15.2197256 23,13.9047619 C23,12.5897982 21.9340113,11.5238095 20.6190476,11.5238095 Z';\n/** @public */\n\nvar edtrDragHandle = 'M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z';\n\n/** @public */\n\nvar defaultRendererTheme = {\n backgroundColor: '#ffffff',\n color: '#333333',\n primary: {\n color: '#ffffff',\n background: '#337ab7'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n }\n};\n/**\r\n * React Hook for the renderer theming\r\n *\r\n * @returns An object containing the current {@link RendererTheme | renderer theme} and {@link RendererUiTheme | renderer UI theme}\r\n * @public\r\n */\n\nfunction useRendererTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link RendererThemeProps} to the current theme of the specified renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link RendererThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createRendererUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.renderer), theme.rendererUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of a renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useRendererUiTheme(key, createDefaultTheme) {\n var theme = useRendererTheme();\n return createRendererUiTheme(key, createDefaultTheme)(theme);\n}\n\nvar defaultTheme = {\n editor: defaultEditorTheme,\n editorUi: {},\n renderer: defaultRendererTheme,\n rendererUi: {}\n}; // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to hydrate the context for the {@link Theme | Theme}\r\n *\r\n * @remarks\r\n * You probably don't want to use this component directly since it is already used by the core.\r\n * If you want to override the theme in some plugin, you probably want to use {@link ThemeProvider | ThemeProvider} instead.\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | default Theme}, and children\r\n * @public\r\n */\n\nfunction RootThemeProvider(props) {\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n/**\r\n * Context used for the {@link Theme | Theme}, see also {@link https://styled-components.com/docs/advanced#theming | Theming }\r\n *\r\n * @public\r\n */\n\nvar ThemeContext = ThemeContext$1;\n/**\r\n * React Hook to get the current {@link Theme | Theme}\r\n *\r\n * @returns The current {@link Theme | Theme}\r\n * @public\r\n */\n\nfunction useTheme() {\n return useContext(ThemeContext);\n} // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to override the current {@link Theme | theme}\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | current Theme}, and children\r\n * @public\r\n */\n\nfunction ThemeProvider(props) {\n var defaultTheme = useTheme();\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [defaultTheme, props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n\n/**\r\n * Provides utils for the User Interface\r\n *\r\n * @packageDocumentation\r\n */\n/**\r\n * Re-export of {@link https://styled-components.com/docs/api#primary | `styled` in `styled-components` }\r\n *\r\n * @public\r\n */\n\nvar styled = StyledComponents__default;\n\nexport { EdtrIcon, Icon, RootThemeProvider, ThemeContext, ThemeProvider, createEditorUiTheme, createIcon, createRendererUiTheme, defaultEditorTheme, defaultRendererTheme, edtrAlignBlock, edtrAlignCenter, edtrAlignLeft, edtrAlignRight, edtrBold, edtrClose, edtrColorText, edtrDefaultPlugin, edtrDragHandle, edtrFill, edtrFormula, edtrItalic, edtrLink, edtrListBullets, edtrListNumbered, edtrPlus, edtrQuote, edtrSearch, edtrText, styled, useEditorTheme, useEditorUiTheme, useRendererTheme, useRendererUiTheme, useTheme };\n\n","import StyledComponents__default, { ThemeContext as ThemeContext$1, ThemeProvider as ThemeProvider$1 } from 'styled-components';\nimport { mergeDeepRight, pick } from 'ramda';\nimport { useContext, createElement, useMemo } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nexport { faFileDownload } from '@fortawesome/free-solid-svg-icons/faFileDownload';\nexport { faFileArchive } from '@fortawesome/free-solid-svg-icons/faFileArchive';\nexport { faFileAudio } from '@fortawesome/free-solid-svg-icons/faFileAudio';\nexport { faCheckCircle } from '@fortawesome/free-solid-svg-icons/faCheckCircle';\nexport { faFileExcel } from '@fortawesome/free-solid-svg-icons/faFileExcel';\nexport { faFileImage } from '@fortawesome/free-solid-svg-icons/faFileImage';\nexport { faFilePdf } from '@fortawesome/free-solid-svg-icons/faFilePdf';\nexport { faSmile } from '@fortawesome/free-solid-svg-icons/faSmile';\nexport { faFileWord } from '@fortawesome/free-solid-svg-icons/faFileWord';\nexport { faFileVideo } from '@fortawesome/free-solid-svg-icons/faFileVideo';\nexport { faFilePowerpoint } from '@fortawesome/free-solid-svg-icons/faFilePowerpoint';\nexport { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';\nexport { faCut } from '@fortawesome/free-solid-svg-icons/faCut';\nexport { faCog } from '@fortawesome/free-solid-svg-icons/faCog';\nexport { faCopy } from '@fortawesome/free-solid-svg-icons/faCopy';\nexport { faFileAlt } from '@fortawesome/free-solid-svg-icons/faFileAlt';\nexport { faImages } from '@fortawesome/free-solid-svg-icons/faImages';\nexport { faPhotoVideo } from '@fortawesome/free-solid-svg-icons/faPhotoVideo';\nexport { faLink } from '@fortawesome/free-solid-svg-icons/faLink';\nexport { faMinus } from '@fortawesome/free-solid-svg-icons/faMinus';\nexport { faPaste } from '@fortawesome/free-solid-svg-icons/faPaste';\nexport { faPencilAlt } from '@fortawesome/free-solid-svg-icons/faPencilAlt';\nexport { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';\nexport { faSpinner } from '@fortawesome/free-solid-svg-icons/faSpinner';\nexport { faTable } from '@fortawesome/free-solid-svg-icons/faTable';\nexport { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';\nexport { faTrashAlt } from '@fortawesome/free-solid-svg-icons/faTrashAlt';\nexport { faFilm } from '@fortawesome/free-solid-svg-icons/faFilm';\nexport { faCaretSquareUp } from '@fortawesome/free-solid-svg-icons/faCaretSquareUp';\nexport { faCaretSquareDown } from '@fortawesome/free-solid-svg-icons/faCaretSquareDown';\nexport { faSortUp } from '@fortawesome/free-solid-svg-icons/faSortUp';\nexport { faSortDown } from '@fortawesome/free-solid-svg-icons/faSortDown';\nexport { faToolbox } from '@fortawesome/free-solid-svg-icons/faToolbox';\nexport { faEllipsisH } from '@fortawesome/free-solid-svg-icons/faEllipsisH';\nexport { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';\nexport { faCloudUploadAlt } from '@fortawesome/free-solid-svg-icons/faCloudUploadAlt';\nexport { faQuestionCircle } from '@fortawesome/free-solid-svg-icons/faQuestionCircle';\nexport { faAnchor } from '@fortawesome/free-solid-svg-icons/faAnchor';\nexport { faQuoteRight } from '@fortawesome/free-solid-svg-icons/faQuoteRight';\nexport { faEquals } from '@fortawesome/free-solid-svg-icons/faEquals';\nexport { faCubes } from '@fortawesome/free-solid-svg-icons/faCubes';\nexport { faCode } from '@fortawesome/free-solid-svg-icons/faCode';\nexport { faLightbulb } from '@fortawesome/free-solid-svg-icons/faLightbulb';\nexport { faKeyboard } from '@fortawesome/free-solid-svg-icons/faKeyboard';\nexport { faDotCircle } from '@fortawesome/free-solid-svg-icons/faDotCircle';\nexport { faCheckSquare } from '@fortawesome/free-solid-svg-icons/faCheckSquare';\nexport { faParagraph } from '@fortawesome/free-solid-svg-icons/faParagraph';\nexport { faRedoAlt } from '@fortawesome/free-solid-svg-icons/faRedoAlt';\nexport { faRandom } from '@fortawesome/free-solid-svg-icons/faRandom';\nexport { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons/faExternalLinkAlt';\nexport { faNewspaper } from '@fortawesome/free-solid-svg-icons/faNewspaper';\n\n/** @public */\n\nvar defaultEditorTheme = {\n primary: {\n color: '#ffffff',\n background: 'rgb(70, 155, 255)'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n },\n color: '#EEEEEE',\n backgroundColor: 'rgba(51,51,51,0.95)'\n};\n/**\r\n * React Hook for the editor theming\r\n *\r\n * @returns An object containing the current {@link EditorTheme | editor theme} and {@link EditorUiTheme | editor UI theme}\r\n * @public\r\n */\n\nfunction useEditorTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link EditorThemeProps} to the current theme of the specified editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link EditorThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createEditorUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.editor), theme.editorUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of an editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useEditorUiTheme(key, createDefaultTheme) {\n var theme = useEditorTheme();\n return createEditorUiTheme(key, createDefaultTheme)(theme);\n}\n\n/**\r\n * Font Awesome Icon component\r\n *\r\n * @param props - Most of {@link https://github.com/FortAwesome/react-fontawesome | FontAwesomeIconProps}\r\n * @public\r\n */\n\nfunction Icon(props) {\n var allowedProps = pick(['icon', 'mask', 'className', 'color', 'spin', 'pulse', 'border', 'fixedWidth', 'inverse', 'listItem', 'flip', 'size', 'pull', 'rotation', 'transform', 'symbol', 'style', 'tabIndex', 'title'], props);\n return createElement(FontAwesomeIcon, Object.assign({}, allowedProps));\n}\n/**\r\n * Creates an icon component\r\n *\r\n * @param i - The icon to use\r\n * @returns A component for the specified icon\r\n * @public\r\n */\n\nfunction createIcon(i) {\n return function I() {\n return createElement(Icon, {\n icon: i,\n size: \"4x\"\n });\n };\n}\nvar EdtrSVG = /*#__PURE__*/StyledComponents__default.svg({\n display: 'inline-block',\n verticalAlign: 'middle',\n overflow: 'hidden'\n});\n/**\r\n * Edtr.io icon component\r\n *\r\n * @param props - An Edtr.io icon definition and an optional className\r\n * @returns The icon\r\n * @public\r\n */\n\nfunction EdtrIcon(props) {\n return createElement(EdtrSVG, {\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n className: props.className\n }, createElement(\"path\", {\n fill: \"currentcolor\",\n d: props.icon\n }));\n}\n/** @public */\n\nvar edtrAlignBlock = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignCenter = 'M7 16c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zm-3 5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm3-5c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignRight = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zm-6-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignLeft = 'M14 15H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zm0-8H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zM4 13h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0 8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrClose = 'M18.3,5.71 C17.91,5.32 17.28,5.32 16.89,5.71 L12,10.59 L7.11,5.7 C6.72,5.31 6.09,5.31 5.7,5.7 C5.31,6.09 5.31,6.72 5.7,7.11 L10.59,12 L5.7,16.89 C5.31,17.28 5.31,17.91 5.7,18.3 C6.09,18.69 6.72,18.69 7.11,18.3 L12,13.41 L16.89,18.3 C17.28,18.69 17.91,18.69 18.3,18.3 C18.69,17.91 18.69,17.28 18.3,16.89 L13.41,12 L18.3,7.11 C18.68,6.73 18.68,6.09 18.3,5.71 Z';\n/** @public */\n\nvar edtrFormula = 'M9.796061,6.84358189 L9.546061,9.73358189 L11.366061,9.73358189 C11.9183457,9.73358189 12.366061,10.1812971 12.366061,10.7335819 L12.366061,10.7335819 C12.366061,11.2858666 11.9183457,11.7335819 11.366061,11.7335819 L9.366061,11.7335819 L8.926061,16.8035819 C8.726061,19.0035819 6.786061,20.6335819 4.586061,20.4335819 C3.95133688,20.3777262 3.21218763,20.0027937 2.36861326,19.3087844 L2.3686112,19.3087869 C1.93754177,18.9541458 1.8755844,18.3172015 2.23022554,17.8861321 C2.25098506,17.8608987 2.27295601,17.8366869 2.296061,17.8135819 L2.296061,17.8135819 C2.68943711,17.4202058 3.31879167,17.3943638 3.74309403,17.7541652 C4.42335978,18.3310001 5.0243456,18.5341427 5.546061,18.3635819 C6.326061,18.1235819 6.876061,17.4335819 6.946061,16.6235819 L7.366061,11.7335819 L5.366061,11.7335819 C4.81377625,11.7335819 4.366061,11.2858666 4.366061,10.7335819 L4.366061,10.7335819 C4.366061,10.1812971 4.81377625,9.73358189 5.366061,9.73358189 L7.546061,9.73358189 L7.816061,6.66358189 C8.006061,4.46358189 9.936061,2.83358189 12.146061,3.01358189 C12.7876823,3.06959645 13.5343235,3.45039469 14.3859845,4.15597662 L14.3859731,4.15599041 C14.8171452,4.51320676 14.8770982,5.1523219 14.5198819,5.58349402 C14.4997127,5.60783893 14.4784158,5.63122712 14.456061,5.65358189 L14.456061,5.65358189 C14.077745,6.03189793 13.4644763,6.03223098 13.0857495,5.65432608 C12.6951429,5.26458609 12.3219165,5.05433484 11.966061,5.02358189 C10.866061,4.92358189 9.896061,5.73358189 9.796061,6.84358189 Z M20.841061,12.6785819 L20.841061,12.6785819 C20.4517003,12.2892211 19.8204217,12.2892211 19.431061,12.6785819 L17.306061,14.8035819 L15.1860786,12.6835995 C14.7931405,12.2906614 14.1567565,12.2884206 13.761061,12.6785819 L13.761061,12.6785819 C13.3689485,13.0652103 13.3645027,13.6965046 13.7511312,14.0886171 C13.7527745,14.0902837 13.7544236,14.0919445 13.7560786,14.0935995 L15.896061,16.2335819 L13.7610785,18.3385997 C13.3717179,18.7224956 13.3672879,19.3493438 13.7511838,19.7387045 C13.7544529,19.7420201 13.7577454,19.7453127 13.761061,19.7485819 L13.761061,19.7485819 C14.1567565,20.1387432 14.7931405,20.1365024 15.1860786,19.7435643 L17.306061,17.6235819 L19.431061,19.7485819 C19.8204217,20.1379426 20.4517003,20.1379426 20.841061,19.7485819 L20.841061,19.7485819 C21.2290435,19.3605994 21.2290435,18.7315555 20.841061,18.343573 C20.8402306,18.3427426 20.8393988,18.3419137 20.8385654,18.3410863 L18.716061,16.2335819 L20.8435477,14.0910599 C21.2319346,13.6999283 21.2308227,13.0683435 20.841061,12.6785819 Z';\n/** @public */\n\nvar edtrText = 'M2.5 5.5C2.5 6.33 3.17 7 4 7h3.5v10.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V7H14c.83 0 1.5-.67 1.5-1.5S14.83 4 14 4H4c-.83 0-1.5.67-1.5 1.5zM20 9h-6c-.83 0-1.5.67-1.5 1.5S13.17 12 14 12h1.5v5.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V12H20c.83 0 1.5-.67 1.5-1.5S20.83 9 20 9z';\n/** @public */\n\nvar edtrLink = 'M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1zm2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1z';\n/** @public */\n\nvar edtrQuote = 'M7.17 17c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94zm10 0c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94z';\n/** @public */\n\nvar edtrListNumbered = 'M8 7h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm12 10H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zm0-6H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zM4.5 16h-2c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5h-.5c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h2c.28 0 .5-.22.5-.5v-3c0-.28-.22-.5-.5-.5zm-2-11H3v2.5c0 .28.22.5.5.5s.5-.22.5-.5v-3c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5s.22.5.5.5zm2 5h-2c-.28 0-.5.22-.5.5s.22.5.5.5h1.3l-1.68 1.96c-.08.09-.12.21-.12.32v.22c0 .28.22.5.5.5h2c.28 0 .5-.22.5-.5s-.22-.5-.5-.5H3.2l1.68-1.96c.08-.09.12-.21.12-.32v-.22c0-.28-.22-.5-.5-.5z';\n/** @public */\n\nvar edtrListBullets = 'M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM8 19h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm0-6h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zM7 6c0 .55.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrItalic = 'M10 5.5c0 .83.67 1.5 1.5 1.5h.71l-3.42 8H7.5c-.83 0-1.5.67-1.5 1.5S6.67 18 7.5 18h5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5h-.71l3.42-8h1.29c.83 0 1.5-.67 1.5-1.5S17.33 4 16.5 4h-5c-.83 0-1.5.67-1.5 1.5z';\n/** @public */\n\nvar edtrColorText = 'M10.63 3.93L6.06 15.58c-.27.68.23 1.42.97 1.42.43 0 .82-.27.98-.68L8.87 14h6.25l.87 2.32c.15.41.54.68.98.68.73 0 1.24-.74.97-1.42L13.37 3.93C13.14 3.37 12.6 3 12 3c-.6 0-1.15.37-1.37.93zM9.62 12L12 5.67 14.38 12H9.62z';\n/** @public */\n\nvar edtrFill = 'M16.56 8.94L8.32.7C7.93.31 7.3.31 6.91.7c-.39.39-.39 1.02 0 1.41l1.68 1.68-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z';\n/** @public */\n\nvar edtrBold = 'M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H8c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h5.78c2.07 0 3.96-1.69 3.97-3.77.01-1.53-.85-2.84-2.15-3.44zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z';\n/** @public */\n\nvar edtrPlus = 'M12,2 C6.48,2 2,6.48 2,12 C2,17.52 6.48,22 12,22 C17.52,22 22,17.52 22,12 C22,6.48 17.52,2 12,2 Z M16,13 L13,13 L13,16 C13,16.55 12.55,17 12,17 C11.45,17 11,16.55 11,16 L11,13 L8,13 C7.45,13 7,12.55 7,12 C7,11.45 7.45,11 8,11 L11,11 L11,8 C11,7.45 11.45,7 12,7 C12.55,7 13,7.45 13,8 L13,11 L16,11 C16.55,11 17,11.45 17,12 C17,12.55 16.55,13 16,13 Z';\n/** @public */\n\nvar edtrSearch = 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z';\n/** @public */\n\nvar edtrDefaultPlugin = 'M20.6190476,11.5238095 L19.1904762,11.5238095 L19.1904762,7.71428571 C19.1904762,6.65714286 18.3333333,5.80952381 17.2857143,5.80952381 L13.4761905,5.80952381 L13.4761905,4.38095238 C13.4761905,3.06598869 12.4102018,2 11.0952381,2 C9.78027441,2 8.71428571,3.06598869 8.71428571,4.38095238 L8.71428571,5.80952381 L4.9047619,5.80952381 C3.85279095,5.80952381 3,6.66231476 3,7.71428571 L3,11.3333333 L4.42857143,11.3333333 C5.85714286,11.3333333 7,12.4761905 7,13.9047619 C7,15.3333333 5.85714286,16.4761905 4.42857143,16.4761905 L3,16.4761905 L3,20.0952381 C3,21.147209 3.85279095,22 4.9047619,22 L8.52380952,22 L8.52380952,20.5714286 C8.52380952,19.1428571 9.66666667,18 11.0952381,18 C12.5238095,18 13.6666667,19.1428571 13.6666667,20.5714286 L13.6666667,22 L17.2857143,22 C18.3376852,22 19.1904762,21.147209 19.1904762,20.0952381 L19.1904762,16.2857143 L20.6190476,16.2857143 C21.9340113,16.2857143 23,15.2197256 23,13.9047619 C23,12.5897982 21.9340113,11.5238095 20.6190476,11.5238095 Z';\n/** @public */\n\nvar edtrDragHandle = 'M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z';\n\n/** @public */\n\nvar defaultRendererTheme = {\n backgroundColor: '#ffffff',\n color: '#333333',\n primary: {\n color: '#ffffff',\n background: '#337ab7'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n }\n};\n/**\r\n * React Hook for the renderer theming\r\n *\r\n * @returns An object containing the current {@link RendererTheme | renderer theme} and {@link RendererUiTheme | renderer UI theme}\r\n * @public\r\n */\n\nfunction useRendererTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link RendererThemeProps} to the current theme of the specified renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link RendererThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createRendererUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.renderer), theme.rendererUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of a renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useRendererUiTheme(key, createDefaultTheme) {\n var theme = useRendererTheme();\n return createRendererUiTheme(key, createDefaultTheme)(theme);\n}\n\nvar defaultTheme = {\n editor: defaultEditorTheme,\n editorUi: {},\n renderer: defaultRendererTheme,\n rendererUi: {}\n}; // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to hydrate the context for the {@link Theme | Theme}\r\n *\r\n * @remarks\r\n * You probably don't want to use this component directly since it is already used by the core.\r\n * If you want to override the theme in some plugin, you probably want to use {@link ThemeProvider | ThemeProvider} instead.\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | default Theme}, and children\r\n * @public\r\n */\n\nfunction RootThemeProvider(props) {\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n/**\r\n * Context used for the {@link Theme | Theme}, see also {@link https://styled-components.com/docs/advanced#theming | Theming }\r\n *\r\n * @public\r\n */\n\nvar ThemeContext = ThemeContext$1;\n/**\r\n * React Hook to get the current {@link Theme | Theme}\r\n *\r\n * @returns The current {@link Theme | Theme}\r\n * @public\r\n */\n\nfunction useTheme() {\n return useContext(ThemeContext);\n} // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to override the current {@link Theme | theme}\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | current Theme}, and children\r\n * @public\r\n */\n\nfunction ThemeProvider(props) {\n var defaultTheme = useTheme();\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [defaultTheme, props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n\n/**\r\n * Provides utils for the User Interface\r\n *\r\n * @packageDocumentation\r\n */\n/**\r\n * Re-export of {@link https://styled-components.com/docs/api#primary | `styled` in `styled-components` }\r\n *\r\n * @public\r\n */\n\nvar styled = StyledComponents__default;\n\nexport { EdtrIcon, Icon, RootThemeProvider, ThemeContext, ThemeProvider, createEditorUiTheme, createIcon, createRendererUiTheme, defaultEditorTheme, defaultRendererTheme, edtrAlignBlock, edtrAlignCenter, edtrAlignLeft, edtrAlignRight, edtrBold, edtrClose, edtrColorText, edtrDefaultPlugin, edtrDragHandle, edtrFill, edtrFormula, edtrItalic, edtrLink, edtrListBullets, edtrListNumbered, edtrPlus, edtrQuote, edtrSearch, edtrText, styled, useEditorTheme, useEditorUiTheme, useRendererTheme, useRendererUiTheme, useTheme };\n\n","import { EdtrIcon, edtrClose, Icon, faCog, styled } from '@edtr-io/ui';\nimport { useMemo, createElement, Fragment, useRef } from 'react';\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nvar Container = /*#__PURE__*/styled.div(function (_ref) {\n var noHeight = _ref.noHeight,\n expanded = _ref.expanded;\n return _extends({}, !noHeight ? {\n minHeight: '10px',\n marginBottom: '25px'\n } : {}, {\n position: 'relative',\n borderLeft: '2px solid transparent',\n paddingLeft: '5px',\n transition: '250ms all ease-in-out'\n }, expanded ? {\n borderColor: '#333333',\n paddingTop: 0,\n paddingBottom: 0\n } : {\n borderColor: 'transparent'\n });\n});\nvar ToolbarContainer = /*#__PURE__*/styled.div(function (_ref2) {\n var expanded = _ref2.expanded;\n return {\n position: 'absolute',\n top: 0,\n left: 0,\n transformOrigin: 'center top',\n transform: 'translateX(-100%)',\n pointerEvents: expanded ? 'all' : 'none',\n '&::before': {\n position: 'absolute',\n pointerEvents: 'none',\n top: 0,\n right: 0,\n content: '\"\"',\n opacity: 1,\n height: '100%',\n width: '2px',\n zIndex: 15\n }\n };\n});\nvar ToolbarContent = /*#__PURE__*/styled.div(function (_ref3) {\n var expanded = _ref3.expanded;\n return {\n paddingBottom: '10px',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-end',\n opacity: expanded ? 1 : 0,\n zIndex: 16,\n position: 'relative',\n transition: '250ms all ease-in-out'\n };\n});\nvar Header = /*#__PURE__*/styled.div({\n display: 'flex',\n justifyContent: 'space-between'\n});\nvar H4 = /*#__PURE__*/styled.h4({\n marginRight: '25px'\n});\nvar BorderlessOverlayButton = /*#__PURE__*/styled.button({\n border: 'none !important',\n padding: '0 !important',\n minWidth: '0 !important'\n});\n/**\r\n * Creates the default {@link @edtr-io/document-editor#DocumentEditorProps | document editor}\r\n *\r\n * @returns The default {@link @edtr-io/document-editor#DocumentEditorProps | document editor}\r\n * @beta\r\n */\n\nfunction createDefaultDocumentEditor() {\n return function DocumentEditor(_ref4) {\n var focused = _ref4.focused,\n children = _ref4.children,\n renderSettings = _ref4.renderSettings,\n renderToolbar = _ref4.renderToolbar,\n settingsRef = _ref4.settingsRef,\n toolbarRef = _ref4.toolbarRef,\n hasSettings = _ref4.hasSettings,\n hasToolbar = _ref4.hasToolbar,\n PluginToolbar = _ref4.PluginToolbar;\n var OverlayButton = PluginToolbar.OverlayButton,\n PluginToolbarOverlayButton = PluginToolbar.PluginToolbarOverlayButton;\n var shouldShowSettings = showSettings();\n var renderSettingsContent = useMemo(function () {\n return shouldShowSettings ? function (children, _ref5) {\n var close = _ref5.close;\n return createElement(Fragment, null, createElement(Header, null, createElement(H4, null, \"Erweiterte Einstellungen\"), createElement(BorderlessOverlayButton, {\n as: OverlayButton,\n onClick: function onClick() {\n close();\n },\n label: \"Schlie\\xDFen\"\n }, createElement(EdtrIcon, {\n icon: edtrClose\n }))), renderSettings ? renderSettings(children, {\n close: close\n }) : children);\n } : undefined;\n }, [OverlayButton, renderSettings, shouldShowSettings]);\n var expanded = focused && (showSettings() || showToolbar());\n var appended = useRef(false);\n var toolbar = createElement(Fragment, null, showSettings() ? createElement(PluginToolbarOverlayButton, {\n label: \"Einstellungen\",\n icon: createElement(Icon, {\n icon: faCog,\n size: \"lg\"\n }),\n renderContent: renderSettingsContent,\n contentRef: settingsRef\n }) : null, createElement(\"div\", {\n ref: function ref(_ref6) {\n // The ref `appended` ensures that we only append the content once so that we don't lose focus on every render\n if (_ref6 && toolbarRef.current && !appended.current) {\n appended.current = true;\n\n _ref6.appendChild(toolbarRef.current);\n } else if (!showSettings()) {\n appended.current = false;\n }\n }\n }));\n return createElement(Container, {\n editable: true,\n expanded: expanded\n }, children, createElement(ToolbarContainer, {\n expanded: expanded\n }, createElement(ToolbarContent, {\n expanded: expanded\n }, renderToolbar ? renderToolbar(toolbar) : toolbar)));\n\n function showSettings() {\n return hasSettings || renderSettings !== undefined && renderSettings(null, {\n close: function close() {// noop\n }\n }) !== null;\n }\n\n function showToolbar() {\n return hasToolbar || renderToolbar !== undefined;\n }\n };\n}\n\nexport { createDefaultDocumentEditor };\n\n","import StyledComponents__default, { ThemeContext as ThemeContext$1, ThemeProvider as ThemeProvider$1 } from 'styled-components';\nimport { mergeDeepRight, pick } from 'ramda';\nimport { useContext, createElement, useMemo } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nexport { faFileDownload } from '@fortawesome/free-solid-svg-icons/faFileDownload';\nexport { faFileArchive } from '@fortawesome/free-solid-svg-icons/faFileArchive';\nexport { faFileAudio } from '@fortawesome/free-solid-svg-icons/faFileAudio';\nexport { faCheckCircle } from '@fortawesome/free-solid-svg-icons/faCheckCircle';\nexport { faFileExcel } from '@fortawesome/free-solid-svg-icons/faFileExcel';\nexport { faFileImage } from '@fortawesome/free-solid-svg-icons/faFileImage';\nexport { faFilePdf } from '@fortawesome/free-solid-svg-icons/faFilePdf';\nexport { faSmile } from '@fortawesome/free-solid-svg-icons/faSmile';\nexport { faFileWord } from '@fortawesome/free-solid-svg-icons/faFileWord';\nexport { faFileVideo } from '@fortawesome/free-solid-svg-icons/faFileVideo';\nexport { faFilePowerpoint } from '@fortawesome/free-solid-svg-icons/faFilePowerpoint';\nexport { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';\nexport { faCut } from '@fortawesome/free-solid-svg-icons/faCut';\nexport { faCog } from '@fortawesome/free-solid-svg-icons/faCog';\nexport { faCopy } from '@fortawesome/free-solid-svg-icons/faCopy';\nexport { faFileAlt } from '@fortawesome/free-solid-svg-icons/faFileAlt';\nexport { faImages } from '@fortawesome/free-solid-svg-icons/faImages';\nexport { faPhotoVideo } from '@fortawesome/free-solid-svg-icons/faPhotoVideo';\nexport { faLink } from '@fortawesome/free-solid-svg-icons/faLink';\nexport { faMinus } from '@fortawesome/free-solid-svg-icons/faMinus';\nexport { faPaste } from '@fortawesome/free-solid-svg-icons/faPaste';\nexport { faPencilAlt } from '@fortawesome/free-solid-svg-icons/faPencilAlt';\nexport { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';\nexport { faSpinner } from '@fortawesome/free-solid-svg-icons/faSpinner';\nexport { faTable } from '@fortawesome/free-solid-svg-icons/faTable';\nexport { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';\nexport { faTrashAlt } from '@fortawesome/free-solid-svg-icons/faTrashAlt';\nexport { faFilm } from '@fortawesome/free-solid-svg-icons/faFilm';\nexport { faCaretSquareUp } from '@fortawesome/free-solid-svg-icons/faCaretSquareUp';\nexport { faCaretSquareDown } from '@fortawesome/free-solid-svg-icons/faCaretSquareDown';\nexport { faSortUp } from '@fortawesome/free-solid-svg-icons/faSortUp';\nexport { faSortDown } from '@fortawesome/free-solid-svg-icons/faSortDown';\nexport { faToolbox } from '@fortawesome/free-solid-svg-icons/faToolbox';\nexport { faEllipsisH } from '@fortawesome/free-solid-svg-icons/faEllipsisH';\nexport { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';\nexport { faCloudUploadAlt } from '@fortawesome/free-solid-svg-icons/faCloudUploadAlt';\nexport { faQuestionCircle } from '@fortawesome/free-solid-svg-icons/faQuestionCircle';\nexport { faAnchor } from '@fortawesome/free-solid-svg-icons/faAnchor';\nexport { faQuoteRight } from '@fortawesome/free-solid-svg-icons/faQuoteRight';\nexport { faEquals } from '@fortawesome/free-solid-svg-icons/faEquals';\nexport { faCubes } from '@fortawesome/free-solid-svg-icons/faCubes';\nexport { faCode } from '@fortawesome/free-solid-svg-icons/faCode';\nexport { faLightbulb } from '@fortawesome/free-solid-svg-icons/faLightbulb';\nexport { faKeyboard } from '@fortawesome/free-solid-svg-icons/faKeyboard';\nexport { faDotCircle } from '@fortawesome/free-solid-svg-icons/faDotCircle';\nexport { faCheckSquare } from '@fortawesome/free-solid-svg-icons/faCheckSquare';\nexport { faParagraph } from '@fortawesome/free-solid-svg-icons/faParagraph';\nexport { faRedoAlt } from '@fortawesome/free-solid-svg-icons/faRedoAlt';\nexport { faRandom } from '@fortawesome/free-solid-svg-icons/faRandom';\nexport { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons/faExternalLinkAlt';\nexport { faNewspaper } from '@fortawesome/free-solid-svg-icons/faNewspaper';\n\n/** @public */\n\nvar defaultEditorTheme = {\n primary: {\n color: '#ffffff',\n background: 'rgb(70, 155, 255)'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n },\n color: '#EEEEEE',\n backgroundColor: 'rgba(51,51,51,0.95)'\n};\n/**\r\n * React Hook for the editor theming\r\n *\r\n * @returns An object containing the current {@link EditorTheme | editor theme} and {@link EditorUiTheme | editor UI theme}\r\n * @public\r\n */\n\nfunction useEditorTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link EditorThemeProps} to the current theme of the specified editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link EditorThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createEditorUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.editor), theme.editorUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of an editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useEditorUiTheme(key, createDefaultTheme) {\n var theme = useEditorTheme();\n return createEditorUiTheme(key, createDefaultTheme)(theme);\n}\n\n/**\r\n * Font Awesome Icon component\r\n *\r\n * @param props - Most of {@link https://github.com/FortAwesome/react-fontawesome | FontAwesomeIconProps}\r\n * @public\r\n */\n\nfunction Icon(props) {\n var allowedProps = pick(['icon', 'mask', 'className', 'color', 'spin', 'pulse', 'border', 'fixedWidth', 'inverse', 'listItem', 'flip', 'size', 'pull', 'rotation', 'transform', 'symbol', 'style', 'tabIndex', 'title'], props);\n return createElement(FontAwesomeIcon, Object.assign({}, allowedProps));\n}\n/**\r\n * Creates an icon component\r\n *\r\n * @param i - The icon to use\r\n * @returns A component for the specified icon\r\n * @public\r\n */\n\nfunction createIcon(i) {\n return function I() {\n return createElement(Icon, {\n icon: i,\n size: \"4x\"\n });\n };\n}\nvar EdtrSVG = /*#__PURE__*/StyledComponents__default.svg({\n display: 'inline-block',\n verticalAlign: 'middle',\n overflow: 'hidden'\n});\n/**\r\n * Edtr.io icon component\r\n *\r\n * @param props - An Edtr.io icon definition and an optional className\r\n * @returns The icon\r\n * @public\r\n */\n\nfunction EdtrIcon(props) {\n return createElement(EdtrSVG, {\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n className: props.className\n }, createElement(\"path\", {\n fill: \"currentcolor\",\n d: props.icon\n }));\n}\n/** @public */\n\nvar edtrAlignBlock = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignCenter = 'M7 16c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zm-3 5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm3-5c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignRight = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zm-6-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignLeft = 'M14 15H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zm0-8H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zM4 13h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0 8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrClose = 'M18.3,5.71 C17.91,5.32 17.28,5.32 16.89,5.71 L12,10.59 L7.11,5.7 C6.72,5.31 6.09,5.31 5.7,5.7 C5.31,6.09 5.31,6.72 5.7,7.11 L10.59,12 L5.7,16.89 C5.31,17.28 5.31,17.91 5.7,18.3 C6.09,18.69 6.72,18.69 7.11,18.3 L12,13.41 L16.89,18.3 C17.28,18.69 17.91,18.69 18.3,18.3 C18.69,17.91 18.69,17.28 18.3,16.89 L13.41,12 L18.3,7.11 C18.68,6.73 18.68,6.09 18.3,5.71 Z';\n/** @public */\n\nvar edtrFormula = 'M9.796061,6.84358189 L9.546061,9.73358189 L11.366061,9.73358189 C11.9183457,9.73358189 12.366061,10.1812971 12.366061,10.7335819 L12.366061,10.7335819 C12.366061,11.2858666 11.9183457,11.7335819 11.366061,11.7335819 L9.366061,11.7335819 L8.926061,16.8035819 C8.726061,19.0035819 6.786061,20.6335819 4.586061,20.4335819 C3.95133688,20.3777262 3.21218763,20.0027937 2.36861326,19.3087844 L2.3686112,19.3087869 C1.93754177,18.9541458 1.8755844,18.3172015 2.23022554,17.8861321 C2.25098506,17.8608987 2.27295601,17.8366869 2.296061,17.8135819 L2.296061,17.8135819 C2.68943711,17.4202058 3.31879167,17.3943638 3.74309403,17.7541652 C4.42335978,18.3310001 5.0243456,18.5341427 5.546061,18.3635819 C6.326061,18.1235819 6.876061,17.4335819 6.946061,16.6235819 L7.366061,11.7335819 L5.366061,11.7335819 C4.81377625,11.7335819 4.366061,11.2858666 4.366061,10.7335819 L4.366061,10.7335819 C4.366061,10.1812971 4.81377625,9.73358189 5.366061,9.73358189 L7.546061,9.73358189 L7.816061,6.66358189 C8.006061,4.46358189 9.936061,2.83358189 12.146061,3.01358189 C12.7876823,3.06959645 13.5343235,3.45039469 14.3859845,4.15597662 L14.3859731,4.15599041 C14.8171452,4.51320676 14.8770982,5.1523219 14.5198819,5.58349402 C14.4997127,5.60783893 14.4784158,5.63122712 14.456061,5.65358189 L14.456061,5.65358189 C14.077745,6.03189793 13.4644763,6.03223098 13.0857495,5.65432608 C12.6951429,5.26458609 12.3219165,5.05433484 11.966061,5.02358189 C10.866061,4.92358189 9.896061,5.73358189 9.796061,6.84358189 Z M20.841061,12.6785819 L20.841061,12.6785819 C20.4517003,12.2892211 19.8204217,12.2892211 19.431061,12.6785819 L17.306061,14.8035819 L15.1860786,12.6835995 C14.7931405,12.2906614 14.1567565,12.2884206 13.761061,12.6785819 L13.761061,12.6785819 C13.3689485,13.0652103 13.3645027,13.6965046 13.7511312,14.0886171 C13.7527745,14.0902837 13.7544236,14.0919445 13.7560786,14.0935995 L15.896061,16.2335819 L13.7610785,18.3385997 C13.3717179,18.7224956 13.3672879,19.3493438 13.7511838,19.7387045 C13.7544529,19.7420201 13.7577454,19.7453127 13.761061,19.7485819 L13.761061,19.7485819 C14.1567565,20.1387432 14.7931405,20.1365024 15.1860786,19.7435643 L17.306061,17.6235819 L19.431061,19.7485819 C19.8204217,20.1379426 20.4517003,20.1379426 20.841061,19.7485819 L20.841061,19.7485819 C21.2290435,19.3605994 21.2290435,18.7315555 20.841061,18.343573 C20.8402306,18.3427426 20.8393988,18.3419137 20.8385654,18.3410863 L18.716061,16.2335819 L20.8435477,14.0910599 C21.2319346,13.6999283 21.2308227,13.0683435 20.841061,12.6785819 Z';\n/** @public */\n\nvar edtrText = 'M2.5 5.5C2.5 6.33 3.17 7 4 7h3.5v10.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V7H14c.83 0 1.5-.67 1.5-1.5S14.83 4 14 4H4c-.83 0-1.5.67-1.5 1.5zM20 9h-6c-.83 0-1.5.67-1.5 1.5S13.17 12 14 12h1.5v5.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V12H20c.83 0 1.5-.67 1.5-1.5S20.83 9 20 9z';\n/** @public */\n\nvar edtrLink = 'M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1zm2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1z';\n/** @public */\n\nvar edtrQuote = 'M7.17 17c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94zm10 0c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94z';\n/** @public */\n\nvar edtrListNumbered = 'M8 7h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm12 10H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zm0-6H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zM4.5 16h-2c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5h-.5c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h2c.28 0 .5-.22.5-.5v-3c0-.28-.22-.5-.5-.5zm-2-11H3v2.5c0 .28.22.5.5.5s.5-.22.5-.5v-3c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5s.22.5.5.5zm2 5h-2c-.28 0-.5.22-.5.5s.22.5.5.5h1.3l-1.68 1.96c-.08.09-.12.21-.12.32v.22c0 .28.22.5.5.5h2c.28 0 .5-.22.5-.5s-.22-.5-.5-.5H3.2l1.68-1.96c.08-.09.12-.21.12-.32v-.22c0-.28-.22-.5-.5-.5z';\n/** @public */\n\nvar edtrListBullets = 'M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM8 19h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm0-6h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zM7 6c0 .55.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrItalic = 'M10 5.5c0 .83.67 1.5 1.5 1.5h.71l-3.42 8H7.5c-.83 0-1.5.67-1.5 1.5S6.67 18 7.5 18h5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5h-.71l3.42-8h1.29c.83 0 1.5-.67 1.5-1.5S17.33 4 16.5 4h-5c-.83 0-1.5.67-1.5 1.5z';\n/** @public */\n\nvar edtrColorText = 'M10.63 3.93L6.06 15.58c-.27.68.23 1.42.97 1.42.43 0 .82-.27.98-.68L8.87 14h6.25l.87 2.32c.15.41.54.68.98.68.73 0 1.24-.74.97-1.42L13.37 3.93C13.14 3.37 12.6 3 12 3c-.6 0-1.15.37-1.37.93zM9.62 12L12 5.67 14.38 12H9.62z';\n/** @public */\n\nvar edtrFill = 'M16.56 8.94L8.32.7C7.93.31 7.3.31 6.91.7c-.39.39-.39 1.02 0 1.41l1.68 1.68-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z';\n/** @public */\n\nvar edtrBold = 'M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H8c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h5.78c2.07 0 3.96-1.69 3.97-3.77.01-1.53-.85-2.84-2.15-3.44zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z';\n/** @public */\n\nvar edtrPlus = 'M12,2 C6.48,2 2,6.48 2,12 C2,17.52 6.48,22 12,22 C17.52,22 22,17.52 22,12 C22,6.48 17.52,2 12,2 Z M16,13 L13,13 L13,16 C13,16.55 12.55,17 12,17 C11.45,17 11,16.55 11,16 L11,13 L8,13 C7.45,13 7,12.55 7,12 C7,11.45 7.45,11 8,11 L11,11 L11,8 C11,7.45 11.45,7 12,7 C12.55,7 13,7.45 13,8 L13,11 L16,11 C16.55,11 17,11.45 17,12 C17,12.55 16.55,13 16,13 Z';\n/** @public */\n\nvar edtrSearch = 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z';\n/** @public */\n\nvar edtrDefaultPlugin = 'M20.6190476,11.5238095 L19.1904762,11.5238095 L19.1904762,7.71428571 C19.1904762,6.65714286 18.3333333,5.80952381 17.2857143,5.80952381 L13.4761905,5.80952381 L13.4761905,4.38095238 C13.4761905,3.06598869 12.4102018,2 11.0952381,2 C9.78027441,2 8.71428571,3.06598869 8.71428571,4.38095238 L8.71428571,5.80952381 L4.9047619,5.80952381 C3.85279095,5.80952381 3,6.66231476 3,7.71428571 L3,11.3333333 L4.42857143,11.3333333 C5.85714286,11.3333333 7,12.4761905 7,13.9047619 C7,15.3333333 5.85714286,16.4761905 4.42857143,16.4761905 L3,16.4761905 L3,20.0952381 C3,21.147209 3.85279095,22 4.9047619,22 L8.52380952,22 L8.52380952,20.5714286 C8.52380952,19.1428571 9.66666667,18 11.0952381,18 C12.5238095,18 13.6666667,19.1428571 13.6666667,20.5714286 L13.6666667,22 L17.2857143,22 C18.3376852,22 19.1904762,21.147209 19.1904762,20.0952381 L19.1904762,16.2857143 L20.6190476,16.2857143 C21.9340113,16.2857143 23,15.2197256 23,13.9047619 C23,12.5897982 21.9340113,11.5238095 20.6190476,11.5238095 Z';\n/** @public */\n\nvar edtrDragHandle = 'M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z';\n\n/** @public */\n\nvar defaultRendererTheme = {\n backgroundColor: '#ffffff',\n color: '#333333',\n primary: {\n color: '#ffffff',\n background: '#337ab7'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n }\n};\n/**\r\n * React Hook for the renderer theming\r\n *\r\n * @returns An object containing the current {@link RendererTheme | renderer theme} and {@link RendererUiTheme | renderer UI theme}\r\n * @public\r\n */\n\nfunction useRendererTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link RendererThemeProps} to the current theme of the specified renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link RendererThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createRendererUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.renderer), theme.rendererUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of a renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useRendererUiTheme(key, createDefaultTheme) {\n var theme = useRendererTheme();\n return createRendererUiTheme(key, createDefaultTheme)(theme);\n}\n\nvar defaultTheme = {\n editor: defaultEditorTheme,\n editorUi: {},\n renderer: defaultRendererTheme,\n rendererUi: {}\n}; // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to hydrate the context for the {@link Theme | Theme}\r\n *\r\n * @remarks\r\n * You probably don't want to use this component directly since it is already used by the core.\r\n * If you want to override the theme in some plugin, you probably want to use {@link ThemeProvider | ThemeProvider} instead.\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | default Theme}, and children\r\n * @public\r\n */\n\nfunction RootThemeProvider(props) {\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n/**\r\n * Context used for the {@link Theme | Theme}, see also {@link https://styled-components.com/docs/advanced#theming | Theming }\r\n *\r\n * @public\r\n */\n\nvar ThemeContext = ThemeContext$1;\n/**\r\n * React Hook to get the current {@link Theme | Theme}\r\n *\r\n * @returns The current {@link Theme | Theme}\r\n * @public\r\n */\n\nfunction useTheme() {\n return useContext(ThemeContext);\n} // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to override the current {@link Theme | theme}\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | current Theme}, and children\r\n * @public\r\n */\n\nfunction ThemeProvider(props) {\n var defaultTheme = useTheme();\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [defaultTheme, props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n\n/**\r\n * Provides utils for the User Interface\r\n *\r\n * @packageDocumentation\r\n */\n/**\r\n * Re-export of {@link https://styled-components.com/docs/api#primary | `styled` in `styled-components` }\r\n *\r\n * @public\r\n */\n\nvar styled = StyledComponents__default;\n\nexport { EdtrIcon, Icon, RootThemeProvider, ThemeContext, ThemeProvider, createEditorUiTheme, createIcon, createRendererUiTheme, defaultEditorTheme, defaultRendererTheme, edtrAlignBlock, edtrAlignCenter, edtrAlignLeft, edtrAlignRight, edtrBold, edtrClose, edtrColorText, edtrDefaultPlugin, edtrDragHandle, edtrFill, edtrFormula, edtrItalic, edtrLink, edtrListBullets, edtrListNumbered, edtrPlus, edtrQuote, edtrSearch, edtrText, styled, useEditorTheme, useEditorUiTheme, useRendererTheme, useRendererUiTheme, useTheme };\n\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = findTabbableDescendants;\n/*!\n * Adapted from jQuery UI core\n *\n * http://jqueryui.com\n *\n * Copyright 2014 jQuery Foundation and other contributors\n * Released under the MIT license.\n * http://jquery.org/license\n *\n * http://api.jqueryui.com/category/ui-core/\n */\n\nvar tabbableNode = /input|select|textarea|button|object/;\n\nfunction hidesContents(element) {\n var zeroSize = element.offsetWidth <= 0 && element.offsetHeight <= 0;\n\n // If the node is empty, this is good enough\n if (zeroSize && !element.innerHTML) return true;\n\n // Otherwise we need to check some styles\n var style = window.getComputedStyle(element);\n return zeroSize ? style.getPropertyValue(\"overflow\") !== \"visible\" ||\n // if 'overflow: visible' set, check if there is actually any overflow\n element.scrollWidth <= 0 && element.scrollHeight <= 0 : style.getPropertyValue(\"display\") == \"none\";\n}\n\nfunction visible(element) {\n var parentElement = element;\n while (parentElement) {\n if (parentElement === document.body) break;\n if (hidesContents(parentElement)) return false;\n parentElement = parentElement.parentNode;\n }\n return true;\n}\n\nfunction focusable(element, isTabIndexNotNaN) {\n var nodeName = element.nodeName.toLowerCase();\n var res = tabbableNode.test(nodeName) && !element.disabled || (nodeName === \"a\" ? element.href || isTabIndexNotNaN : isTabIndexNotNaN);\n return res && visible(element);\n}\n\nfunction tabbable(element) {\n var tabIndex = element.getAttribute(\"tabindex\");\n if (tabIndex === null) tabIndex = undefined;\n var isTabIndexNaN = isNaN(tabIndex);\n return (isTabIndexNaN || tabIndex >= 0) && focusable(element, !isTabIndexNaN);\n}\n\nfunction findTabbableDescendants(element) {\n return [].slice.call(element.querySelectorAll(\"*\"), 0).filter(tabbable);\n}\nmodule.exports = exports[\"default\"];","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.handleBlur = handleBlur;\nexports.handleFocus = handleFocus;\nexports.markForFocusLater = markForFocusLater;\nexports.returnFocus = returnFocus;\nexports.popWithoutFocus = popWithoutFocus;\nexports.setupScopedFocus = setupScopedFocus;\nexports.teardownScopedFocus = teardownScopedFocus;\n\nvar _tabbable = require(\"../helpers/tabbable\");\n\nvar _tabbable2 = _interopRequireDefault(_tabbable);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar focusLaterElements = [];\nvar modalElement = null;\nvar needToFocus = false;\n\nfunction handleBlur() {\n needToFocus = true;\n}\n\nfunction handleFocus() {\n if (needToFocus) {\n needToFocus = false;\n if (!modalElement) {\n return;\n }\n // need to see how jQuery shims document.on('focusin') so we don't need the\n // setTimeout, firefox doesn't support focusin, if it did, we could focus\n // the element outside of a setTimeout. Side-effect of this implementation\n // is that the document.body gets focus, and then we focus our element right\n // after, seems fine.\n setTimeout(function () {\n if (modalElement.contains(document.activeElement)) {\n return;\n }\n var el = (0, _tabbable2.default)(modalElement)[0] || modalElement;\n el.focus();\n }, 0);\n }\n}\n\nfunction markForFocusLater() {\n focusLaterElements.push(document.activeElement);\n}\n\n/* eslint-disable no-console */\nfunction returnFocus() {\n var toFocus = null;\n try {\n if (focusLaterElements.length !== 0) {\n toFocus = focusLaterElements.pop();\n toFocus.focus();\n }\n return;\n } catch (e) {\n console.warn([\"You tried to return focus to\", toFocus, \"but it is not in the DOM anymore\"].join(\" \"));\n }\n}\n/* eslint-enable no-console */\n\nfunction popWithoutFocus() {\n focusLaterElements.length > 0 && focusLaterElements.pop();\n}\n\nfunction setupScopedFocus(element) {\n modalElement = element;\n\n if (window.addEventListener) {\n window.addEventListener(\"blur\", handleBlur, false);\n document.addEventListener(\"focus\", handleFocus, true);\n } else {\n window.attachEvent(\"onBlur\", handleBlur);\n document.attachEvent(\"onFocus\", handleFocus);\n }\n}\n\nfunction teardownScopedFocus() {\n modalElement = null;\n\n if (window.addEventListener) {\n window.removeEventListener(\"blur\", handleBlur);\n document.removeEventListener(\"focus\", handleFocus);\n } else {\n window.detachEvent(\"onBlur\", handleBlur);\n document.detachEvent(\"onFocus\", handleFocus);\n }\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = scopeTab;\n\nvar _tabbable = require(\"./tabbable\");\n\nvar _tabbable2 = _interopRequireDefault(_tabbable);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction scopeTab(node, event) {\n var tabbable = (0, _tabbable2.default)(node);\n\n if (!tabbable.length) {\n // Do nothing, since there are no elements that can receive focus.\n event.preventDefault();\n return;\n }\n\n var target = void 0;\n\n var shiftKey = event.shiftKey;\n var head = tabbable[0];\n var tail = tabbable[tabbable.length - 1];\n\n // proceed with default browser behavior on tab.\n // Focus on last element on shift + tab.\n if (node === document.activeElement) {\n if (!shiftKey) return;\n target = tail;\n }\n\n if (tail === document.activeElement && !shiftKey) {\n target = head;\n }\n\n if (head === document.activeElement && shiftKey) {\n target = tail;\n }\n\n if (target) {\n event.preventDefault();\n target.focus();\n return;\n }\n\n // Safari radio issue.\n //\n // Safari does not move the focus to the radio button,\n // so we need to force it to really walk through all elements.\n //\n // This is very error prone, since we are trying to guess\n // if it is a safari browser from the first occurence between\n // chrome or safari.\n //\n // The chrome user agent contains the first ocurrence\n // as the 'chrome/version' and later the 'safari/version'.\n var checkSafari = /(\\bChrome\\b|\\bSafari\\b)\\//.exec(navigator.userAgent);\n var isSafariDesktop = checkSafari != null && checkSafari[1] != \"Chrome\" && /\\biPod\\b|\\biPad\\b/g.exec(navigator.userAgent) == null;\n\n // If we are not in safari desktop, let the browser control\n // the focus\n if (!isSafariDesktop) return;\n\n var x = tabbable.indexOf(document.activeElement);\n\n if (x > -1) {\n x += shiftKey ? -1 : 1;\n }\n\n target = tabbable[x];\n\n // If the tabbable element does not exist,\n // focus head/tail based on shiftKey\n if (typeof target === \"undefined\") {\n event.preventDefault();\n target = shiftKey ? tail : head;\n target.focus();\n return;\n }\n\n event.preventDefault();\n\n target.focus();\n}\nmodule.exports = exports[\"default\"];","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n/**\n * Similar to invariant but only logs a warning if the condition is not met.\n * This can be used to log issues in development environments in critical\n * paths. Removing the logging code for production environments will keep the\n * same logic and follow the same code paths.\n */\n\nvar __DEV__ = process.env.NODE_ENV !== 'production';\n\nvar warning = function() {};\n\nif (__DEV__) {\n var printWarning = function printWarning(format, args) {\n var len = arguments.length;\n args = new Array(len > 1 ? len - 1 : 0);\n for (var key = 1; key < len; key++) {\n args[key - 1] = arguments[key];\n }\n var argIndex = 0;\n var message = 'Warning: ' +\n format.replace(/%s/g, function() {\n return args[argIndex++];\n });\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n }\n\n warning = function(condition, format, args) {\n var len = arguments.length;\n args = new Array(len > 2 ? len - 2 : 0);\n for (var key = 2; key < len; key++) {\n args[key - 2] = arguments[key];\n }\n if (format === undefined) {\n throw new Error(\n '`warning(condition, format, ...args)` requires a warning ' +\n 'message argument'\n );\n }\n if (!condition) {\n printWarning.apply(null, [format].concat(args));\n }\n };\n}\n\nmodule.exports = warning;\n","/*!\n Copyright (c) 2015 Jed Watson.\n Based on code that is Copyright 2013-2015, Facebook, Inc.\n All rights reserved.\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar canUseDOM = !!(\n\t\ttypeof window !== 'undefined' &&\n\t\twindow.document &&\n\t\twindow.document.createElement\n\t);\n\n\tvar ExecutionEnvironment = {\n\n\t\tcanUseDOM: canUseDOM,\n\n\t\tcanUseWorkers: typeof Worker !== 'undefined',\n\n\t\tcanUseEventListeners:\n\t\t\tcanUseDOM && !!(window.addEventListener || window.attachEvent),\n\n\t\tcanUseViewport: canUseDOM && !!window.screen\n\n\t};\n\n\tif (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\tdefine(function () {\n\t\t\treturn ExecutionEnvironment;\n\t\t});\n\t} else if (typeof module !== 'undefined' && module.exports) {\n\t\tmodule.exports = ExecutionEnvironment;\n\t} else {\n\t\twindow.ExecutionEnvironment = ExecutionEnvironment;\n\t}\n\n}());\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.canUseDOM = undefined;\n\nvar _exenv = require(\"exenv\");\n\nvar _exenv2 = _interopRequireDefault(_exenv);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar EE = _exenv2.default;\n\nvar SafeHTMLElement = EE.canUseDOM ? window.HTMLElement : {};\n\nvar canUseDOM = exports.canUseDOM = EE.canUseDOM;\n\nexports.default = SafeHTMLElement;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.assertNodeList = assertNodeList;\nexports.setElement = setElement;\nexports.validateElement = validateElement;\nexports.hide = hide;\nexports.show = show;\nexports.documentNotReadyOrSSRTesting = documentNotReadyOrSSRTesting;\nexports.resetForTesting = resetForTesting;\n\nvar _warning = require(\"warning\");\n\nvar _warning2 = _interopRequireDefault(_warning);\n\nvar _safeHTMLElement = require(\"./safeHTMLElement\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar globalElement = null;\n\nfunction assertNodeList(nodeList, selector) {\n if (!nodeList || !nodeList.length) {\n throw new Error(\"react-modal: No elements were found for selector \" + selector + \".\");\n }\n}\n\nfunction setElement(element) {\n var useElement = element;\n if (typeof useElement === \"string\" && _safeHTMLElement.canUseDOM) {\n var el = document.querySelectorAll(useElement);\n assertNodeList(el, useElement);\n useElement = \"length\" in el ? el[0] : el;\n }\n globalElement = useElement || globalElement;\n return globalElement;\n}\n\nfunction validateElement(appElement) {\n if (!appElement && !globalElement) {\n (0, _warning2.default)(false, [\"react-modal: App element is not defined.\", \"Please use `Modal.setAppElement(el)` or set `appElement={el}`.\", \"This is needed so screen readers don't see main content\", \"when modal is opened. It is not recommended, but you can opt-out\", \"by setting `ariaHideApp={false}`.\"].join(\" \"));\n\n return false;\n }\n\n return true;\n}\n\nfunction hide(appElement) {\n if (validateElement(appElement)) {\n (appElement || globalElement).setAttribute(\"aria-hidden\", \"true\");\n }\n}\n\nfunction show(appElement) {\n if (validateElement(appElement)) {\n (appElement || globalElement).removeAttribute(\"aria-hidden\");\n }\n}\n\nfunction documentNotReadyOrSSRTesting() {\n globalElement = null;\n}\n\nfunction resetForTesting() {\n globalElement = null;\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.dumpClassLists = dumpClassLists;\nvar htmlClassList = {};\nvar docBodyClassList = {};\n\nfunction dumpClassLists() {\n if (process.env.NODE_ENV !== \"production\") {\n var classes = document.getElementsByTagName(\"html\")[0].className;\n var buffer = \"Show tracked classes:\\n\\n\";\n\n buffer += \" (\" + classes + \"):\\n\";\n for (var x in htmlClassList) {\n buffer += \" \" + x + \" \" + htmlClassList[x] + \"\\n\";\n }\n\n classes = document.body.className;\n\n // eslint-disable-next-line max-len\n buffer += \"\\n\\ndoc.body (\" + classes + \"):\\n\";\n for (var _x in docBodyClassList) {\n buffer += \" \" + _x + \" \" + docBodyClassList[_x] + \"\\n\";\n }\n\n buffer += \"\\n\";\n\n // eslint-disable-next-line no-console\n console.log(buffer);\n }\n}\n\n/**\n * Track the number of reference of a class.\n * @param {object} poll The poll to receive the reference.\n * @param {string} className The class name.\n * @return {string}\n */\nvar incrementReference = function incrementReference(poll, className) {\n if (!poll[className]) {\n poll[className] = 0;\n }\n poll[className] += 1;\n return className;\n};\n\n/**\n * Drop the reference of a class.\n * @param {object} poll The poll to receive the reference.\n * @param {string} className The class name.\n * @return {string}\n */\nvar decrementReference = function decrementReference(poll, className) {\n if (poll[className]) {\n poll[className] -= 1;\n }\n return className;\n};\n\n/**\n * Track a class and add to the given class list.\n * @param {Object} classListRef A class list of an element.\n * @param {Object} poll The poll to be used.\n * @param {Array} classes The list of classes to be tracked.\n */\nvar trackClass = function trackClass(classListRef, poll, classes) {\n classes.forEach(function (className) {\n incrementReference(poll, className);\n classListRef.add(className);\n });\n};\n\n/**\n * Untrack a class and remove from the given class list if the reference\n * reaches 0.\n * @param {Object} classListRef A class list of an element.\n * @param {Object} poll The poll to be used.\n * @param {Array} classes The list of classes to be untracked.\n */\nvar untrackClass = function untrackClass(classListRef, poll, classes) {\n classes.forEach(function (className) {\n decrementReference(poll, className);\n poll[className] === 0 && classListRef.remove(className);\n });\n};\n\n/**\n * Public inferface to add classes to the document.body.\n * @param {string} bodyClass The class string to be added.\n * It may contain more then one class\n * with ' ' as separator.\n */\nvar add = exports.add = function add(element, classString) {\n return trackClass(element.classList, element.nodeName.toLowerCase() == \"html\" ? htmlClassList : docBodyClassList, classString.split(\" \"));\n};\n\n/**\n * Public inferface to remove classes from the document.body.\n * @param {string} bodyClass The class string to be added.\n * It may contain more then one class\n * with ' ' as separator.\n */\nvar remove = exports.remove = function remove(element, classString) {\n return untrackClass(element.classList, element.nodeName.toLowerCase() == \"html\" ? htmlClassList : docBodyClassList, classString.split(\" \"));\n};","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n// Tracks portals that are open and emits events to subscribers\n\nvar PortalOpenInstances = function PortalOpenInstances() {\n var _this = this;\n\n _classCallCheck(this, PortalOpenInstances);\n\n this.register = function (openInstance) {\n if (_this.openInstances.indexOf(openInstance) !== -1) {\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.warn(\"React-Modal: Cannot register modal instance that's already open\");\n }\n return;\n }\n _this.openInstances.push(openInstance);\n _this.emit(\"register\");\n };\n\n this.deregister = function (openInstance) {\n var index = _this.openInstances.indexOf(openInstance);\n if (index === -1) {\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.warn(\"React-Modal: Unable to deregister \" + openInstance + \" as \" + \"it was never registered\");\n }\n return;\n }\n _this.openInstances.splice(index, 1);\n _this.emit(\"deregister\");\n };\n\n this.subscribe = function (callback) {\n _this.subscribers.push(callback);\n };\n\n this.emit = function (eventType) {\n _this.subscribers.forEach(function (subscriber) {\n return subscriber(eventType,\n // shallow copy to avoid accidental mutation\n _this.openInstances.slice());\n });\n };\n\n this.openInstances = [];\n this.subscribers = [];\n};\n\nvar portalOpenInstances = new PortalOpenInstances();\n\nexports.default = portalOpenInstances;\nmodule.exports = exports[\"default\"];","\"use strict\";\n\nvar _portalOpenInstances = require(\"./portalOpenInstances\");\n\nvar _portalOpenInstances2 = _interopRequireDefault(_portalOpenInstances);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// Body focus trap see Issue #742\n\nvar before = void 0,\n after = void 0,\n instances = [];\n\nfunction focusContent() {\n if (instances.length === 0) {\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.warn(\"React-Modal: Open instances > 0 expected\");\n }\n return;\n }\n instances[instances.length - 1].focusContent();\n}\n\nfunction bodyTrap(eventType, openInstances) {\n if (!before || !after) {\n before = document.createElement(\"div\");\n before.setAttribute(\"data-react-modal-body-trap\", \"\");\n before.style.position = \"absolute\";\n before.style.opacity = \"0\";\n before.setAttribute(\"tabindex\", \"0\");\n before.addEventListener(\"focus\", focusContent);\n after = before.cloneNode();\n after.addEventListener(\"focus\", focusContent);\n }\n\n instances = openInstances;\n\n if (instances.length > 0) {\n // Add focus trap\n if (document.body.firstChild !== before) {\n document.body.insertBefore(before, document.body.firstChild);\n }\n if (document.body.lastChild !== after) {\n document.body.appendChild(after);\n }\n } else {\n // Remove focus trap\n if (before.parentElement) {\n before.parentElement.removeChild(before);\n }\n if (after.parentElement) {\n after.parentElement.removeChild(after);\n }\n }\n}\n\n_portalOpenInstances2.default.subscribe(bodyTrap);","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _react = require(\"react\");\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _propTypes = require(\"prop-types\");\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _focusManager = require(\"../helpers/focusManager\");\n\nvar focusManager = _interopRequireWildcard(_focusManager);\n\nvar _scopeTab = require(\"../helpers/scopeTab\");\n\nvar _scopeTab2 = _interopRequireDefault(_scopeTab);\n\nvar _ariaAppHider = require(\"../helpers/ariaAppHider\");\n\nvar ariaAppHider = _interopRequireWildcard(_ariaAppHider);\n\nvar _classList = require(\"../helpers/classList\");\n\nvar classList = _interopRequireWildcard(_classList);\n\nvar _safeHTMLElement = require(\"../helpers/safeHTMLElement\");\n\nvar _safeHTMLElement2 = _interopRequireDefault(_safeHTMLElement);\n\nvar _portalOpenInstances = require(\"../helpers/portalOpenInstances\");\n\nvar _portalOpenInstances2 = _interopRequireDefault(_portalOpenInstances);\n\nrequire(\"../helpers/bodyTrap\");\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n// so that our CSS is statically analyzable\nvar CLASS_NAMES = {\n overlay: \"ReactModal__Overlay\",\n content: \"ReactModal__Content\"\n};\n\nvar TAB_KEY = 9;\nvar ESC_KEY = 27;\n\nvar ariaHiddenInstances = 0;\n\nvar ModalPortal = function (_Component) {\n _inherits(ModalPortal, _Component);\n\n function ModalPortal(props) {\n _classCallCheck(this, ModalPortal);\n\n var _this = _possibleConstructorReturn(this, (ModalPortal.__proto__ || Object.getPrototypeOf(ModalPortal)).call(this, props));\n\n _this.setOverlayRef = function (overlay) {\n _this.overlay = overlay;\n _this.props.overlayRef && _this.props.overlayRef(overlay);\n };\n\n _this.setContentRef = function (content) {\n _this.content = content;\n _this.props.contentRef && _this.props.contentRef(content);\n };\n\n _this.afterClose = function () {\n var _this$props = _this.props,\n appElement = _this$props.appElement,\n ariaHideApp = _this$props.ariaHideApp,\n htmlOpenClassName = _this$props.htmlOpenClassName,\n bodyOpenClassName = _this$props.bodyOpenClassName;\n\n // Remove classes.\n\n bodyOpenClassName && classList.remove(document.body, bodyOpenClassName);\n\n htmlOpenClassName && classList.remove(document.getElementsByTagName(\"html\")[0], htmlOpenClassName);\n\n // Reset aria-hidden attribute if all modals have been removed\n if (ariaHideApp && ariaHiddenInstances > 0) {\n ariaHiddenInstances -= 1;\n\n if (ariaHiddenInstances === 0) {\n ariaAppHider.show(appElement);\n }\n }\n\n if (_this.props.shouldFocusAfterRender) {\n if (_this.props.shouldReturnFocusAfterClose) {\n focusManager.returnFocus();\n focusManager.teardownScopedFocus();\n } else {\n focusManager.popWithoutFocus();\n }\n }\n\n if (_this.props.onAfterClose) {\n _this.props.onAfterClose();\n }\n\n _portalOpenInstances2.default.deregister(_this);\n };\n\n _this.open = function () {\n _this.beforeOpen();\n if (_this.state.afterOpen && _this.state.beforeClose) {\n clearTimeout(_this.closeTimer);\n _this.setState({ beforeClose: false });\n } else {\n if (_this.props.shouldFocusAfterRender) {\n focusManager.setupScopedFocus(_this.node);\n focusManager.markForFocusLater();\n }\n\n _this.setState({ isOpen: true }, function () {\n _this.setState({ afterOpen: true });\n\n if (_this.props.isOpen && _this.props.onAfterOpen) {\n _this.props.onAfterOpen({\n overlayEl: _this.overlay,\n contentEl: _this.content\n });\n }\n });\n }\n };\n\n _this.close = function () {\n if (_this.props.closeTimeoutMS > 0) {\n _this.closeWithTimeout();\n } else {\n _this.closeWithoutTimeout();\n }\n };\n\n _this.focusContent = function () {\n return _this.content && !_this.contentHasFocus() && _this.content.focus();\n };\n\n _this.closeWithTimeout = function () {\n var closesAt = Date.now() + _this.props.closeTimeoutMS;\n _this.setState({ beforeClose: true, closesAt: closesAt }, function () {\n _this.closeTimer = setTimeout(_this.closeWithoutTimeout, _this.state.closesAt - Date.now());\n });\n };\n\n _this.closeWithoutTimeout = function () {\n _this.setState({\n beforeClose: false,\n isOpen: false,\n afterOpen: false,\n closesAt: null\n }, _this.afterClose);\n };\n\n _this.handleKeyDown = function (event) {\n if (event.keyCode === TAB_KEY) {\n (0, _scopeTab2.default)(_this.content, event);\n }\n\n if (_this.props.shouldCloseOnEsc && event.keyCode === ESC_KEY) {\n event.stopPropagation();\n _this.requestClose(event);\n }\n };\n\n _this.handleOverlayOnClick = function (event) {\n if (_this.shouldClose === null) {\n _this.shouldClose = true;\n }\n\n if (_this.shouldClose && _this.props.shouldCloseOnOverlayClick) {\n if (_this.ownerHandlesClose()) {\n _this.requestClose(event);\n } else {\n _this.focusContent();\n }\n }\n _this.shouldClose = null;\n };\n\n _this.handleContentOnMouseUp = function () {\n _this.shouldClose = false;\n };\n\n _this.handleOverlayOnMouseDown = function (event) {\n if (!_this.props.shouldCloseOnOverlayClick && event.target == _this.overlay) {\n event.preventDefault();\n }\n };\n\n _this.handleContentOnClick = function () {\n _this.shouldClose = false;\n };\n\n _this.handleContentOnMouseDown = function () {\n _this.shouldClose = false;\n };\n\n _this.requestClose = function (event) {\n return _this.ownerHandlesClose() && _this.props.onRequestClose(event);\n };\n\n _this.ownerHandlesClose = function () {\n return _this.props.onRequestClose;\n };\n\n _this.shouldBeClosed = function () {\n return !_this.state.isOpen && !_this.state.beforeClose;\n };\n\n _this.contentHasFocus = function () {\n return document.activeElement === _this.content || _this.content.contains(document.activeElement);\n };\n\n _this.buildClassName = function (which, additional) {\n var classNames = (typeof additional === \"undefined\" ? \"undefined\" : _typeof(additional)) === \"object\" ? additional : {\n base: CLASS_NAMES[which],\n afterOpen: CLASS_NAMES[which] + \"--after-open\",\n beforeClose: CLASS_NAMES[which] + \"--before-close\"\n };\n var className = classNames.base;\n if (_this.state.afterOpen) {\n className = className + \" \" + classNames.afterOpen;\n }\n if (_this.state.beforeClose) {\n className = className + \" \" + classNames.beforeClose;\n }\n return typeof additional === \"string\" && additional ? className + \" \" + additional : className;\n };\n\n _this.attributesFromObject = function (prefix, items) {\n return Object.keys(items).reduce(function (acc, name) {\n acc[prefix + \"-\" + name] = items[name];\n return acc;\n }, {});\n };\n\n _this.state = {\n afterOpen: false,\n beforeClose: false\n };\n\n _this.shouldClose = null;\n _this.moveFromContentToOverlay = null;\n return _this;\n }\n\n _createClass(ModalPortal, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n if (this.props.isOpen) {\n this.open();\n }\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps, prevState) {\n if (process.env.NODE_ENV !== \"production\") {\n if (prevProps.bodyOpenClassName !== this.props.bodyOpenClassName) {\n // eslint-disable-next-line no-console\n console.warn('React-Modal: \"bodyOpenClassName\" prop has been modified. ' + \"This may cause unexpected behavior when multiple modals are open.\");\n }\n if (prevProps.htmlOpenClassName !== this.props.htmlOpenClassName) {\n // eslint-disable-next-line no-console\n console.warn('React-Modal: \"htmlOpenClassName\" prop has been modified. ' + \"This may cause unexpected behavior when multiple modals are open.\");\n }\n }\n\n if (this.props.isOpen && !prevProps.isOpen) {\n this.open();\n } else if (!this.props.isOpen && prevProps.isOpen) {\n this.close();\n }\n\n // Focus only needs to be set once when the modal is being opened\n if (this.props.shouldFocusAfterRender && this.state.isOpen && !prevState.isOpen) {\n this.focusContent();\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n if (this.state.isOpen) {\n this.afterClose();\n }\n clearTimeout(this.closeTimer);\n }\n }, {\n key: \"beforeOpen\",\n value: function beforeOpen() {\n var _props = this.props,\n appElement = _props.appElement,\n ariaHideApp = _props.ariaHideApp,\n htmlOpenClassName = _props.htmlOpenClassName,\n bodyOpenClassName = _props.bodyOpenClassName;\n\n // Add classes.\n\n bodyOpenClassName && classList.add(document.body, bodyOpenClassName);\n\n htmlOpenClassName && classList.add(document.getElementsByTagName(\"html\")[0], htmlOpenClassName);\n\n if (ariaHideApp) {\n ariaHiddenInstances += 1;\n ariaAppHider.hide(appElement);\n }\n\n _portalOpenInstances2.default.register(this);\n }\n\n // Don't steal focus from inner elements\n\n }, {\n key: \"render\",\n value: function render() {\n var _props2 = this.props,\n id = _props2.id,\n className = _props2.className,\n overlayClassName = _props2.overlayClassName,\n defaultStyles = _props2.defaultStyles;\n\n var contentStyles = className ? {} : defaultStyles.content;\n var overlayStyles = overlayClassName ? {} : defaultStyles.overlay;\n\n return this.shouldBeClosed() ? null : _react2.default.createElement(\n \"div\",\n {\n ref: this.setOverlayRef,\n className: this.buildClassName(\"overlay\", overlayClassName),\n style: _extends({}, overlayStyles, this.props.style.overlay),\n onClick: this.handleOverlayOnClick,\n onMouseDown: this.handleOverlayOnMouseDown\n },\n _react2.default.createElement(\n \"div\",\n _extends({\n id: id,\n ref: this.setContentRef,\n style: _extends({}, contentStyles, this.props.style.content),\n className: this.buildClassName(\"content\", className),\n tabIndex: \"-1\",\n onKeyDown: this.handleKeyDown,\n onMouseDown: this.handleContentOnMouseDown,\n onMouseUp: this.handleContentOnMouseUp,\n onClick: this.handleContentOnClick,\n role: this.props.role,\n \"aria-label\": this.props.contentLabel\n }, this.attributesFromObject(\"aria\", this.props.aria || {}), this.attributesFromObject(\"data\", this.props.data || {}), {\n \"data-testid\": this.props.testId\n }),\n this.props.children\n )\n );\n }\n }]);\n\n return ModalPortal;\n}(_react.Component);\n\nModalPortal.defaultProps = {\n style: {\n overlay: {},\n content: {}\n },\n defaultStyles: {}\n};\nModalPortal.propTypes = {\n isOpen: _propTypes2.default.bool.isRequired,\n defaultStyles: _propTypes2.default.shape({\n content: _propTypes2.default.object,\n overlay: _propTypes2.default.object\n }),\n style: _propTypes2.default.shape({\n content: _propTypes2.default.object,\n overlay: _propTypes2.default.object\n }),\n className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]),\n overlayClassName: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]),\n bodyOpenClassName: _propTypes2.default.string,\n htmlOpenClassName: _propTypes2.default.string,\n ariaHideApp: _propTypes2.default.bool,\n appElement: _propTypes2.default.instanceOf(_safeHTMLElement2.default),\n onAfterOpen: _propTypes2.default.func,\n onAfterClose: _propTypes2.default.func,\n onRequestClose: _propTypes2.default.func,\n closeTimeoutMS: _propTypes2.default.number,\n shouldFocusAfterRender: _propTypes2.default.bool,\n shouldCloseOnOverlayClick: _propTypes2.default.bool,\n shouldReturnFocusAfterClose: _propTypes2.default.bool,\n role: _propTypes2.default.string,\n contentLabel: _propTypes2.default.string,\n aria: _propTypes2.default.object,\n data: _propTypes2.default.object,\n children: _propTypes2.default.node,\n shouldCloseOnEsc: _propTypes2.default.bool,\n overlayRef: _propTypes2.default.func,\n contentRef: _propTypes2.default.func,\n id: _propTypes2.default.string,\n testId: _propTypes2.default.string\n};\nexports.default = ModalPortal;\nmodule.exports = exports[\"default\"];","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nfunction componentWillMount() {\n // Call this.constructor.gDSFP to support sub-classes.\n var state = this.constructor.getDerivedStateFromProps(this.props, this.state);\n if (state !== null && state !== undefined) {\n this.setState(state);\n }\n}\n\nfunction componentWillReceiveProps(nextProps) {\n // Call this.constructor.gDSFP to support sub-classes.\n // Use the setState() updater to ensure state isn't stale in certain edge cases.\n function updater(prevState) {\n var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);\n return state !== null && state !== undefined ? state : null;\n }\n // Binding \"this\" is important for shallow renderer support.\n this.setState(updater.bind(this));\n}\n\nfunction componentWillUpdate(nextProps, nextState) {\n try {\n var prevProps = this.props;\n var prevState = this.state;\n this.props = nextProps;\n this.state = nextState;\n this.__reactInternalSnapshotFlag = true;\n this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(\n prevProps,\n prevState\n );\n } finally {\n this.props = prevProps;\n this.state = prevState;\n }\n}\n\n// React may warn about cWM/cWRP/cWU methods being deprecated.\n// Add a flag to suppress these warnings for this special case.\ncomponentWillMount.__suppressDeprecationWarning = true;\ncomponentWillReceiveProps.__suppressDeprecationWarning = true;\ncomponentWillUpdate.__suppressDeprecationWarning = true;\n\nfunction polyfill(Component) {\n var prototype = Component.prototype;\n\n if (!prototype || !prototype.isReactComponent) {\n throw new Error('Can only polyfill class components');\n }\n\n if (\n typeof Component.getDerivedStateFromProps !== 'function' &&\n typeof prototype.getSnapshotBeforeUpdate !== 'function'\n ) {\n return Component;\n }\n\n // If new component APIs are defined, \"unsafe\" lifecycles won't be called.\n // Error if any of these lifecycles are present,\n // Because they would work differently between older and newer (16.3+) versions of React.\n var foundWillMountName = null;\n var foundWillReceivePropsName = null;\n var foundWillUpdateName = null;\n if (typeof prototype.componentWillMount === 'function') {\n foundWillMountName = 'componentWillMount';\n } else if (typeof prototype.UNSAFE_componentWillMount === 'function') {\n foundWillMountName = 'UNSAFE_componentWillMount';\n }\n if (typeof prototype.componentWillReceiveProps === 'function') {\n foundWillReceivePropsName = 'componentWillReceiveProps';\n } else if (typeof prototype.UNSAFE_componentWillReceiveProps === 'function') {\n foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';\n }\n if (typeof prototype.componentWillUpdate === 'function') {\n foundWillUpdateName = 'componentWillUpdate';\n } else if (typeof prototype.UNSAFE_componentWillUpdate === 'function') {\n foundWillUpdateName = 'UNSAFE_componentWillUpdate';\n }\n if (\n foundWillMountName !== null ||\n foundWillReceivePropsName !== null ||\n foundWillUpdateName !== null\n ) {\n var componentName = Component.displayName || Component.name;\n var newApiName =\n typeof Component.getDerivedStateFromProps === 'function'\n ? 'getDerivedStateFromProps()'\n : 'getSnapshotBeforeUpdate()';\n\n throw Error(\n 'Unsafe legacy lifecycles will not be called for components using new component APIs.\\n\\n' +\n componentName +\n ' uses ' +\n newApiName +\n ' but also contains the following legacy lifecycles:' +\n (foundWillMountName !== null ? '\\n ' + foundWillMountName : '') +\n (foundWillReceivePropsName !== null\n ? '\\n ' + foundWillReceivePropsName\n : '') +\n (foundWillUpdateName !== null ? '\\n ' + foundWillUpdateName : '') +\n '\\n\\nThe above lifecycles should be removed. Learn more about this warning here:\\n' +\n 'https://fb.me/react-async-component-lifecycle-hooks'\n );\n }\n\n // React <= 16.2 does not support static getDerivedStateFromProps.\n // As a workaround, use cWM and cWRP to invoke the new static lifecycle.\n // Newer versions of React will ignore these lifecycles if gDSFP exists.\n if (typeof Component.getDerivedStateFromProps === 'function') {\n prototype.componentWillMount = componentWillMount;\n prototype.componentWillReceiveProps = componentWillReceiveProps;\n }\n\n // React <= 16.2 does not support getSnapshotBeforeUpdate.\n // As a workaround, use cWU to invoke the new lifecycle.\n // Newer versions of React will ignore that lifecycle if gSBU exists.\n if (typeof prototype.getSnapshotBeforeUpdate === 'function') {\n if (typeof prototype.componentDidUpdate !== 'function') {\n throw new Error(\n 'Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype'\n );\n }\n\n prototype.componentWillUpdate = componentWillUpdate;\n\n var componentDidUpdate = prototype.componentDidUpdate;\n\n prototype.componentDidUpdate = function componentDidUpdatePolyfill(\n prevProps,\n prevState,\n maybeSnapshot\n ) {\n // 16.3+ will not execute our will-update method;\n // It will pass a snapshot value to did-update though.\n // Older versions will require our polyfilled will-update value.\n // We need to handle both cases, but can't just check for the presence of \"maybeSnapshot\",\n // Because for <= 15.x versions this might be a \"prevContext\" object.\n // We also can't just check \"__reactInternalSnapshot\",\n // Because get-snapshot might return a falsy value.\n // So check for the explicit __reactInternalSnapshotFlag flag to determine behavior.\n var snapshot = this.__reactInternalSnapshotFlag\n ? this.__reactInternalSnapshot\n : maybeSnapshot;\n\n componentDidUpdate.call(this, prevProps, prevState, snapshot);\n };\n }\n\n return Component;\n}\n\nexport { polyfill };\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.bodyOpenClassName = exports.portalClassName = undefined;\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _react = require(\"react\");\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _reactDom = require(\"react-dom\");\n\nvar _reactDom2 = _interopRequireDefault(_reactDom);\n\nvar _propTypes = require(\"prop-types\");\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _ModalPortal = require(\"./ModalPortal\");\n\nvar _ModalPortal2 = _interopRequireDefault(_ModalPortal);\n\nvar _ariaAppHider = require(\"../helpers/ariaAppHider\");\n\nvar ariaAppHider = _interopRequireWildcard(_ariaAppHider);\n\nvar _safeHTMLElement = require(\"../helpers/safeHTMLElement\");\n\nvar _safeHTMLElement2 = _interopRequireDefault(_safeHTMLElement);\n\nvar _reactLifecyclesCompat = require(\"react-lifecycles-compat\");\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar portalClassName = exports.portalClassName = \"ReactModalPortal\";\nvar bodyOpenClassName = exports.bodyOpenClassName = \"ReactModal__Body--open\";\n\nvar isReact16 = _reactDom2.default.createPortal !== undefined;\n\nvar getCreatePortal = function getCreatePortal() {\n return isReact16 ? _reactDom2.default.createPortal : _reactDom2.default.unstable_renderSubtreeIntoContainer;\n};\n\nfunction getParentElement(parentSelector) {\n return parentSelector();\n}\n\nvar Modal = function (_Component) {\n _inherits(Modal, _Component);\n\n function Modal() {\n var _ref;\n\n var _temp, _this, _ret;\n\n _classCallCheck(this, Modal);\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Modal.__proto__ || Object.getPrototypeOf(Modal)).call.apply(_ref, [this].concat(args))), _this), _this.removePortal = function () {\n !isReact16 && _reactDom2.default.unmountComponentAtNode(_this.node);\n var parent = getParentElement(_this.props.parentSelector);\n if (parent) {\n parent.removeChild(_this.node);\n } else {\n // eslint-disable-next-line no-console\n console.warn('React-Modal: \"parentSelector\" prop did not returned any DOM ' + \"element. Make sure that the parent element is unmounted to \" + \"avoid any memory leaks.\");\n }\n }, _this.portalRef = function (ref) {\n _this.portal = ref;\n }, _this.renderPortal = function (props) {\n var createPortal = getCreatePortal();\n var portal = createPortal(_this, _react2.default.createElement(_ModalPortal2.default, _extends({ defaultStyles: Modal.defaultStyles }, props)), _this.node);\n _this.portalRef(portal);\n }, _temp), _possibleConstructorReturn(_this, _ret);\n }\n\n _createClass(Modal, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n if (!_safeHTMLElement.canUseDOM) return;\n\n if (!isReact16) {\n this.node = document.createElement(\"div\");\n }\n this.node.className = this.props.portalClassName;\n\n var parent = getParentElement(this.props.parentSelector);\n parent.appendChild(this.node);\n\n !isReact16 && this.renderPortal(this.props);\n }\n }, {\n key: \"getSnapshotBeforeUpdate\",\n value: function getSnapshotBeforeUpdate(prevProps) {\n var prevParent = getParentElement(prevProps.parentSelector);\n var nextParent = getParentElement(this.props.parentSelector);\n return { prevParent: prevParent, nextParent: nextParent };\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps, _, snapshot) {\n if (!_safeHTMLElement.canUseDOM) return;\n var _props = this.props,\n isOpen = _props.isOpen,\n portalClassName = _props.portalClassName;\n\n\n if (prevProps.portalClassName !== portalClassName) {\n this.node.className = portalClassName;\n }\n\n var prevParent = snapshot.prevParent,\n nextParent = snapshot.nextParent;\n\n if (nextParent !== prevParent) {\n prevParent.removeChild(this.node);\n nextParent.appendChild(this.node);\n }\n\n // Stop unnecessary renders if modal is remaining closed\n if (!prevProps.isOpen && !isOpen) return;\n\n !isReact16 && this.renderPortal(this.props);\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n if (!_safeHTMLElement.canUseDOM || !this.node || !this.portal) return;\n\n var state = this.portal.state;\n var now = Date.now();\n var closesAt = state.isOpen && this.props.closeTimeoutMS && (state.closesAt || now + this.props.closeTimeoutMS);\n\n if (closesAt) {\n if (!state.beforeClose) {\n this.portal.closeWithTimeout();\n }\n\n setTimeout(this.removePortal, closesAt - now);\n } else {\n this.removePortal();\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n if (!_safeHTMLElement.canUseDOM || !isReact16) {\n return null;\n }\n\n if (!this.node && isReact16) {\n this.node = document.createElement(\"div\");\n }\n\n var createPortal = getCreatePortal();\n return createPortal(_react2.default.createElement(_ModalPortal2.default, _extends({\n ref: this.portalRef,\n defaultStyles: Modal.defaultStyles\n }, this.props)), this.node);\n }\n }], [{\n key: \"setAppElement\",\n value: function setAppElement(element) {\n ariaAppHider.setElement(element);\n }\n\n /* eslint-disable react/no-unused-prop-types */\n\n /* eslint-enable react/no-unused-prop-types */\n\n }]);\n\n return Modal;\n}(_react.Component);\n\nModal.propTypes = {\n isOpen: _propTypes2.default.bool.isRequired,\n style: _propTypes2.default.shape({\n content: _propTypes2.default.object,\n overlay: _propTypes2.default.object\n }),\n portalClassName: _propTypes2.default.string,\n bodyOpenClassName: _propTypes2.default.string,\n htmlOpenClassName: _propTypes2.default.string,\n className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.shape({\n base: _propTypes2.default.string.isRequired,\n afterOpen: _propTypes2.default.string.isRequired,\n beforeClose: _propTypes2.default.string.isRequired\n })]),\n overlayClassName: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.shape({\n base: _propTypes2.default.string.isRequired,\n afterOpen: _propTypes2.default.string.isRequired,\n beforeClose: _propTypes2.default.string.isRequired\n })]),\n appElement: _propTypes2.default.instanceOf(_safeHTMLElement2.default),\n onAfterOpen: _propTypes2.default.func,\n onRequestClose: _propTypes2.default.func,\n closeTimeoutMS: _propTypes2.default.number,\n ariaHideApp: _propTypes2.default.bool,\n shouldFocusAfterRender: _propTypes2.default.bool,\n shouldCloseOnOverlayClick: _propTypes2.default.bool,\n shouldReturnFocusAfterClose: _propTypes2.default.bool,\n parentSelector: _propTypes2.default.func,\n aria: _propTypes2.default.object,\n data: _propTypes2.default.object,\n role: _propTypes2.default.string,\n contentLabel: _propTypes2.default.string,\n shouldCloseOnEsc: _propTypes2.default.bool,\n overlayRef: _propTypes2.default.func,\n contentRef: _propTypes2.default.func\n};\nModal.defaultProps = {\n isOpen: false,\n portalClassName: portalClassName,\n bodyOpenClassName: bodyOpenClassName,\n role: \"dialog\",\n ariaHideApp: true,\n closeTimeoutMS: 0,\n shouldFocusAfterRender: true,\n shouldCloseOnEsc: true,\n shouldCloseOnOverlayClick: true,\n shouldReturnFocusAfterClose: true,\n parentSelector: function parentSelector() {\n return document.body;\n }\n};\nModal.defaultStyles = {\n overlay: {\n position: \"fixed\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: \"rgba(255, 255, 255, 0.75)\"\n },\n content: {\n position: \"absolute\",\n top: \"40px\",\n left: \"40px\",\n right: \"40px\",\n bottom: \"40px\",\n border: \"1px solid #ccc\",\n background: \"#fff\",\n overflow: \"auto\",\n WebkitOverflowScrolling: \"touch\",\n borderRadius: \"4px\",\n outline: \"none\",\n padding: \"20px\"\n }\n};\n\n\n(0, _reactLifecyclesCompat.polyfill)(Modal);\n\nexports.default = Modal;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _Modal = require(\"./components/Modal\");\n\nvar _Modal2 = _interopRequireDefault(_Modal);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = _Modal2.default;\nmodule.exports = exports[\"default\"];","import { styled } from '@edtr-io/ui';\nimport { createElement, forwardRef, useState, Fragment, useRef } from 'react';\nimport Modal from 'react-modal';\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nvar Button = /*#__PURE__*/styled.button(function (_ref) {\n var config = _ref.config;\n return {\n margin: '3px',\n backgroundColor: '#ffffff',\n outline: 'none',\n border: '2px solid rgba(51,51,51,0.95)',\n color: 'rgba(51,51,51,0.95)',\n padding: '10px',\n borderRadius: '4px',\n minWidth: '125px',\n cursor: 'pointer',\n '&:hover': {\n backgroundColor: 'transparent',\n color: 'rgb(70, 155, 255)',\n borderColor: config.primaryColor\n }\n };\n});\nfunction createOverlayButton(config) {\n return function OverlayButton(_ref2) {\n var children = _ref2.children,\n label = _ref2.label,\n props = _objectWithoutPropertiesLoose(_ref2, [\"children\", \"label\"]);\n\n return createElement(Button, Object.assign({}, props, {\n title: label,\n config: config\n }), children || label);\n };\n}\n\nvar OverlayCheckboxLabel = /*#__PURE__*/styled.label({\n color: 'rgba(51,51,51,0.95)',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n marginTop: '20px'\n});\nvar OverlayCheckboxToggleContainer = /*#__PURE__*/styled.div(function (_ref) {\n var value = _ref.value;\n return {\n cursor: 'pointer',\n border: '2px solid rgba(51,51,51,0.95)',\n borderRadius: '15%',\n width: '20px',\n height: '20px',\n display: 'inline-block',\n verticalAlign: 'middle',\n backgroundColor: value ? 'rgba(51,51,51,0.95)' : '#ffffff'\n };\n});\nvar OverlayCheckboxLabelInner = /*#__PURE__*/styled.span({\n width: '20%'\n});\nvar OverlayCheckboxToggle = /*#__PURE__*/styled.div(function (_ref2) {\n var value = _ref2.value;\n return {\n opacity: value ? 1 : 0,\n content: '',\n position: 'absolute',\n fontWeight: 'bold',\n width: '20px',\n height: '10px',\n border: '3px solid #ffffff',\n borderTop: 'none',\n borderRight: 'none',\n borderRadius: '1px',\n transform: 'rotate(-45deg)',\n zIndex: 1000\n };\n});\nvar OverlayCheckboxInner = /*#__PURE__*/styled.div({\n width: '75%',\n textAlign: 'left'\n});\nfunction createOverlayCheckbox(_config) {\n return function OverlayCheckbox(_ref3) {\n var checked = _ref3.checked,\n onChange = _ref3.onChange,\n label = _ref3.label;\n return createElement(OverlayCheckboxLabel, null, createElement(OverlayCheckboxLabelInner, null, label), createElement(OverlayCheckboxInner, null, createElement(OverlayCheckboxToggleContainer, {\n onClick: function onClick() {\n if (onChange) {\n onChange(!checked);\n }\n },\n value: checked\n }, createElement(OverlayCheckboxToggle, {\n value: checked\n }))));\n };\n}\n\nvar OverlayInputLabel = /*#__PURE__*/styled.label({\n color: 'rgba(51,51,51,0.95)',\n margin: '20px auto 0px',\n display: 'flex',\n justifyContent: 'space-between',\n alignItems: 'center'\n});\nvar OverlayInputLabelInner = /*#__PURE__*/styled.span({\n width: '20%'\n});\nvar OverlayInputInner = /*#__PURE__*/styled.input(function (_ref) {\n var config = _ref.config;\n return {\n backgroundColor: '#ffffff',\n border: 'none',\n borderBottom: '2px solid rgba(51,51,51,0.95)',\n color: 'rgba(51,51,51,0.95)',\n width: '75%',\n '&:focus': {\n outline: 'none',\n borderBottom: \"2px solid \" + config.primaryColor\n }\n };\n});\nfunction createOverlayInput(config) {\n var OverlayInput = forwardRef(function OverlayInput(_ref2, ref) {\n var label = _ref2.label,\n props = _objectWithoutPropertiesLoose(_ref2, [\"label\"]);\n\n return createElement(OverlayInputLabel, null, createElement(OverlayInputLabelInner, null, label), createElement(OverlayInputInner, Object.assign({}, props, {\n ref: ref,\n config: config\n })));\n });\n return OverlayInput;\n}\n\nvar OverlayInputLabel$1 = /*#__PURE__*/styled.label({\n color: 'rgba(51,51,51,0.95)',\n margin: '20px auto 0px',\n display: 'flex',\n justifyContent: 'space-between',\n alignItems: 'center'\n});\nvar OverlayInputLabelInner$1 = /*#__PURE__*/styled.span({\n width: '20%'\n});\nvar OverlaySelectInner = /*#__PURE__*/styled.div({\n width: '75%',\n textAlign: 'left'\n});\nvar Select = /*#__PURE__*/styled.select(function (props) {\n return {\n width: props.selectBoxWidth,\n borderRadius: '5px',\n outline: 'none'\n };\n});\nfunction createOverlaySelect(_config) {\n return function OverlaySelect(_ref) {\n var label = _ref.label,\n options = _ref.options,\n props = _objectWithoutPropertiesLoose(_ref, [\"label\", \"options\"]);\n\n return createElement(OverlayInputLabel$1, null, createElement(OverlayInputLabelInner$1, null, label), createElement(OverlaySelectInner, null, createElement(Select, {\n selectBoxWidth: props.width,\n onChange: props.onChange,\n value: props.value\n }, options.map(function (option, index) {\n return createElement(\"option\", {\n key: index,\n value: option\n }, option);\n }))));\n };\n}\n\nvar OverlayTextareaLabel = /*#__PURE__*/styled.label({\n color: 'rgba(51,51,51,0.95)',\n display: 'flex',\n flexDirection: 'row',\n margin: '20px auto 0',\n justifyContent: 'space-between'\n});\nvar OverlayTextareaLabelInner = /*#__PURE__*/styled.span({\n width: '20%'\n});\nvar OverlayTextareaInner = /*#__PURE__*/styled.textarea(function (_ref) {\n var config = _ref.config;\n return {\n backgroundColor: '#ffffff',\n border: '2px solid rgba(51,51,51,0.95)',\n marginTop: '5px',\n borderRadius: '5px',\n color: '2px solid rgba(51,51,51,0.95)',\n padding: '10px',\n resize: 'none',\n outline: 'none',\n minHeight: '100px',\n width: '75%',\n '&:focus': {\n border: \"2px solid \" + config.primaryColor\n }\n };\n});\nfunction createOverlayTextarea(config) {\n return function OverlayTextarea(_ref2) {\n var label = _ref2.label,\n props = _objectWithoutPropertiesLoose(_ref2, [\"label\"]);\n\n return createElement(OverlayTextareaLabel, null, createElement(OverlayTextareaLabelInner, null, label), createElement(OverlayTextareaInner, Object.assign({}, props, {\n ref: undefined,\n config: config\n })));\n };\n}\n\nvar Button$1 = /*#__PURE__*/styled.button({\n background: 'none',\n border: 'none'\n});\n\nvar StyledIconContainer = /*#__PURE__*/styled.div({\n height: '24px',\n opacity: 0.8,\n cursor: 'pointer',\n color: 'rgba(51, 51, 51, 0.95)',\n '&:hover': {\n color: '#469bff'\n }\n});\n\nfunction createPluginToolbarButton(_config) {\n var PluginToolbarButton = forwardRef(function PluginToolbarButton(props, ref) {\n return createElement(\"div\", null, createElement(Button$1, {\n className: props.className,\n title: props.label,\n ref: ref,\n onClick: props.onClick\n }, createElement(StyledIconContainer, null, props.icon)));\n });\n return PluginToolbarButton;\n}\n\nfunction createPluginToolbarOverlayButton(_config) {\n return function PluginToolbarOverlayButton(_ref) {\n var className = _ref.className,\n icon = _ref.icon,\n label = _ref.label,\n modalProps = _objectWithoutPropertiesLoose(_ref, [\"className\", \"icon\", \"label\"]);\n\n var _React$useState = useState(false),\n open = _React$useState[0],\n setOpen = _React$useState[1];\n\n return createElement(Fragment, null, createElement(WrappedModal, Object.assign({}, modalProps, {\n isOpen: open,\n onRequestClose: function onRequestClose() {\n setOpen(false);\n }\n })), createElement(Button$1, {\n className: className,\n onClick: function onClick() {\n setOpen(true);\n },\n title: label\n }, createElement(StyledIconContainer, null, icon)));\n };\n}\n\nfunction WrappedModal(_ref2) {\n var renderContent = _ref2.renderContent,\n contentRef = _ref2.contentRef,\n props = _objectWithoutPropertiesLoose(_ref2, [\"renderContent\", \"contentRef\"]);\n\n var appended = useRef(false);\n var children = createElement(\"div\", {\n ref: function ref(_ref3) {\n // The ref `appended` ensures that we only append the content once so that we don't lose focus on every render\n if (_ref3 && contentRef.current && !appended.current) {\n appended.current = true;\n\n _ref3.appendChild(contentRef.current);\n } else if (!props.isOpen) {\n appended.current = false;\n }\n }\n });\n return createElement(Modal, Object.assign({}, props, {\n ariaHideApp: false,\n style: {\n overlay: {\n zIndex: 9999,\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: 'rgba(0, 0, 0, 0.1)'\n },\n content: {\n borderRadius: 0,\n backgroundColor: '#ffffff',\n width: '90%',\n maxWidth: '600px',\n inset: 'auto',\n margin: '0 auto'\n }\n }\n }), renderContent ? renderContent(children, {\n close: function close() {\n props.onRequestClose();\n }\n }) : children);\n}\n\n/**\r\n * Creates the default {@link @edtr-io/plugin-toolbar#PluginToolbar | plugin toolbar}\r\n *\r\n * @param config - Optional configuration\r\n * @returns The default {@link @edtr-io/plugin-toolbar#PluginToolbar | plugin toolbar}\r\n * @beta\r\n */\n\nfunction createDefaultPluginToolbar(config) {\n if (config === void 0) {\n config = {\n primaryColor: 'rgb(70, 155, 255)'\n };\n }\n\n return {\n OverlayButton: createOverlayButton(config),\n OverlayCheckbox: createOverlayCheckbox(),\n OverlayInput: createOverlayInput(config),\n OverlaySelect: createOverlaySelect(),\n OverlayTextarea: createOverlayTextarea(config),\n PluginToolbarButton: createPluginToolbarButton(),\n PluginToolbarOverlayButton: createPluginToolbarOverlayButton()\n };\n}\n\nexport { createDefaultPluginToolbar };\n\n","export var HandlerRole;\n\n(function (HandlerRole) {\n HandlerRole[\"SOURCE\"] = \"SOURCE\";\n HandlerRole[\"TARGET\"] = \"TARGET\";\n})(HandlerRole || (HandlerRole = {}));","export var INIT_COORDS = 'dnd-core/INIT_COORDS';\nexport var BEGIN_DRAG = 'dnd-core/BEGIN_DRAG';\nexport var PUBLISH_DRAG_SOURCE = 'dnd-core/PUBLISH_DRAG_SOURCE';\nexport var HOVER = 'dnd-core/HOVER';\nexport var DROP = 'dnd-core/DROP';\nexport var END_DRAG = 'dnd-core/END_DRAG';","import { INIT_COORDS } from '../types';\nexport function setClientOffset(clientOffset, sourceClientOffset) {\n return {\n type: INIT_COORDS,\n payload: {\n sourceClientOffset: sourceClientOffset || null,\n clientOffset: clientOffset || null\n }\n };\n}","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n// cheap lodash replacements\n\n/**\n * drop-in replacement for _.get\n * @param obj\n * @param path\n * @param defaultValue\n */\nexport function get(obj, path, defaultValue) {\n return path.split('.').reduce(function (a, c) {\n return a && a[c] ? a[c] : defaultValue || null;\n }, obj);\n}\n/**\n * drop-in replacement for _.without\n */\n\nexport function without(items, item) {\n return items.filter(function (i) {\n return i !== item;\n });\n}\n/**\n * drop-in replacement for _.isString\n * @param input\n */\n\nexport function isString(input) {\n return typeof input === 'string';\n}\n/**\n * drop-in replacement for _.isString\n * @param input\n */\n\nexport function isObject(input) {\n return _typeof(input) === 'object';\n}\n/**\n * repalcement for _.xor\n * @param itemsA\n * @param itemsB\n */\n\nexport function xor(itemsA, itemsB) {\n var map = new Map();\n\n var insertItem = function insertItem(item) {\n return map.set(item, map.has(item) ? map.get(item) + 1 : 1);\n };\n\n itemsA.forEach(insertItem);\n itemsB.forEach(insertItem);\n var result = [];\n map.forEach(function (count, key) {\n if (count === 1) {\n result.push(key);\n }\n });\n return result;\n}\n/**\n * replacement for _.intersection\n * @param itemsA\n * @param itemsB\n */\n\nexport function intersection(itemsA, itemsB) {\n return itemsA.filter(function (t) {\n return itemsB.indexOf(t) > -1;\n });\n}","import { invariant } from '@react-dnd/invariant';\nimport { setClientOffset } from './local/setClientOffset';\nimport { isObject } from '../../utils/js_utils';\nimport { BEGIN_DRAG, INIT_COORDS } from './types';\nvar ResetCoordinatesAction = {\n type: INIT_COORDS,\n payload: {\n clientOffset: null,\n sourceClientOffset: null\n }\n};\nexport default function createBeginDrag(manager) {\n return function beginDrag() {\n var sourceIds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n publishSource: true\n };\n var _options$publishSourc = options.publishSource,\n publishSource = _options$publishSourc === void 0 ? true : _options$publishSourc,\n clientOffset = options.clientOffset,\n getSourceClientOffset = options.getSourceClientOffset;\n var monitor = manager.getMonitor();\n var registry = manager.getRegistry(); // Initialize the coordinates using the client offset\n\n manager.dispatch(setClientOffset(clientOffset));\n verifyInvariants(sourceIds, monitor, registry); // Get the draggable source\n\n var sourceId = getDraggableSource(sourceIds, monitor);\n\n if (sourceId === null) {\n manager.dispatch(ResetCoordinatesAction);\n return;\n } // Get the source client offset\n\n\n var sourceClientOffset = null;\n\n if (clientOffset) {\n verifyGetSourceClientOffsetIsFunction(getSourceClientOffset);\n sourceClientOffset = getSourceClientOffset(sourceId);\n } // Initialize the full coordinates\n\n\n manager.dispatch(setClientOffset(clientOffset, sourceClientOffset));\n var source = registry.getSource(sourceId);\n var item = source.beginDrag(monitor, sourceId);\n verifyItemIsObject(item);\n registry.pinSource(sourceId);\n var itemType = registry.getSourceType(sourceId);\n return {\n type: BEGIN_DRAG,\n payload: {\n itemType: itemType,\n item: item,\n sourceId: sourceId,\n clientOffset: clientOffset || null,\n sourceClientOffset: sourceClientOffset || null,\n isSourcePublic: !!publishSource\n }\n };\n };\n}\n\nfunction verifyInvariants(sourceIds, monitor, registry) {\n invariant(!monitor.isDragging(), 'Cannot call beginDrag while dragging.');\n sourceIds.forEach(function (sourceId) {\n invariant(registry.getSource(sourceId), 'Expected sourceIds to be registered.');\n });\n}\n\nfunction verifyGetSourceClientOffsetIsFunction(getSourceClientOffset) {\n invariant(typeof getSourceClientOffset === 'function', 'When clientOffset is provided, getSourceClientOffset must be a function.');\n}\n\nfunction verifyItemIsObject(item) {\n invariant(isObject(item), 'Item must be an object.');\n}\n\nfunction getDraggableSource(sourceIds, monitor) {\n var sourceId = null;\n\n for (var i = sourceIds.length - 1; i >= 0; i--) {\n if (monitor.canDragSource(sourceIds[i])) {\n sourceId = sourceIds[i];\n break;\n }\n }\n\n return sourceId;\n}","import { PUBLISH_DRAG_SOURCE } from './types';\nexport default function createPublishDragSource(manager) {\n return function publishDragSource() {\n var monitor = manager.getMonitor();\n\n if (monitor.isDragging()) {\n return {\n type: PUBLISH_DRAG_SOURCE\n };\n }\n };\n}","export default function matchesType(targetType, draggedItemType) {\n if (draggedItemType === null) {\n return targetType === null;\n }\n\n return Array.isArray(targetType) ? targetType.some(function (t) {\n return t === draggedItemType;\n }) : targetType === draggedItemType;\n}","import { invariant } from '@react-dnd/invariant';\nimport matchesType from '../../utils/matchesType';\nimport { HOVER } from './types';\nexport default function createHover(manager) {\n return function hover(targetIdsArg) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n clientOffset = _ref.clientOffset;\n\n verifyTargetIdsIsArray(targetIdsArg);\n var targetIds = targetIdsArg.slice(0);\n var monitor = manager.getMonitor();\n var registry = manager.getRegistry();\n checkInvariants(targetIds, monitor, registry);\n var draggedItemType = monitor.getItemType();\n removeNonMatchingTargetIds(targetIds, registry, draggedItemType);\n hoverAllTargets(targetIds, monitor, registry);\n return {\n type: HOVER,\n payload: {\n targetIds: targetIds,\n clientOffset: clientOffset || null\n }\n };\n };\n}\n\nfunction verifyTargetIdsIsArray(targetIdsArg) {\n invariant(Array.isArray(targetIdsArg), 'Expected targetIds to be an array.');\n}\n\nfunction checkInvariants(targetIds, monitor, registry) {\n invariant(monitor.isDragging(), 'Cannot call hover while not dragging.');\n invariant(!monitor.didDrop(), 'Cannot call hover after drop.');\n\n for (var i = 0; i < targetIds.length; i++) {\n var targetId = targetIds[i];\n invariant(targetIds.lastIndexOf(targetId) === i, 'Expected targetIds to be unique in the passed array.');\n var target = registry.getTarget(targetId);\n invariant(target, 'Expected targetIds to be registered.');\n }\n}\n\nfunction removeNonMatchingTargetIds(targetIds, registry, draggedItemType) {\n // Remove those targetIds that don't match the targetType. This\n // fixes shallow isOver which would only be non-shallow because of\n // non-matching targets.\n for (var i = targetIds.length - 1; i >= 0; i--) {\n var targetId = targetIds[i];\n var targetType = registry.getTargetType(targetId);\n\n if (!matchesType(targetType, draggedItemType)) {\n targetIds.splice(i, 1);\n }\n }\n}\n\nfunction hoverAllTargets(targetIds, monitor, registry) {\n // Finally call hover on all matching targets.\n targetIds.forEach(function (targetId) {\n var target = registry.getTarget(targetId);\n target.hover(monitor, targetId);\n });\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { invariant } from '@react-dnd/invariant';\nimport { DROP } from './types';\nimport { isObject } from '../../utils/js_utils';\nexport default function createDrop(manager) {\n return function drop() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var monitor = manager.getMonitor();\n var registry = manager.getRegistry();\n verifyInvariants(monitor);\n var targetIds = getDroppableTargets(monitor); // Multiple actions are dispatched here, which is why this doesn't return an action\n\n targetIds.forEach(function (targetId, index) {\n var dropResult = determineDropResult(targetId, index, registry, monitor);\n var action = {\n type: DROP,\n payload: {\n dropResult: _objectSpread({}, options, {}, dropResult)\n }\n };\n manager.dispatch(action);\n });\n };\n}\n\nfunction verifyInvariants(monitor) {\n invariant(monitor.isDragging(), 'Cannot call drop while not dragging.');\n invariant(!monitor.didDrop(), 'Cannot call drop twice during one drag operation.');\n}\n\nfunction determineDropResult(targetId, index, registry, monitor) {\n var target = registry.getTarget(targetId);\n var dropResult = target ? target.drop(monitor, targetId) : undefined;\n verifyDropResultType(dropResult);\n\n if (typeof dropResult === 'undefined') {\n dropResult = index === 0 ? {} : monitor.getDropResult();\n }\n\n return dropResult;\n}\n\nfunction verifyDropResultType(dropResult) {\n invariant(typeof dropResult === 'undefined' || isObject(dropResult), 'Drop result must either be an object or undefined.');\n}\n\nfunction getDroppableTargets(monitor) {\n var targetIds = monitor.getTargetIds().filter(monitor.canDropOnTarget, monitor);\n targetIds.reverse();\n return targetIds;\n}","import { invariant } from '@react-dnd/invariant';\nimport { END_DRAG } from './types';\nexport default function createEndDrag(manager) {\n return function endDrag() {\n var monitor = manager.getMonitor();\n var registry = manager.getRegistry();\n verifyIsDragging(monitor);\n var sourceId = monitor.getSourceId();\n var source = registry.getSource(sourceId, true);\n source.endDrag(monitor, sourceId);\n registry.unpinSource();\n return {\n type: END_DRAG\n };\n };\n}\n\nfunction verifyIsDragging(monitor) {\n invariant(monitor.isDragging(), 'Cannot call endDrag while not dragging.');\n}","import createBeginDrag from './beginDrag';\nimport createPublishDragSource from './publishDragSource';\nimport createHover from './hover';\nimport createDrop from './drop';\nimport createEndDrag from './endDrag';\nexport * from './types';\nexport default function createDragDropActions(manager) {\n return {\n beginDrag: createBeginDrag(manager),\n publishDragSource: createPublishDragSource(manager),\n hover: createHover(manager),\n drop: createDrop(manager),\n endDrag: createEndDrag(manager)\n };\n}","export var strictEquality = function strictEquality(a, b) {\n return a === b;\n};\n/**\n * Determine if two cartesian coordinate offsets are equal\n * @param offsetA\n * @param offsetB\n */\n\nexport function areCoordsEqual(offsetA, offsetB) {\n if (!offsetA && !offsetB) {\n return true;\n } else if (!offsetA || !offsetB) {\n return false;\n } else {\n return offsetA.x === offsetB.x && offsetA.y === offsetB.y;\n }\n}\n/**\n * Determines if two arrays of items are equal\n * @param a The first array of items\n * @param b The second array of items\n */\n\nexport function areArraysEqual(a, b) {\n var isEqual = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : strictEquality;\n\n if (a.length !== b.length) {\n return false;\n }\n\n for (var i = 0; i < a.length; ++i) {\n if (!isEqual(a[i], b[i])) {\n return false;\n }\n }\n\n return true;\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { INIT_COORDS, BEGIN_DRAG, HOVER, END_DRAG, DROP } from '../actions/dragDrop';\nimport { areCoordsEqual } from '../utils/equality';\nvar initialState = {\n initialSourceClientOffset: null,\n initialClientOffset: null,\n clientOffset: null\n};\nexport default function dragOffset() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;\n var action = arguments.length > 1 ? arguments[1] : undefined;\n var payload = action.payload;\n\n switch (action.type) {\n case INIT_COORDS:\n case BEGIN_DRAG:\n return {\n initialSourceClientOffset: payload.sourceClientOffset,\n initialClientOffset: payload.clientOffset,\n clientOffset: payload.clientOffset\n };\n\n case HOVER:\n if (areCoordsEqual(state.clientOffset, payload.clientOffset)) {\n return state;\n }\n\n return _objectSpread({}, state, {\n clientOffset: payload.clientOffset\n });\n\n case END_DRAG:\n case DROP:\n return initialState;\n\n default:\n return state;\n }\n}","export var ADD_SOURCE = 'dnd-core/ADD_SOURCE';\nexport var ADD_TARGET = 'dnd-core/ADD_TARGET';\nexport var REMOVE_SOURCE = 'dnd-core/REMOVE_SOURCE';\nexport var REMOVE_TARGET = 'dnd-core/REMOVE_TARGET';\nexport function addSource(sourceId) {\n return {\n type: ADD_SOURCE,\n payload: {\n sourceId: sourceId\n }\n };\n}\nexport function addTarget(targetId) {\n return {\n type: ADD_TARGET,\n payload: {\n targetId: targetId\n }\n };\n}\nexport function removeSource(sourceId) {\n return {\n type: REMOVE_SOURCE,\n payload: {\n sourceId: sourceId\n }\n };\n}\nexport function removeTarget(targetId) {\n return {\n type: REMOVE_TARGET,\n payload: {\n targetId: targetId\n }\n };\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { BEGIN_DRAG, PUBLISH_DRAG_SOURCE, HOVER, END_DRAG, DROP } from '../actions/dragDrop';\nimport { REMOVE_TARGET } from '../actions/registry';\nimport { without } from '../utils/js_utils';\nvar initialState = {\n itemType: null,\n item: null,\n sourceId: null,\n targetIds: [],\n dropResult: null,\n didDrop: false,\n isSourcePublic: null\n};\nexport default function dragOperation() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;\n var action = arguments.length > 1 ? arguments[1] : undefined;\n var payload = action.payload;\n\n switch (action.type) {\n case BEGIN_DRAG:\n return _objectSpread({}, state, {\n itemType: payload.itemType,\n item: payload.item,\n sourceId: payload.sourceId,\n isSourcePublic: payload.isSourcePublic,\n dropResult: null,\n didDrop: false\n });\n\n case PUBLISH_DRAG_SOURCE:\n return _objectSpread({}, state, {\n isSourcePublic: true\n });\n\n case HOVER:\n return _objectSpread({}, state, {\n targetIds: payload.targetIds\n });\n\n case REMOVE_TARGET:\n if (state.targetIds.indexOf(payload.targetId) === -1) {\n return state;\n }\n\n return _objectSpread({}, state, {\n targetIds: without(state.targetIds, payload.targetId)\n });\n\n case DROP:\n return _objectSpread({}, state, {\n dropResult: payload.dropResult,\n didDrop: true,\n targetIds: []\n });\n\n case END_DRAG:\n return _objectSpread({}, state, {\n itemType: null,\n item: null,\n sourceId: null,\n dropResult: null,\n didDrop: false,\n isSourcePublic: null,\n targetIds: []\n });\n\n default:\n return state;\n }\n}","import { ADD_SOURCE, ADD_TARGET, REMOVE_SOURCE, REMOVE_TARGET } from '../actions/registry';\nexport default function refCount() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var action = arguments.length > 1 ? arguments[1] : undefined;\n\n switch (action.type) {\n case ADD_SOURCE:\n case ADD_TARGET:\n return state + 1;\n\n case REMOVE_SOURCE:\n case REMOVE_TARGET:\n return state - 1;\n\n default:\n return state;\n }\n}","import { intersection } from './js_utils';\nexport var NONE = [];\nexport var ALL = [];\nNONE.__IS_NONE__ = true;\nALL.__IS_ALL__ = true;\n/**\n * Determines if the given handler IDs are dirty or not.\n *\n * @param dirtyIds The set of dirty handler ids\n * @param handlerIds The set of handler ids to check\n */\n\nexport function areDirty(dirtyIds, handlerIds) {\n if (dirtyIds === NONE) {\n return false;\n }\n\n if (dirtyIds === ALL || typeof handlerIds === 'undefined') {\n return true;\n }\n\n var commonIds = intersection(handlerIds, dirtyIds);\n return commonIds.length > 0;\n}","import { BEGIN_DRAG, PUBLISH_DRAG_SOURCE, HOVER, END_DRAG, DROP } from '../actions/dragDrop';\nimport { ADD_SOURCE, ADD_TARGET, REMOVE_SOURCE, REMOVE_TARGET } from '../actions/registry';\nimport { areArraysEqual } from '../utils/equality';\nimport { NONE, ALL } from '../utils/dirtiness';\nimport { xor } from '../utils/js_utils';\nexport default function dirtyHandlerIds() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : NONE;\n var action = arguments.length > 1 ? arguments[1] : undefined;\n\n switch (action.type) {\n case HOVER:\n break;\n\n case ADD_SOURCE:\n case ADD_TARGET:\n case REMOVE_TARGET:\n case REMOVE_SOURCE:\n return NONE;\n\n case BEGIN_DRAG:\n case PUBLISH_DRAG_SOURCE:\n case END_DRAG:\n case DROP:\n default:\n return ALL;\n }\n\n var _action$payload = action.payload,\n _action$payload$targe = _action$payload.targetIds,\n targetIds = _action$payload$targe === void 0 ? [] : _action$payload$targe,\n _action$payload$prevT = _action$payload.prevTargetIds,\n prevTargetIds = _action$payload$prevT === void 0 ? [] : _action$payload$prevT;\n var result = xor(targetIds, prevTargetIds);\n var didChange = result.length > 0 || !areArraysEqual(targetIds, prevTargetIds);\n\n if (!didChange) {\n return NONE;\n } // Check the target ids at the innermost position. If they are valid, add them\n // to the result\n\n\n var prevInnermostTargetId = prevTargetIds[prevTargetIds.length - 1];\n var innermostTargetId = targetIds[targetIds.length - 1];\n\n if (prevInnermostTargetId !== innermostTargetId) {\n if (prevInnermostTargetId) {\n result.push(prevInnermostTargetId);\n }\n\n if (innermostTargetId) {\n result.push(innermostTargetId);\n }\n }\n\n return result;\n}","export default function stateId() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n return state + 1;\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport dragOffset from './dragOffset';\nimport dragOperation from './dragOperation';\nimport refCount from './refCount';\nimport dirtyHandlerIds from './dirtyHandlerIds';\nimport stateId from './stateId';\nimport { get } from '../utils/js_utils';\nexport default function reduce() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var action = arguments.length > 1 ? arguments[1] : undefined;\n return {\n dirtyHandlerIds: dirtyHandlerIds(state.dirtyHandlerIds, {\n type: action.type,\n payload: _objectSpread({}, action.payload, {\n prevTargetIds: get(state, 'dragOperation.targetIds', [])\n })\n }),\n dragOffset: dragOffset(state.dragOffset, action),\n refCount: refCount(state.refCount, action),\n dragOperation: dragOperation(state.dragOperation, action),\n stateId: stateId(state.stateId)\n };\n}","/**\n * Coordinate addition\n * @param a The first coordinate\n * @param b The second coordinate\n */\nexport function add(a, b) {\n return {\n x: a.x + b.x,\n y: a.y + b.y\n };\n}\n/**\n * Coordinate subtraction\n * @param a The first coordinate\n * @param b The second coordinate\n */\n\nexport function subtract(a, b) {\n return {\n x: a.x - b.x,\n y: a.y - b.y\n };\n}\n/**\n * Returns the cartesian distance of the drag source component's position, based on its position\n * at the time when the current drag operation has started, and the movement difference.\n *\n * Returns null if no item is being dragged.\n *\n * @param state The offset state to compute from\n */\n\nexport function getSourceClientOffset(state) {\n var clientOffset = state.clientOffset,\n initialClientOffset = state.initialClientOffset,\n initialSourceClientOffset = state.initialSourceClientOffset;\n\n if (!clientOffset || !initialClientOffset || !initialSourceClientOffset) {\n return null;\n }\n\n return subtract(add(clientOffset, initialSourceClientOffset), initialClientOffset);\n}\n/**\n * Determines the x,y offset between the client offset and the initial client offset\n *\n * @param state The offset state to compute from\n */\n\nexport function getDifferenceFromInitialOffset(state) {\n var clientOffset = state.clientOffset,\n initialClientOffset = state.initialClientOffset;\n\n if (!clientOffset || !initialClientOffset) {\n return null;\n }\n\n return subtract(clientOffset, initialClientOffset);\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { invariant } from '@react-dnd/invariant';\nimport matchesType from './utils/matchesType';\nimport { getSourceClientOffset as _getSourceClientOffset, getDifferenceFromInitialOffset as _getDifferenceFromInitialOffset } from './utils/coords';\nimport { areDirty } from './utils/dirtiness';\n\nvar DragDropMonitorImpl =\n/*#__PURE__*/\nfunction () {\n function DragDropMonitorImpl(store, registry) {\n _classCallCheck(this, DragDropMonitorImpl);\n\n this.store = store;\n this.registry = registry;\n }\n\n _createClass(DragDropMonitorImpl, [{\n key: \"subscribeToStateChange\",\n value: function subscribeToStateChange(listener) {\n var _this = this;\n\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n handlerIds: undefined\n };\n var handlerIds = options.handlerIds;\n invariant(typeof listener === 'function', 'listener must be a function.');\n invariant(typeof handlerIds === 'undefined' || Array.isArray(handlerIds), 'handlerIds, when specified, must be an array of strings.');\n var prevStateId = this.store.getState().stateId;\n\n var handleChange = function handleChange() {\n var state = _this.store.getState();\n\n var currentStateId = state.stateId;\n\n try {\n var canSkipListener = currentStateId === prevStateId || currentStateId === prevStateId + 1 && !areDirty(state.dirtyHandlerIds, handlerIds);\n\n if (!canSkipListener) {\n listener();\n }\n } finally {\n prevStateId = currentStateId;\n }\n };\n\n return this.store.subscribe(handleChange);\n }\n }, {\n key: \"subscribeToOffsetChange\",\n value: function subscribeToOffsetChange(listener) {\n var _this2 = this;\n\n invariant(typeof listener === 'function', 'listener must be a function.');\n var previousState = this.store.getState().dragOffset;\n\n var handleChange = function handleChange() {\n var nextState = _this2.store.getState().dragOffset;\n\n if (nextState === previousState) {\n return;\n }\n\n previousState = nextState;\n listener();\n };\n\n return this.store.subscribe(handleChange);\n }\n }, {\n key: \"canDragSource\",\n value: function canDragSource(sourceId) {\n if (!sourceId) {\n return false;\n }\n\n var source = this.registry.getSource(sourceId);\n invariant(source, 'Expected to find a valid source.');\n\n if (this.isDragging()) {\n return false;\n }\n\n return source.canDrag(this, sourceId);\n }\n }, {\n key: \"canDropOnTarget\",\n value: function canDropOnTarget(targetId) {\n // undefined on initial render\n if (!targetId) {\n return false;\n }\n\n var target = this.registry.getTarget(targetId);\n invariant(target, 'Expected to find a valid target.');\n\n if (!this.isDragging() || this.didDrop()) {\n return false;\n }\n\n var targetType = this.registry.getTargetType(targetId);\n var draggedItemType = this.getItemType();\n return matchesType(targetType, draggedItemType) && target.canDrop(this, targetId);\n }\n }, {\n key: \"isDragging\",\n value: function isDragging() {\n return Boolean(this.getItemType());\n }\n }, {\n key: \"isDraggingSource\",\n value: function isDraggingSource(sourceId) {\n // undefined on initial render\n if (!sourceId) {\n return false;\n }\n\n var source = this.registry.getSource(sourceId, true);\n invariant(source, 'Expected to find a valid source.');\n\n if (!this.isDragging() || !this.isSourcePublic()) {\n return false;\n }\n\n var sourceType = this.registry.getSourceType(sourceId);\n var draggedItemType = this.getItemType();\n\n if (sourceType !== draggedItemType) {\n return false;\n }\n\n return source.isDragging(this, sourceId);\n }\n }, {\n key: \"isOverTarget\",\n value: function isOverTarget(targetId) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n shallow: false\n };\n\n // undefined on initial render\n if (!targetId) {\n return false;\n }\n\n var shallow = options.shallow;\n\n if (!this.isDragging()) {\n return false;\n }\n\n var targetType = this.registry.getTargetType(targetId);\n var draggedItemType = this.getItemType();\n\n if (draggedItemType && !matchesType(targetType, draggedItemType)) {\n return false;\n }\n\n var targetIds = this.getTargetIds();\n\n if (!targetIds.length) {\n return false;\n }\n\n var index = targetIds.indexOf(targetId);\n\n if (shallow) {\n return index === targetIds.length - 1;\n } else {\n return index > -1;\n }\n }\n }, {\n key: \"getItemType\",\n value: function getItemType() {\n return this.store.getState().dragOperation.itemType;\n }\n }, {\n key: \"getItem\",\n value: function getItem() {\n return this.store.getState().dragOperation.item;\n }\n }, {\n key: \"getSourceId\",\n value: function getSourceId() {\n return this.store.getState().dragOperation.sourceId;\n }\n }, {\n key: \"getTargetIds\",\n value: function getTargetIds() {\n return this.store.getState().dragOperation.targetIds;\n }\n }, {\n key: \"getDropResult\",\n value: function getDropResult() {\n return this.store.getState().dragOperation.dropResult;\n }\n }, {\n key: \"didDrop\",\n value: function didDrop() {\n return this.store.getState().dragOperation.didDrop;\n }\n }, {\n key: \"isSourcePublic\",\n value: function isSourcePublic() {\n return this.store.getState().dragOperation.isSourcePublic;\n }\n }, {\n key: \"getInitialClientOffset\",\n value: function getInitialClientOffset() {\n return this.store.getState().dragOffset.initialClientOffset;\n }\n }, {\n key: \"getInitialSourceClientOffset\",\n value: function getInitialSourceClientOffset() {\n return this.store.getState().dragOffset.initialSourceClientOffset;\n }\n }, {\n key: \"getClientOffset\",\n value: function getClientOffset() {\n return this.store.getState().dragOffset.clientOffset;\n }\n }, {\n key: \"getSourceClientOffset\",\n value: function getSourceClientOffset() {\n return _getSourceClientOffset(this.store.getState().dragOffset);\n }\n }, {\n key: \"getDifferenceFromInitialOffset\",\n value: function getDifferenceFromInitialOffset() {\n return _getDifferenceFromInitialOffset(this.store.getState().dragOffset);\n }\n }]);\n\n return DragDropMonitorImpl;\n}();\n\nexport { DragDropMonitorImpl as default };","var nextUniqueId = 0;\nexport default function getNextUniqueId() {\n return nextUniqueId++;\n}","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport { invariant } from '@react-dnd/invariant';\nexport function validateSourceContract(source) {\n invariant(typeof source.canDrag === 'function', 'Expected canDrag to be a function.');\n invariant(typeof source.beginDrag === 'function', 'Expected beginDrag to be a function.');\n invariant(typeof source.endDrag === 'function', 'Expected endDrag to be a function.');\n}\nexport function validateTargetContract(target) {\n invariant(typeof target.canDrop === 'function', 'Expected canDrop to be a function.');\n invariant(typeof target.hover === 'function', 'Expected hover to be a function.');\n invariant(typeof target.drop === 'function', 'Expected beginDrag to be a function.');\n}\nexport function validateType(type, allowArray) {\n if (allowArray && Array.isArray(type)) {\n type.forEach(function (t) {\n return validateType(t, false);\n });\n return;\n }\n\n invariant(typeof type === 'string' || _typeof(type) === 'symbol', allowArray ? 'Type can only be a string, a symbol, or an array of either.' : 'Type can only be a string or a symbol.');\n}","// Use the fastest means possible to execute a task in its own turn, with\n// priority over other events including IO, animation, reflow, and redraw\n// events in browsers.\n//\n// An exception thrown by a task will permanently interrupt the processing of\n// subsequent tasks. The higher level `asap` function ensures that if an\n// exception is thrown by a task, that the task queue will continue flushing as\n// soon as possible, but if you use `rawAsap` directly, you are responsible to\n// either ensure that no exceptions are thrown from your task, or to manually\n// call `rawAsap.requestFlush` if an exception is thrown.\nexport function rawAsap(task) {\n if (!queue.length) {\n requestFlush();\n flushing = true;\n } // Equivalent to push, but avoids a function call.\n\n\n queue[queue.length] = task;\n}\nvar queue = []; // Once a flush has been requested, no further calls to `requestFlush` are\n// necessary until the next `flush` completes.\n// @ts-ignore\n\nvar flushing = false; // `requestFlush` is an implementation-specific method that attempts to kick\n// off a `flush` event as quickly as possible. `flush` will attempt to exhaust\n// the event queue before yielding to the browser's own event loop.\n\nvar requestFlush; // The position of the next task to execute in the task queue. This is\n// preserved between calls to `flush` so that it can be resumed if\n// a task throws an exception.\n\nvar index = 0; // If a task schedules additional tasks recursively, the task queue can grow\n// unbounded. To prevent memory exhaustion, the task queue will periodically\n// truncate already-completed tasks.\n\nvar capacity = 1024; // The flush function processes all tasks that have been scheduled with\n// `rawAsap` unless and until one of those tasks throws an exception.\n// If a task throws an exception, `flush` ensures that its state will remain\n// consistent and will resume where it left off when called again.\n// However, `flush` does not make any arrangements to be called again if an\n// exception is thrown.\n\nfunction flush() {\n while (index < queue.length) {\n var currentIndex = index; // Advance the index before calling the task. This ensures that we will\n // begin flushing on the next task the task throws an error.\n\n index = index + 1;\n queue[currentIndex].call(); // Prevent leaking memory for long chains of recursive calls to `asap`.\n // If we call `asap` within tasks scheduled by `asap`, the queue will\n // grow, but to avoid an O(n) walk for every task we execute, we don't\n // shift tasks off the queue after they have been executed.\n // Instead, we periodically shift 1024 tasks off the queue.\n\n if (index > capacity) {\n // Manually shift all values starting at the index back to the\n // beginning of the queue.\n for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {\n queue[scan] = queue[scan + index];\n }\n\n queue.length -= index;\n index = 0;\n }\n }\n\n queue.length = 0;\n index = 0;\n flushing = false;\n} // `requestFlush` is implemented using a strategy based on data collected from\n// every available SauceLabs Selenium web driver worker at time of writing.\n// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593\n// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that\n// have WebKitMutationObserver but not un-prefixed MutationObserver.\n// Must use `global` or `self` instead of `window` to work in both frames and web\n// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.\n\n/* globals self */\n\n\nvar scope = typeof global !== 'undefined' ? global : self;\nvar BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver; // MutationObservers are desirable because they have high priority and work\n// reliably everywhere they are implemented.\n// They are implemented in all modern browsers.\n//\n// - Android 4-4.3\n// - Chrome 26-34\n// - Firefox 14-29\n// - Internet Explorer 11\n// - iPad Safari 6-7.1\n// - iPhone Safari 7-7.1\n// - Safari 6-7\n\nif (typeof BrowserMutationObserver === 'function') {\n requestFlush = makeRequestCallFromMutationObserver(flush); // MessageChannels are desirable because they give direct access to the HTML\n // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera\n // 11-12, and in web workers in many engines.\n // Although message channels yield to any queued rendering and IO tasks, they\n // would be better than imposing the 4ms delay of timers.\n // However, they do not work reliably in Internet Explorer or Safari.\n // Internet Explorer 10 is the only browser that has setImmediate but does\n // not have MutationObservers.\n // Although setImmediate yields to the browser's renderer, it would be\n // preferrable to falling back to setTimeout since it does not have\n // the minimum 4ms penalty.\n // Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and\n // Desktop to a lesser extent) that renders both setImmediate and\n // MessageChannel useless for the purposes of ASAP.\n // https://github.com/kriskowal/q/issues/396\n // Timers are implemented universally.\n // We fall back to timers in workers in most engines, and in foreground\n // contexts in the following browsers.\n // However, note that even this simple case requires nuances to operate in a\n // broad spectrum of browsers.\n //\n // - Firefox 3-13\n // - Internet Explorer 6-9\n // - iPad Safari 4.3\n // - Lynx 2.8.7\n} else {\n requestFlush = makeRequestCallFromTimer(flush);\n} // `requestFlush` requests that the high priority event queue be flushed as\n// soon as possible.\n// This is useful to prevent an error thrown in a task from stalling the event\n// queue if the exception handled by Node.js’s\n// `process.on(\"uncaughtException\")` or by a domain.\n\n\nrawAsap.requestFlush = requestFlush; // To request a high priority event, we induce a mutation observer by toggling\n// the text of a text node between \"1\" and \"-1\".\n\nfunction makeRequestCallFromMutationObserver(callback) {\n var toggle = 1;\n var observer = new BrowserMutationObserver(callback);\n var node = document.createTextNode('');\n observer.observe(node, {\n characterData: true\n });\n return function requestCall() {\n toggle = -toggle;\n node.data = toggle;\n };\n} // The message channel technique was discovered by Malte Ubl and was the\n// original foundation for this library.\n// http://www.nonblocking.io/2011/06/windownexttick.html\n// Safari 6.0.5 (at least) intermittently fails to create message ports on a\n// page's first load. Thankfully, this version of Safari supports\n// MutationObservers, so we don't need to fall back in that case.\n// function makeRequestCallFromMessageChannel(callback) {\n// var channel = new MessageChannel();\n// channel.port1.onmessage = callback;\n// return function requestCall() {\n// channel.port2.postMessage(0);\n// };\n// }\n// For reasons explained above, we are also unable to use `setImmediate`\n// under any circumstances.\n// Even if we were, there is another bug in Internet Explorer 10.\n// It is not sufficient to assign `setImmediate` to `requestFlush` because\n// `setImmediate` must be called *by name* and therefore must be wrapped in a\n// closure.\n// Never forget.\n// function makeRequestCallFromSetImmediate(callback) {\n// return function requestCall() {\n// setImmediate(callback);\n// };\n// }\n// Safari 6.0 has a problem where timers will get lost while the user is\n// scrolling. This problem does not impact ASAP because Safari 6.0 supports\n// mutation observers, so that implementation is used instead.\n// However, if we ever elect to use timers in Safari, the prevalent work-around\n// is to add a scroll event listener that calls for a flush.\n// `setTimeout` does not call the passed callback if the delay is less than\n// approximately 7 in web workers in Firefox 8 through 18, and sometimes not\n// even then.\n\n\nfunction makeRequestCallFromTimer(callback) {\n return function requestCall() {\n // We dispatch a timeout with a specified delay of 0 for engines that\n // can reliably accommodate that request. This will usually be snapped\n // to a 4 milisecond delay, but once we're flushing, there's no delay\n // between events.\n var timeoutHandle = setTimeout(handleTimer, 0); // However, since this timer gets frequently dropped in Firefox\n // workers, we enlist an interval handle that will try to fire\n // an event 20 times per second until it succeeds.\n\n var intervalHandle = setInterval(handleTimer, 50);\n\n function handleTimer() {\n // Whichever timer succeeds will cancel both timers and\n // execute the callback.\n clearTimeout(timeoutHandle);\n clearInterval(intervalHandle);\n callback();\n }\n };\n} // This is for `asap.js` only.\n// Its name will be periodically randomized to break any code that depends on\n// its existence.\n\n\nrawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer; // ASAP was originally a nextTick shim included in Q. This was factored out\n// into this ASAP package. It was later adapted to RSVP which made further\n// amendments. These decisions, particularly to marginalize MessageChannel and\n// to capture the MutationObserver implementation in a closure, were integrated\n// back into ASAP proper.\n// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js","import { rawAsap } from './raw'; // rawAsap provides everything we need except exception management.\n// RawTasks are recycled to reduce GC churn.\n\nvar freeTasks = []; // We queue errors to ensure they are thrown in right order (FIFO).\n// Array-as-queue is good enough here, since we are just dealing with exceptions.\n\nvar pendingErrors = [];\nvar requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);\n\nfunction throwFirstError() {\n if (pendingErrors.length) {\n throw pendingErrors.shift();\n }\n}\n/**\n * Calls a task as soon as possible after returning, in its own event, with priority\n * over other events like animation, reflow, and repaint. An error thrown from an\n * event will not interrupt, nor even substantially slow down the processing of\n * other events, but will be rather postponed to a lower priority event.\n * @param {{call}} task A callable object, typically a function that takes no\n * arguments.\n */\n\n\nexport function asap(task) {\n var rawTask;\n\n if (freeTasks.length) {\n rawTask = freeTasks.pop();\n } else {\n rawTask = new RawTask();\n }\n\n rawTask.task = task;\n rawAsap(rawTask);\n} // We wrap tasks with recyclable task objects. A task object implements\n// `call`, just like a function.\n\nvar RawTask =\n/** @class */\nfunction () {\n function RawTask() {}\n\n RawTask.prototype.call = function () {\n try {\n this.task.call();\n } catch (error) {\n if (asap.onerror) {\n // This hook exists purely for testing purposes.\n // Its name will be periodically randomized to break any code that\n // depends on its existence.\n asap.onerror(error);\n } else {\n // In a web browser, exceptions are not fatal. However, to avoid\n // slowing down the queue of pending tasks, we rethrow the error in a\n // lower priority turn.\n pendingErrors.push(error);\n requestErrorThrow();\n }\n } finally {\n this.task = null;\n freeTasks[freeTasks.length] = this;\n }\n };\n\n return RawTask;\n}();","export * from './asap';","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nimport { invariant } from '@react-dnd/invariant';\nimport { addSource as _addSource, addTarget as _addTarget, removeSource as _removeSource, removeTarget as _removeTarget } from './actions/registry';\nimport getNextUniqueId from './utils/getNextUniqueId';\nimport { HandlerRole } from './interfaces';\nimport { validateSourceContract, validateTargetContract, validateType } from './contracts';\nimport { asap } from '@react-dnd/asap';\n\nfunction getNextHandlerId(role) {\n var id = getNextUniqueId().toString();\n\n switch (role) {\n case HandlerRole.SOURCE:\n return \"S\".concat(id);\n\n case HandlerRole.TARGET:\n return \"T\".concat(id);\n\n default:\n throw new Error(\"Unknown Handler Role: \".concat(role));\n }\n}\n\nfunction parseRoleFromHandlerId(handlerId) {\n switch (handlerId[0]) {\n case 'S':\n return HandlerRole.SOURCE;\n\n case 'T':\n return HandlerRole.TARGET;\n\n default:\n invariant(false, \"Cannot parse handler ID: \".concat(handlerId));\n }\n}\n\nfunction mapContainsValue(map, searchValue) {\n var entries = map.entries();\n var isDone = false;\n\n do {\n var _entries$next = entries.next(),\n done = _entries$next.done,\n _entries$next$value = _slicedToArray(_entries$next.value, 2),\n value = _entries$next$value[1];\n\n if (value === searchValue) {\n return true;\n }\n\n isDone = !!done;\n } while (!isDone);\n\n return false;\n}\n\nvar HandlerRegistryImpl =\n/*#__PURE__*/\nfunction () {\n function HandlerRegistryImpl(store) {\n _classCallCheck(this, HandlerRegistryImpl);\n\n this.types = new Map();\n this.dragSources = new Map();\n this.dropTargets = new Map();\n this.pinnedSourceId = null;\n this.pinnedSource = null;\n this.store = store;\n }\n\n _createClass(HandlerRegistryImpl, [{\n key: \"addSource\",\n value: function addSource(type, source) {\n validateType(type);\n validateSourceContract(source);\n var sourceId = this.addHandler(HandlerRole.SOURCE, type, source);\n this.store.dispatch(_addSource(sourceId));\n return sourceId;\n }\n }, {\n key: \"addTarget\",\n value: function addTarget(type, target) {\n validateType(type, true);\n validateTargetContract(target);\n var targetId = this.addHandler(HandlerRole.TARGET, type, target);\n this.store.dispatch(_addTarget(targetId));\n return targetId;\n }\n }, {\n key: \"containsHandler\",\n value: function containsHandler(handler) {\n return mapContainsValue(this.dragSources, handler) || mapContainsValue(this.dropTargets, handler);\n }\n }, {\n key: \"getSource\",\n value: function getSource(sourceId) {\n var includePinned = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n invariant(this.isSourceId(sourceId), 'Expected a valid source ID.');\n var isPinned = includePinned && sourceId === this.pinnedSourceId;\n var source = isPinned ? this.pinnedSource : this.dragSources.get(sourceId);\n return source;\n }\n }, {\n key: \"getTarget\",\n value: function getTarget(targetId) {\n invariant(this.isTargetId(targetId), 'Expected a valid target ID.');\n return this.dropTargets.get(targetId);\n }\n }, {\n key: \"getSourceType\",\n value: function getSourceType(sourceId) {\n invariant(this.isSourceId(sourceId), 'Expected a valid source ID.');\n return this.types.get(sourceId);\n }\n }, {\n key: \"getTargetType\",\n value: function getTargetType(targetId) {\n invariant(this.isTargetId(targetId), 'Expected a valid target ID.');\n return this.types.get(targetId);\n }\n }, {\n key: \"isSourceId\",\n value: function isSourceId(handlerId) {\n var role = parseRoleFromHandlerId(handlerId);\n return role === HandlerRole.SOURCE;\n }\n }, {\n key: \"isTargetId\",\n value: function isTargetId(handlerId) {\n var role = parseRoleFromHandlerId(handlerId);\n return role === HandlerRole.TARGET;\n }\n }, {\n key: \"removeSource\",\n value: function removeSource(sourceId) {\n var _this = this;\n\n invariant(this.getSource(sourceId), 'Expected an existing source.');\n this.store.dispatch(_removeSource(sourceId));\n asap(function () {\n _this.dragSources.delete(sourceId);\n\n _this.types.delete(sourceId);\n });\n }\n }, {\n key: \"removeTarget\",\n value: function removeTarget(targetId) {\n invariant(this.getTarget(targetId), 'Expected an existing target.');\n this.store.dispatch(_removeTarget(targetId));\n this.dropTargets.delete(targetId);\n this.types.delete(targetId);\n }\n }, {\n key: \"pinSource\",\n value: function pinSource(sourceId) {\n var source = this.getSource(sourceId);\n invariant(source, 'Expected an existing source.');\n this.pinnedSourceId = sourceId;\n this.pinnedSource = source;\n }\n }, {\n key: \"unpinSource\",\n value: function unpinSource() {\n invariant(this.pinnedSource, 'No source is pinned at the time.');\n this.pinnedSourceId = null;\n this.pinnedSource = null;\n }\n }, {\n key: \"addHandler\",\n value: function addHandler(role, type, handler) {\n var id = getNextHandlerId(role);\n this.types.set(id, type);\n\n if (role === HandlerRole.SOURCE) {\n this.dragSources.set(id, handler);\n } else if (role === HandlerRole.TARGET) {\n this.dropTargets.set(id, handler);\n }\n\n return id;\n }\n }]);\n\n return HandlerRegistryImpl;\n}();\n\nexport { HandlerRegistryImpl as default };","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { createStore } from 'redux';\nimport reducer from './reducers';\nimport dragDropActions from './actions/dragDrop';\nimport DragDropMonitorImpl from './DragDropMonitorImpl';\nimport HandlerRegistryImpl from './HandlerRegistryImpl';\n\nfunction makeStoreInstance(debugMode) {\n // TODO: if we ever make a react-native version of this,\n // we'll need to consider how to pull off dev-tooling\n var reduxDevTools = typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__;\n return createStore(reducer, debugMode && reduxDevTools && reduxDevTools({\n name: 'dnd-core',\n instanceId: 'dnd-core'\n }));\n}\n\nvar DragDropManagerImpl =\n/*#__PURE__*/\nfunction () {\n function DragDropManagerImpl() {\n var _this = this;\n\n var debugMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n _classCallCheck(this, DragDropManagerImpl);\n\n this.isSetUp = false;\n\n this.handleRefCountChange = function () {\n var shouldSetUp = _this.store.getState().refCount > 0;\n\n if (_this.backend) {\n if (shouldSetUp && !_this.isSetUp) {\n _this.backend.setup();\n\n _this.isSetUp = true;\n } else if (!shouldSetUp && _this.isSetUp) {\n _this.backend.teardown();\n\n _this.isSetUp = false;\n }\n }\n };\n\n var store = makeStoreInstance(debugMode);\n this.store = store;\n this.monitor = new DragDropMonitorImpl(store, new HandlerRegistryImpl(store));\n store.subscribe(this.handleRefCountChange);\n }\n\n _createClass(DragDropManagerImpl, [{\n key: \"receiveBackend\",\n value: function receiveBackend(backend) {\n this.backend = backend;\n }\n }, {\n key: \"getMonitor\",\n value: function getMonitor() {\n return this.monitor;\n }\n }, {\n key: \"getBackend\",\n value: function getBackend() {\n return this.backend;\n }\n }, {\n key: \"getRegistry\",\n value: function getRegistry() {\n return this.monitor.registry;\n }\n }, {\n key: \"getActions\",\n value: function getActions() {\n /* eslint-disable-next-line @typescript-eslint/no-this-alias */\n var manager = this;\n var dispatch = this.store.dispatch;\n\n function bindActionCreator(actionCreator) {\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var action = actionCreator.apply(manager, args);\n\n if (typeof action !== 'undefined') {\n dispatch(action);\n }\n };\n }\n\n var actions = dragDropActions(this);\n return Object.keys(actions).reduce(function (boundActions, key) {\n var action = actions[key];\n boundActions[key] = bindActionCreator(action);\n return boundActions;\n }, {});\n }\n }, {\n key: \"dispatch\",\n value: function dispatch(action) {\n this.store.dispatch(action);\n }\n }]);\n\n return DragDropManagerImpl;\n}();\n\nexport { DragDropManagerImpl as default };","import DragDropManagerImpl from './DragDropManagerImpl';\nexport function createDragDropManager(backendFactory, globalContext, backendOptions, debugMode) {\n var manager = new DragDropManagerImpl(debugMode);\n var backend = backendFactory(manager, globalContext, backendOptions);\n manager.receiveBackend(backend);\n return manager;\n}","export * from './interfaces';\nexport * from './factories';","import * as React from 'react';\nimport { createDragDropManager } from 'dnd-core';\n/**\n * Create the React Context\n */\n\nexport var DndContext = React.createContext({\n dragDropManager: undefined\n});\n/**\n * Creates the context object we're providing\n * @param backend\n * @param context\n */\n\nexport function createDndContext(backend, context, options, debugMode) {\n return {\n dragDropManager: createDragDropManager(backend, context, options, debugMode)\n };\n}","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport * as React from 'react';\nimport { memo } from 'react';\nimport { DndContext, createDndContext } from './DndContext';\nvar refCount = 0;\n/**\n * A React component that provides the React-DnD context\n */\n\nexport var DndProvider = memo(function (_ref) {\n var children = _ref.children,\n props = _objectWithoutProperties(_ref, [\"children\"]);\n\n var _getDndContextValue = getDndContextValue(props),\n _getDndContextValue2 = _slicedToArray(_getDndContextValue, 2),\n manager = _getDndContextValue2[0],\n isGlobalInstance = _getDndContextValue2[1]; // memoized from props\n\n /**\n * If the global context was used to store the DND context\n * then where theres no more references to it we should\n * clean it up to avoid memory leaks\n */\n\n\n React.useEffect(function () {\n if (isGlobalInstance) {\n refCount++;\n }\n\n return function () {\n if (isGlobalInstance) {\n refCount--;\n\n if (refCount === 0) {\n var context = getGlobalContext();\n context[instanceSymbol] = null;\n }\n }\n };\n }, []);\n return React.createElement(DndContext.Provider, {\n value: manager\n }, children);\n});\nDndProvider.displayName = 'DndProvider';\n\nfunction getDndContextValue(props) {\n if ('manager' in props) {\n var _manager = {\n dragDropManager: props.manager\n };\n return [_manager, false];\n }\n\n var manager = createSingletonDndContext(props.backend, props.context, props.options, props.debugMode);\n var isGlobalInstance = !props.context;\n return [manager, isGlobalInstance];\n}\n\nvar instanceSymbol = Symbol.for('__REACT_DND_CONTEXT_INSTANCE__');\n\nfunction createSingletonDndContext(backend) {\n var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getGlobalContext();\n var options = arguments.length > 2 ? arguments[2] : undefined;\n var debugMode = arguments.length > 3 ? arguments[3] : undefined;\n var ctx = context;\n\n if (!ctx[instanceSymbol]) {\n ctx[instanceSymbol] = createDndContext(backend, context, options, debugMode);\n }\n\n return ctx[instanceSymbol];\n}\n\nfunction getGlobalContext() {\n return typeof global !== 'undefined' ? global : window;\n}","import * as React from 'react';\n/*\n * A utility for rendering a drag preview image\n */\n\nexport var DragPreviewImage = React.memo(function (_ref) {\n var connect = _ref.connect,\n src = _ref.src;\n\n if (typeof Image !== 'undefined') {\n var img = new Image();\n img.src = src;\n\n img.onload = function () {\n return connect(img);\n };\n }\n\n return null;\n});\nDragPreviewImage.displayName = 'DragPreviewImage';","export * from './DndContext';\nexport * from './DndProvider';\nexport * from './DragPreviewImage';","import { useLayoutEffect, useEffect } from 'react'; // suppress the useLayoutEffect warning on server side.\n\nexport var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nimport { shallowEqual } from '@react-dnd/shallowequal';\nimport { useState, useCallback } from 'react';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\n/**\n *\n * @param monitor The monitor to collect state from\n * @param collect The collecting function\n * @param onUpdate A method to invoke when updates occur\n */\n\nexport function useCollector(monitor, collect, onUpdate) {\n var _useState = useState(function () {\n return collect(monitor);\n }),\n _useState2 = _slicedToArray(_useState, 2),\n collected = _useState2[0],\n setCollected = _useState2[1];\n\n var updateCollected = useCallback(function () {\n var nextValue = collect(monitor);\n\n if (!shallowEqual(collected, nextValue)) {\n setCollected(nextValue);\n\n if (onUpdate) {\n onUpdate();\n }\n }\n }, [collected, monitor, onUpdate]); // update the collected properties after the first render\n // and the components are attached to dnd-core\n\n useIsomorphicLayoutEffect(updateCollected, []);\n return [collected, updateCollected];\n}","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\nimport { useCollector } from './useCollector';\nexport function useMonitorOutput(monitor, collect, onCollect) {\n var _useCollector = useCollector(monitor, collect, onCollect),\n _useCollector2 = _slicedToArray(_useCollector, 2),\n collected = _useCollector2[0],\n updateCollected = _useCollector2[1];\n\n useIsomorphicLayoutEffect(function subscribeToMonitorStateChange() {\n var handlerId = monitor.getHandlerId();\n\n if (handlerId == null) {\n return undefined;\n }\n\n return monitor.subscribeToStateChange(updateCollected, {\n handlerIds: [handlerId]\n });\n }, [monitor, updateCollected]);\n return collected;\n}","export function registerTarget(type, target, manager) {\n var registry = manager.getRegistry();\n var targetId = registry.addTarget(type, target);\n return [targetId, function () {\n return registry.removeTarget(targetId);\n }];\n}\nexport function registerSource(type, source, manager) {\n var registry = manager.getRegistry();\n var sourceId = registry.addSource(type, source);\n return [sourceId, function () {\n return registry.removeSource(sourceId);\n }];\n}","import { useContext } from 'react';\nimport { invariant } from '@react-dnd/invariant';\nimport { DndContext } from '../../common/DndContext';\n/**\n * A hook to retrieve the DragDropManager from Context\n */\n\nexport function useDragDropManager() {\n var _useContext = useContext(DndContext),\n dragDropManager = _useContext.dragDropManager;\n\n invariant(dragDropManager != null, 'Expected drag drop context');\n return dragDropManager;\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { invariant } from '@react-dnd/invariant';\nvar isCallingCanDrag = false;\nvar isCallingIsDragging = false;\nexport var DragSourceMonitorImpl =\n/*#__PURE__*/\nfunction () {\n function DragSourceMonitorImpl(manager) {\n _classCallCheck(this, DragSourceMonitorImpl);\n\n this.sourceId = null;\n this.internalMonitor = manager.getMonitor();\n }\n\n _createClass(DragSourceMonitorImpl, [{\n key: \"receiveHandlerId\",\n value: function receiveHandlerId(sourceId) {\n this.sourceId = sourceId;\n }\n }, {\n key: \"getHandlerId\",\n value: function getHandlerId() {\n return this.sourceId;\n }\n }, {\n key: \"canDrag\",\n value: function canDrag() {\n invariant(!isCallingCanDrag, 'You may not call monitor.canDrag() inside your canDrag() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor');\n\n try {\n isCallingCanDrag = true;\n return this.internalMonitor.canDragSource(this.sourceId);\n } finally {\n isCallingCanDrag = false;\n }\n }\n }, {\n key: \"isDragging\",\n value: function isDragging() {\n if (!this.sourceId) {\n return false;\n }\n\n invariant(!isCallingIsDragging, 'You may not call monitor.isDragging() inside your isDragging() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor');\n\n try {\n isCallingIsDragging = true;\n return this.internalMonitor.isDraggingSource(this.sourceId);\n } finally {\n isCallingIsDragging = false;\n }\n }\n }, {\n key: \"subscribeToStateChange\",\n value: function subscribeToStateChange(listener, options) {\n return this.internalMonitor.subscribeToStateChange(listener, options);\n }\n }, {\n key: \"isDraggingSource\",\n value: function isDraggingSource(sourceId) {\n return this.internalMonitor.isDraggingSource(sourceId);\n }\n }, {\n key: \"isOverTarget\",\n value: function isOverTarget(targetId, options) {\n return this.internalMonitor.isOverTarget(targetId, options);\n }\n }, {\n key: \"getTargetIds\",\n value: function getTargetIds() {\n return this.internalMonitor.getTargetIds();\n }\n }, {\n key: \"isSourcePublic\",\n value: function isSourcePublic() {\n return this.internalMonitor.isSourcePublic();\n }\n }, {\n key: \"getSourceId\",\n value: function getSourceId() {\n return this.internalMonitor.getSourceId();\n }\n }, {\n key: \"subscribeToOffsetChange\",\n value: function subscribeToOffsetChange(listener) {\n return this.internalMonitor.subscribeToOffsetChange(listener);\n }\n }, {\n key: \"canDragSource\",\n value: function canDragSource(sourceId) {\n return this.internalMonitor.canDragSource(sourceId);\n }\n }, {\n key: \"canDropOnTarget\",\n value: function canDropOnTarget(targetId) {\n return this.internalMonitor.canDropOnTarget(targetId);\n }\n }, {\n key: \"getItemType\",\n value: function getItemType() {\n return this.internalMonitor.getItemType();\n }\n }, {\n key: \"getItem\",\n value: function getItem() {\n return this.internalMonitor.getItem();\n }\n }, {\n key: \"getDropResult\",\n value: function getDropResult() {\n return this.internalMonitor.getDropResult();\n }\n }, {\n key: \"didDrop\",\n value: function didDrop() {\n return this.internalMonitor.didDrop();\n }\n }, {\n key: \"getInitialClientOffset\",\n value: function getInitialClientOffset() {\n return this.internalMonitor.getInitialClientOffset();\n }\n }, {\n key: \"getInitialSourceClientOffset\",\n value: function getInitialSourceClientOffset() {\n return this.internalMonitor.getInitialSourceClientOffset();\n }\n }, {\n key: \"getSourceClientOffset\",\n value: function getSourceClientOffset() {\n return this.internalMonitor.getSourceClientOffset();\n }\n }, {\n key: \"getClientOffset\",\n value: function getClientOffset() {\n return this.internalMonitor.getClientOffset();\n }\n }, {\n key: \"getDifferenceFromInitialOffset\",\n value: function getDifferenceFromInitialOffset() {\n return this.internalMonitor.getDifferenceFromInitialOffset();\n }\n }]);\n\n return DragSourceMonitorImpl;\n}();","import { cloneElement } from 'react';\nimport { invariant } from '@react-dnd/invariant';\n\nfunction setRef(ref, node) {\n if (typeof ref === 'function') {\n ref(node);\n } else {\n ref.current = node;\n }\n}\n\nexport function cloneWithRef(element, newRef) {\n var previousRef = element.ref;\n invariant(typeof previousRef !== 'string', 'Cannot connect React DnD to an element with an existing string ref. ' + 'Please convert it to use a callback ref instead, or wrap it into a or
. ' + 'Read more: https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute');\n\n if (!previousRef) {\n // When there is no ref on the element, use the new ref directly\n return cloneElement(element, {\n ref: newRef\n });\n } else {\n return cloneElement(element, {\n ref: function ref(node) {\n setRef(previousRef, node);\n setRef(newRef, node);\n }\n });\n }\n}","import { isValidElement } from 'react';\nimport { cloneWithRef } from '../utils/cloneWithRef';\n\nfunction throwIfCompositeComponentElement(element) {\n // Custom components can no longer be wrapped directly in React DnD 2.0\n // so that we don't need to depend on findDOMNode() from react-dom.\n if (typeof element.type === 'string') {\n return;\n }\n\n var displayName = element.type.displayName || element.type.name || 'the component';\n throw new Error('Only native element nodes can now be passed to React DnD connectors.' + \"You can either wrap \".concat(displayName, \" into a
, or turn it into a \") + 'drag source or a drop target itself.');\n}\n\nfunction wrapHookToRecognizeElement(hook) {\n return function () {\n var elementOrNode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n // When passed a node, call the hook straight away.\n if (!isValidElement(elementOrNode)) {\n var node = elementOrNode;\n hook(node, options); // return the node so it can be chained (e.g. when within callback refs\n //
connectDragSource(connectDropTarget(node))}/>\n\n return node;\n } // If passed a ReactElement, clone it and attach this function as a ref.\n // This helps us achieve a neat API where user doesn't even know that refs\n // are being used under the hood.\n\n\n var element = elementOrNode;\n throwIfCompositeComponentElement(element); // When no options are passed, use the hook directly\n\n var ref = options ? function (node) {\n return hook(node, options);\n } : hook;\n return cloneWithRef(element, ref);\n };\n}\n\nexport default function wrapConnectorHooks(hooks) {\n var wrappedHooks = {};\n Object.keys(hooks).forEach(function (key) {\n var hook = hooks[key]; // ref objects should be passed straight through without wrapping\n\n if (key.endsWith('Ref')) {\n wrappedHooks[key] = hooks[key];\n } else {\n var wrappedHook = wrapHookToRecognizeElement(hook);\n\n wrappedHooks[key] = function () {\n return wrappedHook;\n };\n }\n });\n return wrappedHooks;\n}","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nexport function isRef(obj) {\n return (// eslint-disable-next-line no-prototype-builtins\n obj !== null && _typeof(obj) === 'object' && obj.hasOwnProperty('current')\n );\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport wrapConnectorHooks from './wrapConnectorHooks';\nimport { isRef } from '../utils/isRef';\nimport { shallowEqual } from '@react-dnd/shallowequal';\nexport var SourceConnector =\n/*#__PURE__*/\nfunction () {\n function SourceConnector(backend) {\n var _this = this;\n\n _classCallCheck(this, SourceConnector);\n\n this.hooks = wrapConnectorHooks({\n dragSource: function dragSource(node, options) {\n _this.clearDragSource();\n\n _this.dragSourceOptions = options || null;\n\n if (isRef(node)) {\n _this.dragSourceRef = node;\n } else {\n _this.dragSourceNode = node;\n }\n\n _this.reconnectDragSource();\n },\n dragPreview: function dragPreview(node, options) {\n _this.clearDragPreview();\n\n _this.dragPreviewOptions = options || null;\n\n if (isRef(node)) {\n _this.dragPreviewRef = node;\n } else {\n _this.dragPreviewNode = node;\n }\n\n _this.reconnectDragPreview();\n }\n });\n this.handlerId = null; // The drop target may either be attached via ref or connect function\n\n this.dragSourceRef = null;\n this.dragSourceOptionsInternal = null; // The drag preview may either be attached via ref or connect function\n\n this.dragPreviewRef = null;\n this.dragPreviewOptionsInternal = null;\n this.lastConnectedHandlerId = null;\n this.lastConnectedDragSource = null;\n this.lastConnectedDragSourceOptions = null;\n this.lastConnectedDragPreview = null;\n this.lastConnectedDragPreviewOptions = null;\n this.backend = backend;\n }\n\n _createClass(SourceConnector, [{\n key: \"receiveHandlerId\",\n value: function receiveHandlerId(newHandlerId) {\n if (this.handlerId === newHandlerId) {\n return;\n }\n\n this.handlerId = newHandlerId;\n this.reconnect();\n }\n }, {\n key: \"reconnect\",\n value: function reconnect() {\n this.reconnectDragSource();\n this.reconnectDragPreview();\n }\n }, {\n key: \"reconnectDragSource\",\n value: function reconnectDragSource() {\n var dragSource = this.dragSource; // if nothing has changed then don't resubscribe\n\n var didChange = this.didHandlerIdChange() || this.didConnectedDragSourceChange() || this.didDragSourceOptionsChange();\n\n if (didChange) {\n this.disconnectDragSource();\n }\n\n if (!this.handlerId) {\n return;\n }\n\n if (!dragSource) {\n this.lastConnectedDragSource = dragSource;\n return;\n }\n\n if (didChange) {\n this.lastConnectedHandlerId = this.handlerId;\n this.lastConnectedDragSource = dragSource;\n this.lastConnectedDragSourceOptions = this.dragSourceOptions;\n this.dragSourceUnsubscribe = this.backend.connectDragSource(this.handlerId, dragSource, this.dragSourceOptions);\n }\n }\n }, {\n key: \"reconnectDragPreview\",\n value: function reconnectDragPreview() {\n var dragPreview = this.dragPreview; // if nothing has changed then don't resubscribe\n\n var didChange = this.didHandlerIdChange() || this.didConnectedDragPreviewChange() || this.didDragPreviewOptionsChange();\n\n if (!this.handlerId) {\n this.disconnectDragPreview();\n } else if (this.dragPreview && didChange) {\n this.lastConnectedHandlerId = this.handlerId;\n this.lastConnectedDragPreview = dragPreview;\n this.lastConnectedDragPreviewOptions = this.dragPreviewOptions;\n this.disconnectDragPreview();\n this.dragPreviewUnsubscribe = this.backend.connectDragPreview(this.handlerId, dragPreview, this.dragPreviewOptions);\n }\n }\n }, {\n key: \"didHandlerIdChange\",\n value: function didHandlerIdChange() {\n return this.lastConnectedHandlerId !== this.handlerId;\n }\n }, {\n key: \"didConnectedDragSourceChange\",\n value: function didConnectedDragSourceChange() {\n return this.lastConnectedDragSource !== this.dragSource;\n }\n }, {\n key: \"didConnectedDragPreviewChange\",\n value: function didConnectedDragPreviewChange() {\n return this.lastConnectedDragPreview !== this.dragPreview;\n }\n }, {\n key: \"didDragSourceOptionsChange\",\n value: function didDragSourceOptionsChange() {\n return !shallowEqual(this.lastConnectedDragSourceOptions, this.dragSourceOptions);\n }\n }, {\n key: \"didDragPreviewOptionsChange\",\n value: function didDragPreviewOptionsChange() {\n return !shallowEqual(this.lastConnectedDragPreviewOptions, this.dragPreviewOptions);\n }\n }, {\n key: \"disconnectDragSource\",\n value: function disconnectDragSource() {\n if (this.dragSourceUnsubscribe) {\n this.dragSourceUnsubscribe();\n this.dragSourceUnsubscribe = undefined;\n }\n }\n }, {\n key: \"disconnectDragPreview\",\n value: function disconnectDragPreview() {\n if (this.dragPreviewUnsubscribe) {\n this.dragPreviewUnsubscribe();\n this.dragPreviewUnsubscribe = undefined;\n this.dragPreviewNode = null;\n this.dragPreviewRef = null;\n }\n }\n }, {\n key: \"clearDragSource\",\n value: function clearDragSource() {\n this.dragSourceNode = null;\n this.dragSourceRef = null;\n }\n }, {\n key: \"clearDragPreview\",\n value: function clearDragPreview() {\n this.dragPreviewNode = null;\n this.dragPreviewRef = null;\n }\n }, {\n key: \"connectTarget\",\n get: function get() {\n return this.dragSource;\n }\n }, {\n key: \"dragSourceOptions\",\n get: function get() {\n return this.dragSourceOptionsInternal;\n },\n set: function set(options) {\n this.dragSourceOptionsInternal = options;\n }\n }, {\n key: \"dragPreviewOptions\",\n get: function get() {\n return this.dragPreviewOptionsInternal;\n },\n set: function set(options) {\n this.dragPreviewOptionsInternal = options;\n }\n }, {\n key: \"dragSource\",\n get: function get() {\n return this.dragSourceNode || this.dragSourceRef && this.dragSourceRef.current;\n }\n }, {\n key: \"dragPreview\",\n get: function get() {\n return this.dragPreviewNode || this.dragPreviewRef && this.dragPreviewRef.current;\n }\n }]);\n\n return SourceConnector;\n}();","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport { useMemo } from 'react';\nimport { invariant } from '@react-dnd/invariant';\nimport { registerSource } from '../../common/registration';\nimport { useDragDropManager } from './useDragDropManager';\nimport { DragSourceMonitorImpl } from '../../common/DragSourceMonitorImpl';\nimport { SourceConnector } from '../../common/SourceConnector';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\nexport function useDragSourceMonitor() {\n var manager = useDragDropManager();\n var monitor = useMemo(function () {\n return new DragSourceMonitorImpl(manager);\n }, [manager]);\n var connector = useMemo(function () {\n return new SourceConnector(manager.getBackend());\n }, [manager]);\n return [monitor, connector];\n}\nexport function useDragHandler(spec, monitor, connector) {\n var manager = useDragDropManager();\n var handler = useMemo(function () {\n return {\n beginDrag: function beginDrag() {\n var _spec$current = spec.current,\n begin = _spec$current.begin,\n item = _spec$current.item;\n\n if (begin) {\n var beginResult = begin(monitor);\n invariant(beginResult == null || _typeof(beginResult) === 'object', 'dragSpec.begin() must either return an object, undefined, or null');\n return beginResult || item || {};\n }\n\n return item || {};\n },\n canDrag: function canDrag() {\n if (typeof spec.current.canDrag === 'boolean') {\n return spec.current.canDrag;\n } else if (typeof spec.current.canDrag === 'function') {\n return spec.current.canDrag(monitor);\n } else {\n return true;\n }\n },\n isDragging: function isDragging(globalMonitor, target) {\n var isDragging = spec.current.isDragging;\n return isDragging ? isDragging(monitor) : target === globalMonitor.getSourceId();\n },\n endDrag: function endDrag() {\n var end = spec.current.end;\n\n if (end) {\n end(monitor.getItem(), monitor);\n }\n\n connector.reconnect();\n }\n };\n }, []);\n useIsomorphicLayoutEffect(function registerHandler() {\n var _registerSource = registerSource(spec.current.item.type, handler, manager),\n _registerSource2 = _slicedToArray(_registerSource, 2),\n handlerId = _registerSource2[0],\n unregister = _registerSource2[1];\n\n monitor.receiveHandlerId(handlerId);\n connector.receiveHandlerId(handlerId);\n return unregister;\n }, []);\n}","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nimport { useRef, useMemo } from 'react';\nimport { invariant } from '@react-dnd/invariant';\nimport { useMonitorOutput } from './internal/useMonitorOutput';\nimport { useIsomorphicLayoutEffect } from './internal/useIsomorphicLayoutEffect';\nimport { useDragSourceMonitor, useDragHandler } from './internal/drag';\n/**\n * useDragSource hook\n * @param sourceSpec The drag source specification *\n */\n\nexport function useDrag(spec) {\n var specRef = useRef(spec);\n specRef.current = spec; // TODO: wire options into createSourceConnector\n\n invariant(spec.item != null, 'item must be defined');\n invariant(spec.item.type != null, 'item type must be defined');\n\n var _useDragSourceMonitor = useDragSourceMonitor(),\n _useDragSourceMonitor2 = _slicedToArray(_useDragSourceMonitor, 2),\n monitor = _useDragSourceMonitor2[0],\n connector = _useDragSourceMonitor2[1];\n\n useDragHandler(specRef, monitor, connector);\n var result = useMonitorOutput(monitor, specRef.current.collect || function () {\n return {};\n }, function () {\n return connector.reconnect();\n });\n var connectDragSource = useMemo(function () {\n return connector.hooks.dragSource();\n }, [connector]);\n var connectDragPreview = useMemo(function () {\n return connector.hooks.dragPreview();\n }, [connector]);\n useIsomorphicLayoutEffect(function () {\n connector.dragSourceOptions = specRef.current.options || null;\n connector.reconnect();\n }, [connector]);\n useIsomorphicLayoutEffect(function () {\n connector.dragPreviewOptions = specRef.current.previewOptions || null;\n connector.reconnect();\n }, [connector]);\n return [result, connectDragSource, connectDragPreview];\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { shallowEqual } from '@react-dnd/shallowequal';\nimport wrapConnectorHooks from './wrapConnectorHooks';\nimport { isRef } from '../utils/isRef';\nexport var TargetConnector =\n/*#__PURE__*/\nfunction () {\n function TargetConnector(backend) {\n var _this = this;\n\n _classCallCheck(this, TargetConnector);\n\n this.hooks = wrapConnectorHooks({\n dropTarget: function dropTarget(node, options) {\n _this.clearDropTarget();\n\n _this.dropTargetOptions = options;\n\n if (isRef(node)) {\n _this.dropTargetRef = node;\n } else {\n _this.dropTargetNode = node;\n }\n\n _this.reconnect();\n }\n });\n this.handlerId = null; // The drop target may either be attached via ref or connect function\n\n this.dropTargetRef = null;\n this.dropTargetOptionsInternal = null;\n this.lastConnectedHandlerId = null;\n this.lastConnectedDropTarget = null;\n this.lastConnectedDropTargetOptions = null;\n this.backend = backend;\n }\n\n _createClass(TargetConnector, [{\n key: \"reconnect\",\n value: function reconnect() {\n // if nothing has changed then don't resubscribe\n var didChange = this.didHandlerIdChange() || this.didDropTargetChange() || this.didOptionsChange();\n\n if (didChange) {\n this.disconnectDropTarget();\n }\n\n var dropTarget = this.dropTarget;\n\n if (!this.handlerId) {\n return;\n }\n\n if (!dropTarget) {\n this.lastConnectedDropTarget = dropTarget;\n return;\n }\n\n if (didChange) {\n this.lastConnectedHandlerId = this.handlerId;\n this.lastConnectedDropTarget = dropTarget;\n this.lastConnectedDropTargetOptions = this.dropTargetOptions;\n this.unsubscribeDropTarget = this.backend.connectDropTarget(this.handlerId, dropTarget, this.dropTargetOptions);\n }\n }\n }, {\n key: \"receiveHandlerId\",\n value: function receiveHandlerId(newHandlerId) {\n if (newHandlerId === this.handlerId) {\n return;\n }\n\n this.handlerId = newHandlerId;\n this.reconnect();\n }\n }, {\n key: \"didHandlerIdChange\",\n value: function didHandlerIdChange() {\n return this.lastConnectedHandlerId !== this.handlerId;\n }\n }, {\n key: \"didDropTargetChange\",\n value: function didDropTargetChange() {\n return this.lastConnectedDropTarget !== this.dropTarget;\n }\n }, {\n key: \"didOptionsChange\",\n value: function didOptionsChange() {\n return !shallowEqual(this.lastConnectedDropTargetOptions, this.dropTargetOptions);\n }\n }, {\n key: \"disconnectDropTarget\",\n value: function disconnectDropTarget() {\n if (this.unsubscribeDropTarget) {\n this.unsubscribeDropTarget();\n this.unsubscribeDropTarget = undefined;\n }\n }\n }, {\n key: \"clearDropTarget\",\n value: function clearDropTarget() {\n this.dropTargetRef = null;\n this.dropTargetNode = null;\n }\n }, {\n key: \"connectTarget\",\n get: function get() {\n return this.dropTarget;\n }\n }, {\n key: \"dropTargetOptions\",\n get: function get() {\n return this.dropTargetOptionsInternal;\n },\n set: function set(options) {\n this.dropTargetOptionsInternal = options;\n }\n }, {\n key: \"dropTarget\",\n get: function get() {\n return this.dropTargetNode || this.dropTargetRef && this.dropTargetRef.current;\n }\n }]);\n\n return TargetConnector;\n}();","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { invariant } from '@react-dnd/invariant';\nvar isCallingCanDrop = false;\nexport var DropTargetMonitorImpl =\n/*#__PURE__*/\nfunction () {\n function DropTargetMonitorImpl(manager) {\n _classCallCheck(this, DropTargetMonitorImpl);\n\n this.targetId = null;\n this.internalMonitor = manager.getMonitor();\n }\n\n _createClass(DropTargetMonitorImpl, [{\n key: \"receiveHandlerId\",\n value: function receiveHandlerId(targetId) {\n this.targetId = targetId;\n }\n }, {\n key: \"getHandlerId\",\n value: function getHandlerId() {\n return this.targetId;\n }\n }, {\n key: \"subscribeToStateChange\",\n value: function subscribeToStateChange(listener, options) {\n return this.internalMonitor.subscribeToStateChange(listener, options);\n }\n }, {\n key: \"canDrop\",\n value: function canDrop() {\n // Cut out early if the target id has not been set. This should prevent errors\n // where the user has an older version of dnd-core like in\n // https://github.com/react-dnd/react-dnd/issues/1310\n if (!this.targetId) {\n return false;\n }\n\n invariant(!isCallingCanDrop, 'You may not call monitor.canDrop() inside your canDrop() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor');\n\n try {\n isCallingCanDrop = true;\n return this.internalMonitor.canDropOnTarget(this.targetId);\n } finally {\n isCallingCanDrop = false;\n }\n }\n }, {\n key: \"isOver\",\n value: function isOver(options) {\n if (!this.targetId) {\n return false;\n }\n\n return this.internalMonitor.isOverTarget(this.targetId, options);\n }\n }, {\n key: \"getItemType\",\n value: function getItemType() {\n return this.internalMonitor.getItemType();\n }\n }, {\n key: \"getItem\",\n value: function getItem() {\n return this.internalMonitor.getItem();\n }\n }, {\n key: \"getDropResult\",\n value: function getDropResult() {\n return this.internalMonitor.getDropResult();\n }\n }, {\n key: \"didDrop\",\n value: function didDrop() {\n return this.internalMonitor.didDrop();\n }\n }, {\n key: \"getInitialClientOffset\",\n value: function getInitialClientOffset() {\n return this.internalMonitor.getInitialClientOffset();\n }\n }, {\n key: \"getInitialSourceClientOffset\",\n value: function getInitialSourceClientOffset() {\n return this.internalMonitor.getInitialSourceClientOffset();\n }\n }, {\n key: \"getSourceClientOffset\",\n value: function getSourceClientOffset() {\n return this.internalMonitor.getSourceClientOffset();\n }\n }, {\n key: \"getClientOffset\",\n value: function getClientOffset() {\n return this.internalMonitor.getClientOffset();\n }\n }, {\n key: \"getDifferenceFromInitialOffset\",\n value: function getDifferenceFromInitialOffset() {\n return this.internalMonitor.getDifferenceFromInitialOffset();\n }\n }]);\n\n return DropTargetMonitorImpl;\n}();","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nimport { useMemo } from 'react';\nimport { registerTarget } from '../../common/registration';\nimport { useDragDropManager } from './useDragDropManager';\nimport { TargetConnector } from '../../common/TargetConnector';\nimport { DropTargetMonitorImpl } from '../../common/DropTargetMonitorImpl';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\nexport function useDropTargetMonitor() {\n var manager = useDragDropManager();\n var monitor = useMemo(function () {\n return new DropTargetMonitorImpl(manager);\n }, [manager]);\n var connector = useMemo(function () {\n return new TargetConnector(manager.getBackend());\n }, [manager]);\n return [monitor, connector];\n}\nexport function useDropHandler(spec, monitor, connector) {\n var manager = useDragDropManager();\n var handler = useMemo(function () {\n return {\n canDrop: function canDrop() {\n var canDrop = spec.current.canDrop;\n return canDrop ? canDrop(monitor.getItem(), monitor) : true;\n },\n hover: function hover() {\n var hover = spec.current.hover;\n\n if (hover) {\n hover(monitor.getItem(), monitor);\n }\n },\n drop: function drop() {\n var drop = spec.current.drop;\n\n if (drop) {\n return drop(monitor.getItem(), monitor);\n }\n }\n };\n }, [monitor]);\n useIsomorphicLayoutEffect(function registerHandler() {\n var _registerTarget = registerTarget(spec.current.accept, handler, manager),\n _registerTarget2 = _slicedToArray(_registerTarget, 2),\n handlerId = _registerTarget2[0],\n unregister = _registerTarget2[1];\n\n monitor.receiveHandlerId(handlerId);\n connector.receiveHandlerId(handlerId);\n return unregister;\n }, [monitor, connector]);\n}","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nimport { useRef, useMemo } from 'react';\nimport { invariant } from '@react-dnd/invariant';\nimport { useMonitorOutput } from './internal/useMonitorOutput';\nimport { useIsomorphicLayoutEffect } from './internal/useIsomorphicLayoutEffect';\nimport { useDropHandler, useDropTargetMonitor } from './internal/drop';\n/**\n * useDropTarget Hook\n * @param spec The drop target specification\n */\n\nexport function useDrop(spec) {\n var specRef = useRef(spec);\n specRef.current = spec;\n invariant(spec.accept != null, 'accept must be defined');\n\n var _useDropTargetMonitor = useDropTargetMonitor(),\n _useDropTargetMonitor2 = _slicedToArray(_useDropTargetMonitor, 2),\n monitor = _useDropTargetMonitor2[0],\n connector = _useDropTargetMonitor2[1];\n\n useDropHandler(specRef, monitor, connector);\n var result = useMonitorOutput(monitor, specRef.current.collect || function () {\n return {};\n }, function () {\n return connector.reconnect();\n });\n var connectDropTarget = useMemo(function () {\n return connector.hooks.dropTarget();\n }, [connector]);\n useIsomorphicLayoutEffect(function () {\n connector.dropTargetOptions = spec.options || null;\n connector.reconnect();\n }, [spec.options]);\n return [result, connectDropTarget];\n}","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nimport { useEffect } from 'react';\nimport { useDragDropManager } from './internal/useDragDropManager';\nimport { useCollector } from './internal/useCollector';\n/**\n * useDragLayer Hook\n * @param collector The property collector\n */\n\nexport function useDragLayer(collect) {\n var dragDropManager = useDragDropManager();\n var monitor = dragDropManager.getMonitor();\n\n var _useCollector = useCollector(monitor, collect),\n _useCollector2 = _slicedToArray(_useCollector, 2),\n collected = _useCollector2[0],\n updateCollected = _useCollector2[1];\n\n useEffect(function () {\n return monitor.subscribeToOffsetChange(updateCollected);\n });\n useEffect(function () {\n return monitor.subscribeToStateChange(updateCollected);\n });\n return collected;\n}","export * from './useDrag';\nexport * from './useDrop';\nexport * from './useDragLayer';","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n// cheap lodash replacements\nexport function isFunction(input) {\n return typeof input === 'function';\n}\nexport function noop() {// noop\n}\n\nfunction isObjectLike(input) {\n return _typeof(input) === 'object' && input !== null;\n}\n\nexport function isPlainObject(input) {\n if (!isObjectLike(input)) {\n return false;\n }\n\n if (Object.getPrototypeOf(input) === null) {\n return true;\n }\n\n var proto = input;\n\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(input) === proto;\n}","export function getDecoratedComponent(instanceRef) {\n var currentRef = instanceRef.current;\n\n if (currentRef == null) {\n return null;\n } else if (currentRef.decoratedRef) {\n // go through the private field in decorateHandler to avoid the invariant hit\n return currentRef.decoratedRef.current;\n } else {\n return currentRef;\n }\n}\nexport function isClassComponent(Component) {\n return Component && Component.prototype && typeof Component.prototype.render === 'function';\n}\nexport function isRefForwardingComponent(C) {\n return C && C.$$typeof && C.$$typeof.toString() === 'Symbol(react.forward_ref)';\n}\nexport function isRefable(C) {\n return isClassComponent(C) || isRefForwardingComponent(C);\n}\nexport function checkDecoratorArguments(functionName, signature) {\n if (process.env.NODE_ENV !== 'production') {\n for (var i = 0; i < (arguments.length <= 2 ? 0 : arguments.length - 2); i++) {\n var arg = i + 2 < 2 || arguments.length <= i + 2 ? undefined : arguments[i + 2];\n\n if (arg && arg.prototype && arg.prototype.render) {\n // eslint-disable-next-line no-console\n console.error('You seem to be applying the arguments in the wrong order. ' + \"It should be \".concat(functionName, \"(\").concat(signature, \")(Component), not the other way around. \") + 'Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#you-seem-to-be-applying-the-arguments-in-the-wrong-order');\n return;\n }\n }\n }\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { isFunction, noop } from '../utils/js_utils';\n/**\n * Provides a set of static methods for creating Disposables.\n * @param {Function} action Action to run during the first call to dispose.\n * The action is guaranteed to be run at most once.\n */\n\nexport var Disposable =\n/*#__PURE__*/\nfunction () {\n function Disposable(action) {\n _classCallCheck(this, Disposable);\n\n this.isDisposed = false;\n this.action = isFunction(action) ? action : noop;\n }\n /**\n * Validates whether the given object is a disposable\n * @param {Object} Object to test whether it has a dispose method\n * @returns {Boolean} true if a disposable object, else false.\n */\n\n\n _createClass(Disposable, [{\n key: \"dispose\",\n\n /** Performs the task of cleaning up resources. */\n value: function dispose() {\n if (!this.isDisposed) {\n this.action();\n this.isDisposed = true;\n }\n }\n }], [{\n key: \"isDisposable\",\n value: function isDisposable(d) {\n return d && isFunction(d.dispose);\n }\n }, {\n key: \"_fixup\",\n value: function _fixup(result) {\n return Disposable.isDisposable(result) ? result : Disposable.empty;\n }\n /**\n * Creates a disposable object that invokes the specified action when disposed.\n * @param {Function} dispose Action to run during the first call to dispose.\n * The action is guaranteed to be run at most once.\n * @return {Disposable} The disposable object that runs the given action upon disposal.\n */\n\n }, {\n key: \"create\",\n value: function create(action) {\n return new Disposable(action);\n }\n }]);\n\n return Disposable;\n}();\n/**\n * Gets the disposable that does nothing when disposed.\n */\n\nDisposable.empty = {\n dispose: noop\n};\n/**\n * Represents a group of disposable resources that are disposed together.\n * @constructor\n */\n\nexport var CompositeDisposable =\n/*#__PURE__*/\nfunction () {\n function CompositeDisposable() {\n _classCallCheck(this, CompositeDisposable);\n\n this.isDisposed = false;\n\n for (var _len = arguments.length, disposables = new Array(_len), _key = 0; _key < _len; _key++) {\n disposables[_key] = arguments[_key];\n }\n\n this.disposables = disposables;\n }\n /**\n * Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.\n * @param {Any} item Disposable to add.\n */\n\n\n _createClass(CompositeDisposable, [{\n key: \"add\",\n value: function add(item) {\n if (this.isDisposed) {\n item.dispose();\n } else {\n this.disposables.push(item);\n }\n }\n /**\n * Removes and disposes the first occurrence of a disposable from the CompositeDisposable.\n * @param {Any} item Disposable to remove.\n * @returns {Boolean} true if found; false otherwise.\n */\n\n }, {\n key: \"remove\",\n value: function remove(item) {\n var shouldDispose = false;\n\n if (!this.isDisposed) {\n var idx = this.disposables.indexOf(item);\n\n if (idx !== -1) {\n shouldDispose = true;\n this.disposables.splice(idx, 1);\n item.dispose();\n }\n }\n\n return shouldDispose;\n }\n /**\n * Disposes all disposables in the group and removes them from the group but\n * does not dispose the CompositeDisposable.\n */\n\n }, {\n key: \"clear\",\n value: function clear() {\n if (!this.isDisposed) {\n var len = this.disposables.length;\n var currentDisposables = new Array(len);\n\n for (var i = 0; i < len; i++) {\n currentDisposables[i] = this.disposables[i];\n }\n\n this.disposables = [];\n\n for (var _i = 0; _i < len; _i++) {\n currentDisposables[_i].dispose();\n }\n }\n }\n /**\n * Disposes all disposables in the group and removes them from the group.\n */\n\n }, {\n key: \"dispose\",\n value: function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n var len = this.disposables.length;\n var currentDisposables = new Array(len);\n\n for (var i = 0; i < len; i++) {\n currentDisposables[i] = this.disposables[i];\n }\n\n this.disposables = [];\n\n for (var _i2 = 0; _i2 < len; _i2++) {\n currentDisposables[_i2].dispose();\n }\n }\n }\n }]);\n\n return CompositeDisposable;\n}();\n/**\n * Represents a disposable resource whose underlying disposable resource can\n * be replaced by another disposable resource, causing automatic disposal of\n * the previous underlying disposable resource.\n */\n\nexport var SerialDisposable =\n/*#__PURE__*/\nfunction () {\n function SerialDisposable() {\n _classCallCheck(this, SerialDisposable);\n\n this.isDisposed = false;\n }\n /**\n * Gets the underlying disposable.\n * @returns {Any} the underlying disposable.\n */\n\n\n _createClass(SerialDisposable, [{\n key: \"getDisposable\",\n value: function getDisposable() {\n return this.current;\n }\n }, {\n key: \"setDisposable\",\n value: function setDisposable(value) {\n var shouldDispose = this.isDisposed;\n\n if (!shouldDispose) {\n var old = this.current;\n this.current = value;\n\n if (old) {\n old.dispose();\n }\n }\n\n if (shouldDispose && value) {\n value.dispose();\n }\n }\n /** Performs the task of cleaning up resources. */\n\n }, {\n key: \"dispose\",\n value: function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n var old = this.current;\n this.current = undefined;\n\n if (old) {\n old.dispose();\n }\n }\n }\n }]);\n\n return SerialDisposable;\n}();","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nimport * as React from 'react';\nimport { shallowEqual } from '@react-dnd/shallowequal';\nimport { invariant } from '@react-dnd/invariant';\nimport hoistStatics from 'hoist-non-react-statics';\nimport { DndContext } from '../index';\nimport { isPlainObject } from '../utils/js_utils';\nimport { Disposable, CompositeDisposable, SerialDisposable } from './disposables';\nimport { isRefable } from './utils';\nexport default function decorateHandler(_ref) {\n var DecoratedComponent = _ref.DecoratedComponent,\n createHandler = _ref.createHandler,\n createMonitor = _ref.createMonitor,\n createConnector = _ref.createConnector,\n registerHandler = _ref.registerHandler,\n containerDisplayName = _ref.containerDisplayName,\n getType = _ref.getType,\n collect = _ref.collect,\n options = _ref.options;\n var _options$arePropsEqua = options.arePropsEqual,\n arePropsEqual = _options$arePropsEqua === void 0 ? shallowEqual : _options$arePropsEqua;\n var Decorated = DecoratedComponent;\n var displayName = DecoratedComponent.displayName || DecoratedComponent.name || 'Component';\n\n var DragDropContainer =\n /*#__PURE__*/\n function (_React$Component) {\n _inherits(DragDropContainer, _React$Component);\n\n function DragDropContainer(props) {\n var _this;\n\n _classCallCheck(this, DragDropContainer);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(DragDropContainer).call(this, props));\n _this.decoratedRef = React.createRef();\n\n _this.handleChange = function () {\n var nextState = _this.getCurrentState();\n\n if (!shallowEqual(nextState, _this.state)) {\n _this.setState(nextState);\n }\n };\n\n _this.disposable = new SerialDisposable();\n\n _this.receiveProps(props);\n\n _this.dispose();\n\n return _this;\n }\n\n _createClass(DragDropContainer, [{\n key: \"getHandlerId\",\n value: function getHandlerId() {\n return this.handlerId;\n }\n }, {\n key: \"getDecoratedComponentInstance\",\n value: function getDecoratedComponentInstance() {\n invariant(this.decoratedRef.current, 'In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()');\n return this.decoratedRef.current;\n }\n }, {\n key: \"shouldComponentUpdate\",\n value: function shouldComponentUpdate(nextProps, nextState) {\n return !arePropsEqual(nextProps, this.props) || !shallowEqual(nextState, this.state);\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.disposable = new SerialDisposable();\n this.currentType = undefined;\n this.receiveProps(this.props);\n this.handleChange();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n if (!arePropsEqual(this.props, prevProps)) {\n this.receiveProps(this.props);\n this.handleChange();\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.dispose();\n }\n }, {\n key: \"receiveProps\",\n value: function receiveProps(props) {\n if (!this.handler) {\n return;\n }\n\n this.handler.receiveProps(props);\n this.receiveType(getType(props));\n }\n }, {\n key: \"receiveType\",\n value: function receiveType(type) {\n if (!this.handlerMonitor || !this.manager || !this.handlerConnector) {\n return;\n }\n\n if (type === this.currentType) {\n return;\n }\n\n this.currentType = type;\n\n var _registerHandler = registerHandler(type, this.handler, this.manager),\n _registerHandler2 = _slicedToArray(_registerHandler, 2),\n handlerId = _registerHandler2[0],\n unregister = _registerHandler2[1];\n\n this.handlerId = handlerId;\n this.handlerMonitor.receiveHandlerId(handlerId);\n this.handlerConnector.receiveHandlerId(handlerId);\n var globalMonitor = this.manager.getMonitor();\n var unsubscribe = globalMonitor.subscribeToStateChange(this.handleChange, {\n handlerIds: [handlerId]\n });\n this.disposable.setDisposable(new CompositeDisposable(new Disposable(unsubscribe), new Disposable(unregister)));\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n this.disposable.dispose();\n\n if (this.handlerConnector) {\n this.handlerConnector.receiveHandlerId(null);\n }\n }\n }, {\n key: \"getCurrentState\",\n value: function getCurrentState() {\n if (!this.handlerConnector) {\n return {};\n }\n\n var nextState = collect(this.handlerConnector.hooks, this.handlerMonitor, this.props);\n\n if (process.env.NODE_ENV !== 'production') {\n invariant(isPlainObject(nextState), 'Expected `collect` specified as the second argument to ' + '%s for %s to return a plain object of props to inject. ' + 'Instead, received %s.', containerDisplayName, displayName, nextState);\n }\n\n return nextState;\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this2 = this;\n\n return React.createElement(DndContext.Consumer, null, function (_ref2) {\n var dragDropManager = _ref2.dragDropManager;\n\n _this2.receiveDragDropManager(dragDropManager);\n\n if (typeof requestAnimationFrame !== 'undefined') {\n requestAnimationFrame(function () {\n return _this2.handlerConnector.reconnect();\n });\n }\n\n return React.createElement(Decorated, Object.assign({}, _this2.props, _this2.getCurrentState(), {\n // NOTE: if Decorated is a Function Component, decoratedRef will not be populated unless it's a refforwarding component.\n ref: isRefable(Decorated) ? _this2.decoratedRef : null\n }));\n });\n }\n }, {\n key: \"receiveDragDropManager\",\n value: function receiveDragDropManager(dragDropManager) {\n if (this.manager !== undefined) {\n return;\n }\n\n invariant(dragDropManager !== undefined, 'Could not find the drag and drop manager in the context of %s. ' + 'Make sure to render a DndProvider component in your top-level component. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#could-not-find-the-drag-and-drop-manager-in-the-context', displayName, displayName);\n\n if (dragDropManager === undefined) {\n return;\n }\n\n this.manager = dragDropManager;\n this.handlerMonitor = createMonitor(dragDropManager);\n this.handlerConnector = createConnector(dragDropManager.getBackend());\n this.handler = createHandler(this.handlerMonitor, this.decoratedRef);\n }\n }]);\n\n return DragDropContainer;\n }(React.Component);\n\n DragDropContainer.DecoratedComponent = DecoratedComponent;\n DragDropContainer.displayName = \"\".concat(containerDisplayName, \"(\").concat(displayName, \")\");\n return hoistStatics(DragDropContainer, DecoratedComponent);\n}","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nexport function isValidType(type, allowArray) {\n return typeof type === 'string' || _typeof(type) === 'symbol' || !!allowArray && Array.isArray(type) && type.every(function (t) {\n return isValidType(t, false);\n });\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { invariant } from '@react-dnd/invariant';\nimport { isPlainObject } from '../utils/js_utils';\nimport { getDecoratedComponent } from './utils';\nvar ALLOWED_SPEC_METHODS = ['canDrag', 'beginDrag', 'isDragging', 'endDrag'];\nvar REQUIRED_SPEC_METHODS = ['beginDrag'];\n\nvar SourceImpl =\n/*#__PURE__*/\nfunction () {\n function SourceImpl(spec, monitor, ref) {\n var _this = this;\n\n _classCallCheck(this, SourceImpl);\n\n this.props = null;\n\n this.beginDrag = function () {\n if (!_this.props) {\n return;\n }\n\n var item = _this.spec.beginDrag(_this.props, _this.monitor, _this.ref.current);\n\n if (process.env.NODE_ENV !== 'production') {\n invariant(isPlainObject(item), 'beginDrag() must return a plain object that represents the dragged item. ' + 'Instead received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', item);\n }\n\n return item;\n };\n\n this.spec = spec;\n this.monitor = monitor;\n this.ref = ref;\n }\n\n _createClass(SourceImpl, [{\n key: \"receiveProps\",\n value: function receiveProps(props) {\n this.props = props;\n }\n }, {\n key: \"canDrag\",\n value: function canDrag() {\n if (!this.props) {\n return false;\n }\n\n if (!this.spec.canDrag) {\n return true;\n }\n\n return this.spec.canDrag(this.props, this.monitor);\n }\n }, {\n key: \"isDragging\",\n value: function isDragging(globalMonitor, sourceId) {\n if (!this.props) {\n return false;\n }\n\n if (!this.spec.isDragging) {\n return sourceId === globalMonitor.getSourceId();\n }\n\n return this.spec.isDragging(this.props, this.monitor);\n }\n }, {\n key: \"endDrag\",\n value: function endDrag() {\n if (!this.props) {\n return;\n }\n\n if (!this.spec.endDrag) {\n return;\n }\n\n this.spec.endDrag(this.props, this.monitor, getDecoratedComponent(this.ref));\n }\n }]);\n\n return SourceImpl;\n}();\n\nexport default function createSourceFactory(spec) {\n Object.keys(spec).forEach(function (key) {\n invariant(ALLOWED_SPEC_METHODS.indexOf(key) > -1, 'Expected the drag source specification to only have ' + 'some of the following keys: %s. ' + 'Instead received a specification with an unexpected \"%s\" key. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', ALLOWED_SPEC_METHODS.join(', '), key);\n invariant(typeof spec[key] === 'function', 'Expected %s in the drag source specification to be a function. ' + 'Instead received a specification with %s: %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', key, key, spec[key]);\n });\n REQUIRED_SPEC_METHODS.forEach(function (key) {\n invariant(typeof spec[key] === 'function', 'Expected %s in the drag source specification to be a function. ' + 'Instead received a specification with %s: %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', key, key, spec[key]);\n });\n return function createSource(monitor, ref) {\n return new SourceImpl(spec, monitor, ref);\n };\n}","import { invariant } from '@react-dnd/invariant';\nimport { isPlainObject } from '../utils/js_utils';\nimport { checkDecoratorArguments } from './utils';\nimport decorateHandler from './decorateHandler';\nimport { registerSource } from '../common/registration';\nimport { DragSourceMonitorImpl } from '../common/DragSourceMonitorImpl';\nimport { SourceConnector } from '../common/SourceConnector';\nimport { isValidType } from '../utils/isValidType';\nimport createSourceFactory from './createSourceFactory';\n/**\n * Decorates a component as a dragsource\n * @param type The dragsource type\n * @param spec The drag source specification\n * @param collect The props collector function\n * @param options DnD options\n */\n\nexport function DragSource(type, spec, collect) {\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n checkDecoratorArguments('DragSource', 'type, spec, collect[, options]', type, spec, collect, options);\n var getType = type;\n\n if (typeof type !== 'function') {\n invariant(isValidType(type), 'Expected \"type\" provided as the first argument to DragSource to be ' + 'a string, or a function that returns a string given the current props. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', type);\n\n getType = function getType() {\n return type;\n };\n }\n\n invariant(isPlainObject(spec), 'Expected \"spec\" provided as the second argument to DragSource to be ' + 'a plain object. Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', spec);\n var createSource = createSourceFactory(spec);\n invariant(typeof collect === 'function', 'Expected \"collect\" provided as the third argument to DragSource to be ' + 'a function that returns a plain object of props to inject. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', collect);\n invariant(isPlainObject(options), 'Expected \"options\" provided as the fourth argument to DragSource to be ' + 'a plain object when specified. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', collect);\n return function decorateSource(DecoratedComponent) {\n return decorateHandler({\n containerDisplayName: 'DragSource',\n createHandler: createSource,\n registerHandler: registerSource,\n createConnector: function createConnector(backend) {\n return new SourceConnector(backend);\n },\n createMonitor: function createMonitor(manager) {\n return new DragSourceMonitorImpl(manager);\n },\n DecoratedComponent: DecoratedComponent,\n getType: getType,\n collect: collect,\n options: options\n });\n };\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { invariant } from '@react-dnd/invariant';\nimport { isPlainObject } from '../utils/js_utils';\nimport { getDecoratedComponent } from './utils';\nvar ALLOWED_SPEC_METHODS = ['canDrop', 'hover', 'drop'];\n\nvar TargetImpl =\n/*#__PURE__*/\nfunction () {\n function TargetImpl(spec, monitor, ref) {\n _classCallCheck(this, TargetImpl);\n\n this.props = null;\n this.spec = spec;\n this.monitor = monitor;\n this.ref = ref;\n }\n\n _createClass(TargetImpl, [{\n key: \"receiveProps\",\n value: function receiveProps(props) {\n this.props = props;\n }\n }, {\n key: \"receiveMonitor\",\n value: function receiveMonitor(monitor) {\n this.monitor = monitor;\n }\n }, {\n key: \"canDrop\",\n value: function canDrop() {\n if (!this.spec.canDrop) {\n return true;\n }\n\n return this.spec.canDrop(this.props, this.monitor);\n }\n }, {\n key: \"hover\",\n value: function hover() {\n if (!this.spec.hover) {\n return;\n }\n\n this.spec.hover(this.props, this.monitor, getDecoratedComponent(this.ref));\n }\n }, {\n key: \"drop\",\n value: function drop() {\n if (!this.spec.drop) {\n return undefined;\n }\n\n var dropResult = this.spec.drop(this.props, this.monitor, this.ref.current);\n\n if (process.env.NODE_ENV !== 'production') {\n invariant(typeof dropResult === 'undefined' || isPlainObject(dropResult), 'drop() must either return undefined, or an object that represents the drop result. ' + 'Instead received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', dropResult);\n }\n\n return dropResult;\n }\n }]);\n\n return TargetImpl;\n}();\n\nexport default function createTargetFactory(spec) {\n Object.keys(spec).forEach(function (key) {\n invariant(ALLOWED_SPEC_METHODS.indexOf(key) > -1, 'Expected the drop target specification to only have ' + 'some of the following keys: %s. ' + 'Instead received a specification with an unexpected \"%s\" key. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', ALLOWED_SPEC_METHODS.join(', '), key);\n invariant(typeof spec[key] === 'function', 'Expected %s in the drop target specification to be a function. ' + 'Instead received a specification with %s: %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', key, key, spec[key]);\n });\n return function createTarget(monitor, ref) {\n return new TargetImpl(spec, monitor, ref);\n };\n}","import { invariant } from '@react-dnd/invariant';\nimport { isPlainObject } from '../utils/js_utils';\nimport { registerTarget } from '../common/registration';\nimport { isValidType } from '../utils/isValidType';\nimport { TargetConnector } from '../common/TargetConnector';\nimport { DropTargetMonitorImpl } from '../common/DropTargetMonitorImpl';\nimport { checkDecoratorArguments } from './utils';\nimport decorateHandler from './decorateHandler';\nimport createTargetFactory from './createTargetFactory';\nexport function DropTarget(type, spec, collect) {\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n checkDecoratorArguments('DropTarget', 'type, spec, collect[, options]', type, spec, collect, options);\n var getType = type;\n\n if (typeof type !== 'function') {\n invariant(isValidType(type, true), 'Expected \"type\" provided as the first argument to DropTarget to be ' + 'a string, an array of strings, or a function that returns either given ' + 'the current props. Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', type);\n\n getType = function getType() {\n return type;\n };\n }\n\n invariant(isPlainObject(spec), 'Expected \"spec\" provided as the second argument to DropTarget to be ' + 'a plain object. Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', spec);\n var createTarget = createTargetFactory(spec);\n invariant(typeof collect === 'function', 'Expected \"collect\" provided as the third argument to DropTarget to be ' + 'a function that returns a plain object of props to inject. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', collect);\n invariant(isPlainObject(options), 'Expected \"options\" provided as the fourth argument to DropTarget to be ' + 'a plain object when specified. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', collect);\n return function decorateTarget(DecoratedComponent) {\n return decorateHandler({\n containerDisplayName: 'DropTarget',\n createHandler: createTarget,\n registerHandler: registerTarget,\n createMonitor: function createMonitor(manager) {\n return new DropTargetMonitorImpl(manager);\n },\n createConnector: function createConnector(backend) {\n return new TargetConnector(backend);\n },\n DecoratedComponent: DecoratedComponent,\n getType: getType,\n collect: collect,\n options: options\n });\n };\n}","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nimport * as React from 'react';\nimport { shallowEqual } from '@react-dnd/shallowequal';\nimport hoistStatics from 'hoist-non-react-statics';\nimport { invariant } from '@react-dnd/invariant';\nimport { DndContext } from '../index';\nimport { isPlainObject } from '../utils/js_utils';\nimport { isRefable, checkDecoratorArguments } from './utils';\nexport function DragLayer(collect) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n checkDecoratorArguments('DragLayer', 'collect[, options]', collect, options);\n invariant(typeof collect === 'function', 'Expected \"collect\" provided as the first argument to DragLayer to be a function that collects props to inject into the component. ', 'Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-layer', collect);\n invariant(isPlainObject(options), 'Expected \"options\" provided as the second argument to DragLayer to be a plain object when specified. ' + 'Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-layer', options);\n return function decorateLayer(DecoratedComponent) {\n var Decorated = DecoratedComponent;\n var _options$arePropsEqua = options.arePropsEqual,\n arePropsEqual = _options$arePropsEqua === void 0 ? shallowEqual : _options$arePropsEqua;\n var displayName = Decorated.displayName || Decorated.name || 'Component';\n\n var DragLayerContainer =\n /*#__PURE__*/\n function (_React$Component) {\n _inherits(DragLayerContainer, _React$Component);\n\n function DragLayerContainer() {\n var _this;\n\n _classCallCheck(this, DragLayerContainer);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(DragLayerContainer).apply(this, arguments));\n _this.isCurrentlyMounted = false;\n _this.ref = React.createRef();\n\n _this.handleChange = function () {\n if (!_this.isCurrentlyMounted) {\n return;\n }\n\n var nextState = _this.getCurrentState();\n\n if (!shallowEqual(nextState, _this.state)) {\n _this.setState(nextState);\n }\n };\n\n return _this;\n }\n\n _createClass(DragLayerContainer, [{\n key: \"getDecoratedComponentInstance\",\n value: function getDecoratedComponentInstance() {\n invariant(this.ref.current, 'In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()');\n return this.ref.current;\n }\n }, {\n key: \"shouldComponentUpdate\",\n value: function shouldComponentUpdate(nextProps, nextState) {\n return !arePropsEqual(nextProps, this.props) || !shallowEqual(nextState, this.state);\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.isCurrentlyMounted = true;\n this.handleChange();\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.isCurrentlyMounted = false;\n\n if (this.unsubscribeFromOffsetChange) {\n this.unsubscribeFromOffsetChange();\n this.unsubscribeFromOffsetChange = undefined;\n }\n\n if (this.unsubscribeFromStateChange) {\n this.unsubscribeFromStateChange();\n this.unsubscribeFromStateChange = undefined;\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this2 = this;\n\n return React.createElement(DndContext.Consumer, null, function (_ref) {\n var dragDropManager = _ref.dragDropManager;\n\n if (dragDropManager === undefined) {\n return null;\n }\n\n _this2.receiveDragDropManager(dragDropManager); // Let componentDidMount fire to initialize the collected state\n\n\n if (!_this2.isCurrentlyMounted) {\n return null;\n }\n\n return React.createElement(Decorated, Object.assign({}, _this2.props, _this2.state, {\n ref: isRefable(Decorated) ? _this2.ref : null\n }));\n });\n }\n }, {\n key: \"receiveDragDropManager\",\n value: function receiveDragDropManager(dragDropManager) {\n if (this.manager !== undefined) {\n return;\n }\n\n this.manager = dragDropManager;\n invariant(_typeof(dragDropManager) === 'object', 'Could not find the drag and drop manager in the context of %s. ' + 'Make sure to render a DndProvider component in your top-level component. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#could-not-find-the-drag-and-drop-manager-in-the-context', displayName, displayName);\n var monitor = this.manager.getMonitor();\n this.unsubscribeFromOffsetChange = monitor.subscribeToOffsetChange(this.handleChange);\n this.unsubscribeFromStateChange = monitor.subscribeToStateChange(this.handleChange);\n }\n }, {\n key: \"getCurrentState\",\n value: function getCurrentState() {\n if (!this.manager) {\n return {};\n }\n\n var monitor = this.manager.getMonitor();\n return collect(monitor, this.props);\n }\n }]);\n\n return DragLayerContainer;\n }(React.Component);\n\n DragLayerContainer.displayName = \"DragLayer(\".concat(displayName, \")\");\n DragLayerContainer.DecoratedComponent = DecoratedComponent;\n return hoistStatics(DragLayerContainer, DecoratedComponent);\n };\n}","export * from './DragSource';\nexport * from './DropTarget';\nexport * from './DragLayer';","export * from './common';\nexport * from './hooks';\nexport * from './decorators';","// cheap lodash replacements\nexport function memoize(fn) {\n var result = null;\n\n var memoized = function memoized() {\n if (result == null) {\n result = fn();\n }\n\n return result;\n };\n\n return memoized;\n}\n/**\n * drop-in replacement for _.without\n */\n\nexport function without(items, item) {\n return items.filter(function (i) {\n return i !== item;\n });\n}\nexport function union(itemsA, itemsB) {\n var set = new Set();\n\n var insertItem = function insertItem(item) {\n return set.add(item);\n };\n\n itemsA.forEach(insertItem);\n itemsB.forEach(insertItem);\n var result = [];\n set.forEach(function (key) {\n return result.push(key);\n });\n return result;\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { union, without } from './utils/js_utils';\n\nvar EnterLeaveCounter =\n/*#__PURE__*/\nfunction () {\n function EnterLeaveCounter(isNodeInDocument) {\n _classCallCheck(this, EnterLeaveCounter);\n\n this.entered = [];\n this.isNodeInDocument = isNodeInDocument;\n }\n\n _createClass(EnterLeaveCounter, [{\n key: \"enter\",\n value: function enter(enteringNode) {\n var _this = this;\n\n var previousLength = this.entered.length;\n\n var isNodeEntered = function isNodeEntered(node) {\n return _this.isNodeInDocument(node) && (!node.contains || node.contains(enteringNode));\n };\n\n this.entered = union(this.entered.filter(isNodeEntered), [enteringNode]);\n return previousLength === 0 && this.entered.length > 0;\n }\n }, {\n key: \"leave\",\n value: function leave(leavingNode) {\n var previousLength = this.entered.length;\n this.entered = without(this.entered.filter(this.isNodeInDocument), leavingNode);\n return previousLength > 0 && this.entered.length === 0;\n }\n }, {\n key: \"reset\",\n value: function reset() {\n this.entered = [];\n }\n }]);\n\n return EnterLeaveCounter;\n}();\n\nexport { EnterLeaveCounter as default };","import { memoize } from './utils/js_utils';\nexport var isFirefox = memoize(function () {\n return /firefox/i.test(navigator.userAgent);\n});\nexport var isSafari = memoize(function () {\n return Boolean(window.safari);\n});","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar MonotonicInterpolant =\n/*#__PURE__*/\nfunction () {\n function MonotonicInterpolant(xs, ys) {\n _classCallCheck(this, MonotonicInterpolant);\n\n var length = xs.length; // Rearrange xs and ys so that xs is sorted\n\n var indexes = [];\n\n for (var i = 0; i < length; i++) {\n indexes.push(i);\n }\n\n indexes.sort(function (a, b) {\n return xs[a] < xs[b] ? -1 : 1;\n }); // Get consecutive differences and slopes\n\n var dys = [];\n var dxs = [];\n var ms = [];\n var dx;\n var dy;\n\n for (var _i = 0; _i < length - 1; _i++) {\n dx = xs[_i + 1] - xs[_i];\n dy = ys[_i + 1] - ys[_i];\n dxs.push(dx);\n dys.push(dy);\n ms.push(dy / dx);\n } // Get degree-1 coefficients\n\n\n var c1s = [ms[0]];\n\n for (var _i2 = 0; _i2 < dxs.length - 1; _i2++) {\n var m2 = ms[_i2];\n var mNext = ms[_i2 + 1];\n\n if (m2 * mNext <= 0) {\n c1s.push(0);\n } else {\n dx = dxs[_i2];\n var dxNext = dxs[_i2 + 1];\n var common = dx + dxNext;\n c1s.push(3 * common / ((common + dxNext) / m2 + (common + dx) / mNext));\n }\n }\n\n c1s.push(ms[ms.length - 1]); // Get degree-2 and degree-3 coefficients\n\n var c2s = [];\n var c3s = [];\n var m;\n\n for (var _i3 = 0; _i3 < c1s.length - 1; _i3++) {\n m = ms[_i3];\n var c1 = c1s[_i3];\n var invDx = 1 / dxs[_i3];\n\n var _common = c1 + c1s[_i3 + 1] - m - m;\n\n c2s.push((m - c1 - _common) * invDx);\n c3s.push(_common * invDx * invDx);\n }\n\n this.xs = xs;\n this.ys = ys;\n this.c1s = c1s;\n this.c2s = c2s;\n this.c3s = c3s;\n }\n\n _createClass(MonotonicInterpolant, [{\n key: \"interpolate\",\n value: function interpolate(x) {\n var xs = this.xs,\n ys = this.ys,\n c1s = this.c1s,\n c2s = this.c2s,\n c3s = this.c3s; // The rightmost point in the dataset should give an exact result\n\n var i = xs.length - 1;\n\n if (x === xs[i]) {\n return ys[i];\n } // Search for the interval x is in, returning the corresponding y if x is one of the original xs\n\n\n var low = 0;\n var high = c3s.length - 1;\n var mid;\n\n while (low <= high) {\n mid = Math.floor(0.5 * (low + high));\n var xHere = xs[mid];\n\n if (xHere < x) {\n low = mid + 1;\n } else if (xHere > x) {\n high = mid - 1;\n } else {\n return ys[mid];\n }\n }\n\n i = Math.max(0, high); // Interpolate\n\n var diff = x - xs[i];\n var diffSq = diff * diff;\n return ys[i] + c1s[i] * diff + c2s[i] * diffSq + c3s[i] * diff * diffSq;\n }\n }]);\n\n return MonotonicInterpolant;\n}();\n\nexport { MonotonicInterpolant as default };","import { isSafari, isFirefox } from './BrowserDetector';\nimport MonotonicInterpolant from './MonotonicInterpolant';\nvar ELEMENT_NODE = 1;\nexport function getNodeClientOffset(node) {\n var el = node.nodeType === ELEMENT_NODE ? node : node.parentElement;\n\n if (!el) {\n return null;\n }\n\n var _el$getBoundingClient = el.getBoundingClientRect(),\n top = _el$getBoundingClient.top,\n left = _el$getBoundingClient.left;\n\n return {\n x: left,\n y: top\n };\n}\nexport function getEventClientOffset(e) {\n return {\n x: e.clientX,\n y: e.clientY\n };\n}\n\nfunction isImageNode(node) {\n return node.nodeName === 'IMG' && (isFirefox() || !document.documentElement.contains(node));\n}\n\nfunction getDragPreviewSize(isImage, dragPreview, sourceWidth, sourceHeight) {\n var dragPreviewWidth = isImage ? dragPreview.width : sourceWidth;\n var dragPreviewHeight = isImage ? dragPreview.height : sourceHeight; // Work around @2x coordinate discrepancies in browsers\n\n if (isSafari() && isImage) {\n dragPreviewHeight /= window.devicePixelRatio;\n dragPreviewWidth /= window.devicePixelRatio;\n }\n\n return {\n dragPreviewWidth: dragPreviewWidth,\n dragPreviewHeight: dragPreviewHeight\n };\n}\n\nexport function getDragPreviewOffset(sourceNode, dragPreview, clientOffset, anchorPoint, offsetPoint) {\n // The browsers will use the image intrinsic size under different conditions.\n // Firefox only cares if it's an image, but WebKit also wants it to be detached.\n var isImage = isImageNode(dragPreview);\n var dragPreviewNode = isImage ? sourceNode : dragPreview;\n var dragPreviewNodeOffsetFromClient = getNodeClientOffset(dragPreviewNode);\n var offsetFromDragPreview = {\n x: clientOffset.x - dragPreviewNodeOffsetFromClient.x,\n y: clientOffset.y - dragPreviewNodeOffsetFromClient.y\n };\n var sourceWidth = sourceNode.offsetWidth,\n sourceHeight = sourceNode.offsetHeight;\n var anchorX = anchorPoint.anchorX,\n anchorY = anchorPoint.anchorY;\n\n var _getDragPreviewSize = getDragPreviewSize(isImage, dragPreview, sourceWidth, sourceHeight),\n dragPreviewWidth = _getDragPreviewSize.dragPreviewWidth,\n dragPreviewHeight = _getDragPreviewSize.dragPreviewHeight;\n\n var calculateYOffset = function calculateYOffset() {\n var interpolantY = new MonotonicInterpolant([0, 0.5, 1], [// Dock to the top\n offsetFromDragPreview.y, // Align at the center\n offsetFromDragPreview.y / sourceHeight * dragPreviewHeight, // Dock to the bottom\n offsetFromDragPreview.y + dragPreviewHeight - sourceHeight]);\n var y = interpolantY.interpolate(anchorY); // Work around Safari 8 positioning bug\n\n if (isSafari() && isImage) {\n // We'll have to wait for @3x to see if this is entirely correct\n y += (window.devicePixelRatio - 1) * dragPreviewHeight;\n }\n\n return y;\n };\n\n var calculateXOffset = function calculateXOffset() {\n // Interpolate coordinates depending on anchor point\n // If you know a simpler way to do this, let me know\n var interpolantX = new MonotonicInterpolant([0, 0.5, 1], [// Dock to the left\n offsetFromDragPreview.x, // Align at the center\n offsetFromDragPreview.x / sourceWidth * dragPreviewWidth, // Dock to the right\n offsetFromDragPreview.x + dragPreviewWidth - sourceWidth]);\n return interpolantX.interpolate(anchorX);\n }; // Force offsets if specified in the options.\n\n\n var offsetX = offsetPoint.offsetX,\n offsetY = offsetPoint.offsetY;\n var isManualOffsetX = offsetX === 0 || offsetX;\n var isManualOffsetY = offsetY === 0 || offsetY;\n return {\n x: isManualOffsetX ? offsetX : calculateXOffset(),\n y: isManualOffsetY ? offsetY : calculateYOffset()\n };\n}","export var FILE = '__NATIVE_FILE__';\nexport var URL = '__NATIVE_URL__';\nexport var TEXT = '__NATIVE_TEXT__';","export function getDataFromDataTransfer(dataTransfer, typesToTry, defaultValue) {\n var result = typesToTry.reduce(function (resultSoFar, typeToTry) {\n return resultSoFar || dataTransfer.getData(typeToTry);\n }, '');\n return result != null ? result : defaultValue;\n}","var _nativeTypesConfig;\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport * as NativeTypes from '../NativeTypes';\nimport { getDataFromDataTransfer } from './getDataFromDataTransfer';\nexport var nativeTypesConfig = (_nativeTypesConfig = {}, _defineProperty(_nativeTypesConfig, NativeTypes.FILE, {\n exposeProperties: {\n files: function files(dataTransfer) {\n return Array.prototype.slice.call(dataTransfer.files);\n },\n items: function items(dataTransfer) {\n return dataTransfer.items;\n }\n },\n matchesTypes: ['Files']\n}), _defineProperty(_nativeTypesConfig, NativeTypes.URL, {\n exposeProperties: {\n urls: function urls(dataTransfer, matchesTypes) {\n return getDataFromDataTransfer(dataTransfer, matchesTypes, '').split('\\n');\n }\n },\n matchesTypes: ['Url', 'text/uri-list']\n}), _defineProperty(_nativeTypesConfig, NativeTypes.TEXT, {\n exposeProperties: {\n text: function text(dataTransfer, matchesTypes) {\n return getDataFromDataTransfer(dataTransfer, matchesTypes, '');\n }\n },\n matchesTypes: ['Text', 'text/plain']\n}), _nativeTypesConfig);","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nexport var NativeDragSource =\n/*#__PURE__*/\nfunction () {\n function NativeDragSource(config) {\n _classCallCheck(this, NativeDragSource);\n\n this.config = config;\n this.item = {};\n this.initializeExposedProperties();\n }\n\n _createClass(NativeDragSource, [{\n key: \"initializeExposedProperties\",\n value: function initializeExposedProperties() {\n var _this = this;\n\n Object.keys(this.config.exposeProperties).forEach(function (property) {\n Object.defineProperty(_this.item, property, {\n configurable: true,\n enumerable: true,\n get: function get() {\n // eslint-disable-next-line no-console\n console.warn(\"Browser doesn't allow reading \\\"\".concat(property, \"\\\" until the drop event.\"));\n return null;\n }\n });\n });\n }\n }, {\n key: \"loadDataTransfer\",\n value: function loadDataTransfer(dataTransfer) {\n var _this2 = this;\n\n if (dataTransfer) {\n var newProperties = {};\n Object.keys(this.config.exposeProperties).forEach(function (property) {\n newProperties[property] = {\n value: _this2.config.exposeProperties[property](dataTransfer, _this2.config.matchesTypes),\n configurable: true,\n enumerable: true\n };\n });\n Object.defineProperties(this.item, newProperties);\n }\n }\n }, {\n key: \"canDrag\",\n value: function canDrag() {\n return true;\n }\n }, {\n key: \"beginDrag\",\n value: function beginDrag() {\n return this.item;\n }\n }, {\n key: \"isDragging\",\n value: function isDragging(monitor, handle) {\n return handle === monitor.getSourceId();\n }\n }, {\n key: \"endDrag\",\n value: function endDrag() {// empty\n }\n }]);\n\n return NativeDragSource;\n}();","import { nativeTypesConfig } from './nativeTypesConfig';\nimport { NativeDragSource } from './NativeDragSource';\nexport function createNativeDragSource(type, dataTransfer) {\n var result = new NativeDragSource(nativeTypesConfig[type]);\n result.loadDataTransfer(dataTransfer);\n return result;\n}\nexport function matchNativeItemType(dataTransfer) {\n if (!dataTransfer) {\n return null;\n }\n\n var dataTransferTypes = Array.prototype.slice.call(dataTransfer.types || []);\n return Object.keys(nativeTypesConfig).filter(function (nativeItemType) {\n var matchesTypes = nativeTypesConfig[nativeItemType].matchesTypes;\n return matchesTypes.some(function (t) {\n return dataTransferTypes.indexOf(t) > -1;\n });\n })[0] || null;\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nexport var OptionsReader =\n/*#__PURE__*/\nfunction () {\n function OptionsReader(globalContext) {\n _classCallCheck(this, OptionsReader);\n\n this.globalContext = globalContext;\n }\n\n _createClass(OptionsReader, [{\n key: \"window\",\n get: function get() {\n if (this.globalContext) {\n return this.globalContext;\n } else if (typeof window !== 'undefined') {\n return window;\n }\n\n return undefined;\n }\n }, {\n key: \"document\",\n get: function get() {\n if (this.window) {\n return this.window.document;\n }\n\n return undefined;\n }\n }]);\n\n return OptionsReader;\n}();","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport EnterLeaveCounter from './EnterLeaveCounter';\nimport { isFirefox } from './BrowserDetector';\nimport { getNodeClientOffset, getEventClientOffset, getDragPreviewOffset } from './OffsetUtils';\nimport { createNativeDragSource, matchNativeItemType } from './NativeDragSources';\nimport * as NativeTypes from './NativeTypes';\nimport { OptionsReader } from './OptionsReader';\n\nvar HTML5Backend =\n/*#__PURE__*/\nfunction () {\n function HTML5Backend(manager, globalContext) {\n var _this = this;\n\n _classCallCheck(this, HTML5Backend);\n\n this.sourcePreviewNodes = new Map();\n this.sourcePreviewNodeOptions = new Map();\n this.sourceNodes = new Map();\n this.sourceNodeOptions = new Map();\n this.dragStartSourceIds = null;\n this.dropTargetIds = [];\n this.dragEnterTargetIds = [];\n this.currentNativeSource = null;\n this.currentNativeHandle = null;\n this.currentDragSourceNode = null;\n this.altKeyPressed = false;\n this.mouseMoveTimeoutTimer = null;\n this.asyncEndDragFrameId = null;\n this.dragOverTargetIds = null;\n\n this.getSourceClientOffset = function (sourceId) {\n return getNodeClientOffset(_this.sourceNodes.get(sourceId));\n };\n\n this.endDragNativeItem = function () {\n if (!_this.isDraggingNativeItem()) {\n return;\n }\n\n _this.actions.endDrag();\n\n _this.registry.removeSource(_this.currentNativeHandle);\n\n _this.currentNativeHandle = null;\n _this.currentNativeSource = null;\n };\n\n this.isNodeInDocument = function (node) {\n // Check the node either in the main document or in the current context\n return _this.document && _this.document.body && document.body.contains(node);\n };\n\n this.endDragIfSourceWasRemovedFromDOM = function () {\n var node = _this.currentDragSourceNode;\n\n if (_this.isNodeInDocument(node)) {\n return;\n }\n\n if (_this.clearCurrentDragSourceNode()) {\n _this.actions.endDrag();\n }\n };\n\n this.handleTopDragStartCapture = function () {\n _this.clearCurrentDragSourceNode();\n\n _this.dragStartSourceIds = [];\n };\n\n this.handleTopDragStart = function (e) {\n if (e.defaultPrevented) {\n return;\n }\n\n var dragStartSourceIds = _this.dragStartSourceIds;\n _this.dragStartSourceIds = null;\n var clientOffset = getEventClientOffset(e); // Avoid crashing if we missed a drop event or our previous drag died\n\n if (_this.monitor.isDragging()) {\n _this.actions.endDrag();\n } // Don't publish the source just yet (see why below)\n\n\n _this.actions.beginDrag(dragStartSourceIds || [], {\n publishSource: false,\n getSourceClientOffset: _this.getSourceClientOffset,\n clientOffset: clientOffset\n });\n\n var dataTransfer = e.dataTransfer;\n var nativeType = matchNativeItemType(dataTransfer);\n\n if (_this.monitor.isDragging()) {\n if (dataTransfer && typeof dataTransfer.setDragImage === 'function') {\n // Use custom drag image if user specifies it.\n // If child drag source refuses drag but parent agrees,\n // use parent's node as drag image. Neither works in IE though.\n var sourceId = _this.monitor.getSourceId();\n\n var sourceNode = _this.sourceNodes.get(sourceId);\n\n var dragPreview = _this.sourcePreviewNodes.get(sourceId) || sourceNode;\n\n if (dragPreview) {\n var _this$getCurrentSourc = _this.getCurrentSourcePreviewNodeOptions(),\n anchorX = _this$getCurrentSourc.anchorX,\n anchorY = _this$getCurrentSourc.anchorY,\n offsetX = _this$getCurrentSourc.offsetX,\n offsetY = _this$getCurrentSourc.offsetY;\n\n var anchorPoint = {\n anchorX: anchorX,\n anchorY: anchorY\n };\n var offsetPoint = {\n offsetX: offsetX,\n offsetY: offsetY\n };\n var dragPreviewOffset = getDragPreviewOffset(sourceNode, dragPreview, clientOffset, anchorPoint, offsetPoint);\n dataTransfer.setDragImage(dragPreview, dragPreviewOffset.x, dragPreviewOffset.y);\n }\n }\n\n try {\n // Firefox won't drag without setting data\n dataTransfer.setData('application/json', {});\n } catch (err) {} // IE doesn't support MIME types in setData\n // Store drag source node so we can check whether\n // it is removed from DOM and trigger endDrag manually.\n\n\n _this.setCurrentDragSourceNode(e.target); // Now we are ready to publish the drag source.. or are we not?\n\n\n var _this$getCurrentSourc2 = _this.getCurrentSourcePreviewNodeOptions(),\n captureDraggingState = _this$getCurrentSourc2.captureDraggingState;\n\n if (!captureDraggingState) {\n // Usually we want to publish it in the next tick so that browser\n // is able to screenshot the current (not yet dragging) state.\n //\n // It also neatly avoids a situation where render() returns null\n // in the same tick for the source element, and browser freaks out.\n setTimeout(function () {\n return _this.actions.publishDragSource();\n }, 0);\n } else {\n // In some cases the user may want to override this behavior, e.g.\n // to work around IE not supporting custom drag previews.\n //\n // When using a custom drag layer, the only way to prevent\n // the default drag preview from drawing in IE is to screenshot\n // the dragging state in which the node itself has zero opacity\n // and height. In this case, though, returning null from render()\n // will abruptly end the dragging, which is not obvious.\n //\n // This is the reason such behavior is strictly opt-in.\n _this.actions.publishDragSource();\n }\n } else if (nativeType) {\n // A native item (such as URL) dragged from inside the document\n _this.beginDragNativeItem(nativeType);\n } else if (dataTransfer && !dataTransfer.types && (e.target && !e.target.hasAttribute || !e.target.hasAttribute('draggable'))) {\n // Looks like a Safari bug: dataTransfer.types is null, but there was no draggable.\n // Just let it drag. It's a native type (URL or text) and will be picked up in\n // dragenter handler.\n return;\n } else {\n // If by this time no drag source reacted, tell browser not to drag.\n e.preventDefault();\n }\n };\n\n this.handleTopDragEndCapture = function () {\n if (_this.clearCurrentDragSourceNode()) {\n // Firefox can dispatch this event in an infinite loop\n // if dragend handler does something like showing an alert.\n // Only proceed if we have not handled it already.\n _this.actions.endDrag();\n }\n };\n\n this.handleTopDragEnterCapture = function (e) {\n _this.dragEnterTargetIds = [];\n\n var isFirstEnter = _this.enterLeaveCounter.enter(e.target);\n\n if (!isFirstEnter || _this.monitor.isDragging()) {\n return;\n }\n\n var dataTransfer = e.dataTransfer;\n var nativeType = matchNativeItemType(dataTransfer);\n\n if (nativeType) {\n // A native item (such as file or URL) dragged from outside the document\n _this.beginDragNativeItem(nativeType, dataTransfer);\n }\n };\n\n this.handleTopDragEnter = function (e) {\n var dragEnterTargetIds = _this.dragEnterTargetIds;\n _this.dragEnterTargetIds = [];\n\n if (!_this.monitor.isDragging()) {\n // This is probably a native item type we don't understand.\n return;\n }\n\n _this.altKeyPressed = e.altKey;\n\n if (!isFirefox()) {\n // Don't emit hover in `dragenter` on Firefox due to an edge case.\n // If the target changes position as the result of `dragenter`, Firefox\n // will still happily dispatch `dragover` despite target being no longer\n // there. The easy solution is to only fire `hover` in `dragover` on FF.\n _this.actions.hover(dragEnterTargetIds, {\n clientOffset: getEventClientOffset(e)\n });\n }\n\n var canDrop = dragEnterTargetIds.some(function (targetId) {\n return _this.monitor.canDropOnTarget(targetId);\n });\n\n if (canDrop) {\n // IE requires this to fire dragover events\n e.preventDefault();\n\n if (e.dataTransfer) {\n e.dataTransfer.dropEffect = _this.getCurrentDropEffect();\n }\n }\n };\n\n this.handleTopDragOverCapture = function () {\n _this.dragOverTargetIds = [];\n };\n\n this.handleTopDragOver = function (e) {\n var dragOverTargetIds = _this.dragOverTargetIds;\n _this.dragOverTargetIds = [];\n\n if (!_this.monitor.isDragging()) {\n // This is probably a native item type we don't understand.\n // Prevent default \"drop and blow away the whole document\" action.\n e.preventDefault();\n\n if (e.dataTransfer) {\n e.dataTransfer.dropEffect = 'none';\n }\n\n return;\n }\n\n _this.altKeyPressed = e.altKey;\n\n _this.actions.hover(dragOverTargetIds || [], {\n clientOffset: getEventClientOffset(e)\n });\n\n var canDrop = (dragOverTargetIds || []).some(function (targetId) {\n return _this.monitor.canDropOnTarget(targetId);\n });\n\n if (canDrop) {\n // Show user-specified drop effect.\n e.preventDefault();\n\n if (e.dataTransfer) {\n e.dataTransfer.dropEffect = _this.getCurrentDropEffect();\n }\n } else if (_this.isDraggingNativeItem()) {\n // Don't show a nice cursor but still prevent default\n // \"drop and blow away the whole document\" action.\n e.preventDefault();\n } else {\n e.preventDefault();\n\n if (e.dataTransfer) {\n e.dataTransfer.dropEffect = 'none';\n }\n }\n };\n\n this.handleTopDragLeaveCapture = function (e) {\n if (_this.isDraggingNativeItem()) {\n e.preventDefault();\n }\n\n var isLastLeave = _this.enterLeaveCounter.leave(e.target);\n\n if (!isLastLeave) {\n return;\n }\n\n if (_this.isDraggingNativeItem()) {\n _this.endDragNativeItem();\n }\n };\n\n this.handleTopDropCapture = function (e) {\n _this.dropTargetIds = [];\n e.preventDefault();\n\n if (_this.isDraggingNativeItem()) {\n _this.currentNativeSource.loadDataTransfer(e.dataTransfer);\n }\n\n _this.enterLeaveCounter.reset();\n };\n\n this.handleTopDrop = function (e) {\n var dropTargetIds = _this.dropTargetIds;\n _this.dropTargetIds = [];\n\n _this.actions.hover(dropTargetIds, {\n clientOffset: getEventClientOffset(e)\n });\n\n _this.actions.drop({\n dropEffect: _this.getCurrentDropEffect()\n });\n\n if (_this.isDraggingNativeItem()) {\n _this.endDragNativeItem();\n } else {\n _this.endDragIfSourceWasRemovedFromDOM();\n }\n };\n\n this.handleSelectStart = function (e) {\n var target = e.target; // Only IE requires us to explicitly say\n // we want drag drop operation to start\n\n if (typeof target.dragDrop !== 'function') {\n return;\n } // Inputs and textareas should be selectable\n\n\n if (target.tagName === 'INPUT' || target.tagName === 'SELECT' || target.tagName === 'TEXTAREA' || target.isContentEditable) {\n return;\n } // For other targets, ask IE\n // to enable drag and drop\n\n\n e.preventDefault();\n target.dragDrop();\n };\n\n this.options = new OptionsReader(globalContext);\n this.actions = manager.getActions();\n this.monitor = manager.getMonitor();\n this.registry = manager.getRegistry();\n this.enterLeaveCounter = new EnterLeaveCounter(this.isNodeInDocument);\n } // public for test\n\n\n _createClass(HTML5Backend, [{\n key: \"setup\",\n value: function setup() {\n if (this.window === undefined) {\n return;\n }\n\n if (this.window.__isReactDndBackendSetUp) {\n throw new Error('Cannot have two HTML5 backends at the same time.');\n }\n\n this.window.__isReactDndBackendSetUp = true;\n this.addEventListeners(this.window);\n }\n }, {\n key: \"teardown\",\n value: function teardown() {\n if (this.window === undefined) {\n return;\n }\n\n this.window.__isReactDndBackendSetUp = false;\n this.removeEventListeners(this.window);\n this.clearCurrentDragSourceNode();\n\n if (this.asyncEndDragFrameId) {\n this.window.cancelAnimationFrame(this.asyncEndDragFrameId);\n }\n }\n }, {\n key: \"connectDragPreview\",\n value: function connectDragPreview(sourceId, node, options) {\n var _this2 = this;\n\n this.sourcePreviewNodeOptions.set(sourceId, options);\n this.sourcePreviewNodes.set(sourceId, node);\n return function () {\n _this2.sourcePreviewNodes.delete(sourceId);\n\n _this2.sourcePreviewNodeOptions.delete(sourceId);\n };\n }\n }, {\n key: \"connectDragSource\",\n value: function connectDragSource(sourceId, node, options) {\n var _this3 = this;\n\n this.sourceNodes.set(sourceId, node);\n this.sourceNodeOptions.set(sourceId, options);\n\n var handleDragStart = function handleDragStart(e) {\n return _this3.handleDragStart(e, sourceId);\n };\n\n var handleSelectStart = function handleSelectStart(e) {\n return _this3.handleSelectStart(e);\n };\n\n node.setAttribute('draggable', 'true');\n node.addEventListener('dragstart', handleDragStart);\n node.addEventListener('selectstart', handleSelectStart);\n return function () {\n _this3.sourceNodes.delete(sourceId);\n\n _this3.sourceNodeOptions.delete(sourceId);\n\n node.removeEventListener('dragstart', handleDragStart);\n node.removeEventListener('selectstart', handleSelectStart);\n node.setAttribute('draggable', 'false');\n };\n }\n }, {\n key: \"connectDropTarget\",\n value: function connectDropTarget(targetId, node) {\n var _this4 = this;\n\n var handleDragEnter = function handleDragEnter(e) {\n return _this4.handleDragEnter(e, targetId);\n };\n\n var handleDragOver = function handleDragOver(e) {\n return _this4.handleDragOver(e, targetId);\n };\n\n var handleDrop = function handleDrop(e) {\n return _this4.handleDrop(e, targetId);\n };\n\n node.addEventListener('dragenter', handleDragEnter);\n node.addEventListener('dragover', handleDragOver);\n node.addEventListener('drop', handleDrop);\n return function () {\n node.removeEventListener('dragenter', handleDragEnter);\n node.removeEventListener('dragover', handleDragOver);\n node.removeEventListener('drop', handleDrop);\n };\n }\n }, {\n key: \"addEventListeners\",\n value: function addEventListeners(target) {\n // SSR Fix (https://github.com/react-dnd/react-dnd/pull/813\n if (!target.addEventListener) {\n return;\n }\n\n target.addEventListener('dragstart', this.handleTopDragStart);\n target.addEventListener('dragstart', this.handleTopDragStartCapture, true);\n target.addEventListener('dragend', this.handleTopDragEndCapture, true);\n target.addEventListener('dragenter', this.handleTopDragEnter);\n target.addEventListener('dragenter', this.handleTopDragEnterCapture, true);\n target.addEventListener('dragleave', this.handleTopDragLeaveCapture, true);\n target.addEventListener('dragover', this.handleTopDragOver);\n target.addEventListener('dragover', this.handleTopDragOverCapture, true);\n target.addEventListener('drop', this.handleTopDrop);\n target.addEventListener('drop', this.handleTopDropCapture, true);\n }\n }, {\n key: \"removeEventListeners\",\n value: function removeEventListeners(target) {\n // SSR Fix (https://github.com/react-dnd/react-dnd/pull/813\n if (!target.removeEventListener) {\n return;\n }\n\n target.removeEventListener('dragstart', this.handleTopDragStart);\n target.removeEventListener('dragstart', this.handleTopDragStartCapture, true);\n target.removeEventListener('dragend', this.handleTopDragEndCapture, true);\n target.removeEventListener('dragenter', this.handleTopDragEnter);\n target.removeEventListener('dragenter', this.handleTopDragEnterCapture, true);\n target.removeEventListener('dragleave', this.handleTopDragLeaveCapture, true);\n target.removeEventListener('dragover', this.handleTopDragOver);\n target.removeEventListener('dragover', this.handleTopDragOverCapture, true);\n target.removeEventListener('drop', this.handleTopDrop);\n target.removeEventListener('drop', this.handleTopDropCapture, true);\n }\n }, {\n key: \"getCurrentSourceNodeOptions\",\n value: function getCurrentSourceNodeOptions() {\n var sourceId = this.monitor.getSourceId();\n var sourceNodeOptions = this.sourceNodeOptions.get(sourceId);\n return _objectSpread({\n dropEffect: this.altKeyPressed ? 'copy' : 'move'\n }, sourceNodeOptions || {});\n }\n }, {\n key: \"getCurrentDropEffect\",\n value: function getCurrentDropEffect() {\n if (this.isDraggingNativeItem()) {\n // It makes more sense to default to 'copy' for native resources\n return 'copy';\n }\n\n return this.getCurrentSourceNodeOptions().dropEffect;\n }\n }, {\n key: \"getCurrentSourcePreviewNodeOptions\",\n value: function getCurrentSourcePreviewNodeOptions() {\n var sourceId = this.monitor.getSourceId();\n var sourcePreviewNodeOptions = this.sourcePreviewNodeOptions.get(sourceId);\n return _objectSpread({\n anchorX: 0.5,\n anchorY: 0.5,\n captureDraggingState: false\n }, sourcePreviewNodeOptions || {});\n }\n }, {\n key: \"isDraggingNativeItem\",\n value: function isDraggingNativeItem() {\n var itemType = this.monitor.getItemType();\n return Object.keys(NativeTypes).some(function (key) {\n return NativeTypes[key] === itemType;\n });\n }\n }, {\n key: \"beginDragNativeItem\",\n value: function beginDragNativeItem(type, dataTransfer) {\n this.clearCurrentDragSourceNode();\n this.currentNativeSource = createNativeDragSource(type, dataTransfer);\n this.currentNativeHandle = this.registry.addSource(type, this.currentNativeSource);\n this.actions.beginDrag([this.currentNativeHandle]);\n }\n }, {\n key: \"setCurrentDragSourceNode\",\n value: function setCurrentDragSourceNode(node) {\n var _this5 = this;\n\n this.clearCurrentDragSourceNode();\n this.currentDragSourceNode = node; // A timeout of > 0 is necessary to resolve Firefox issue referenced\n // See:\n // * https://github.com/react-dnd/react-dnd/pull/928\n // * https://github.com/react-dnd/react-dnd/issues/869\n\n var MOUSE_MOVE_TIMEOUT = 1000; // Receiving a mouse event in the middle of a dragging operation\n // means it has ended and the drag source node disappeared from DOM,\n // so the browser didn't dispatch the dragend event.\n //\n // We need to wait before we start listening for mousemove events.\n // This is needed because the drag preview needs to be drawn or else it fires an 'mousemove' event\n // immediately in some browsers.\n //\n // See:\n // * https://github.com/react-dnd/react-dnd/pull/928\n // * https://github.com/react-dnd/react-dnd/issues/869\n //\n\n this.mouseMoveTimeoutTimer = setTimeout(function () {\n return _this5.window && _this5.window.addEventListener('mousemove', _this5.endDragIfSourceWasRemovedFromDOM, true);\n }, MOUSE_MOVE_TIMEOUT);\n }\n }, {\n key: \"clearCurrentDragSourceNode\",\n value: function clearCurrentDragSourceNode() {\n if (this.currentDragSourceNode) {\n this.currentDragSourceNode = null;\n\n if (this.window) {\n this.window.clearTimeout(this.mouseMoveTimeoutTimer || undefined);\n this.window.removeEventListener('mousemove', this.endDragIfSourceWasRemovedFromDOM, true);\n }\n\n this.mouseMoveTimeoutTimer = null;\n return true;\n }\n\n return false;\n }\n }, {\n key: \"handleDragStart\",\n value: function handleDragStart(e, sourceId) {\n if (e.defaultPrevented) {\n return;\n }\n\n if (!this.dragStartSourceIds) {\n this.dragStartSourceIds = [];\n }\n\n this.dragStartSourceIds.unshift(sourceId);\n }\n }, {\n key: \"handleDragEnter\",\n value: function handleDragEnter(e, targetId) {\n this.dragEnterTargetIds.unshift(targetId);\n }\n }, {\n key: \"handleDragOver\",\n value: function handleDragOver(e, targetId) {\n if (this.dragOverTargetIds === null) {\n this.dragOverTargetIds = [];\n }\n\n this.dragOverTargetIds.unshift(targetId);\n }\n }, {\n key: \"handleDrop\",\n value: function handleDrop(e, targetId) {\n this.dropTargetIds.unshift(targetId);\n }\n }, {\n key: \"window\",\n get: function get() {\n return this.options.window;\n }\n }, {\n key: \"document\",\n get: function get() {\n return this.options.document;\n }\n }]);\n\n return HTML5Backend;\n}();\n\nexport { HTML5Backend as default };","var emptyImage;\nexport function getEmptyImage() {\n if (!emptyImage) {\n emptyImage = new Image();\n emptyImage.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';\n }\n\n return emptyImage;\n}","import HTML5Backend from './HTML5Backend';\nimport * as NativeTypes from './NativeTypes';\nexport { getEmptyImage } from './getEmptyImage';\nexport { NativeTypes };\n\nvar createBackend = function createBackend(manager, context) {\n return new HTML5Backend(manager, context);\n};\n\nexport default createBackend;","import { HotKeys, IgnoreKeys, configure, GlobalHotKeys } from 'react-hotkeys';\nexport { GlobalHotKeys, HotKeys, IgnoreKeys } from 'react-hotkeys';\nimport { getScope, getDocument, isFocused, getPlugin, isEmpty, undo, redo, focus, focusPrevious, focusNext, getParent, insertChildAfter, mayRemoveChild, removeChild, change, createStore, getRoot, getPendingChanges, hasPendingChanges, serializeRootDocument, initRoot } from '@edtr-io/store';\nimport { createContext, createElement, useContext, useCallback, useMemo, useState, useRef, useEffect, Fragment, Component, forwardRef } from 'react';\nimport { Provider as Provider$1 } from 'react-redux';\nimport { useTheme, styled, RootThemeProvider } from '@edtr-io/ui';\nimport { mergeDeepRight } from 'ramda';\nimport { createPortal } from 'react-dom';\nimport { createDefaultDocumentEditor } from '@edtr-io/default-document-editor/beta';\nimport { createDefaultPluginToolbar } from '@edtr-io/default-plugin-toolbar/beta';\nimport { DndProvider } from 'react-dnd';\nimport HTML5Backend from 'react-dnd-html5-backend';\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nvar createDispatchHook = /*#__PURE__*/require('react-redux').createDispatchHook;\n\nvar createSelectorHook = /*#__PURE__*/require('react-redux').createSelectorHook;\n\nvar createStoreHook = /*#__PURE__*/require('react-redux').createStoreHook;\n/** @public */\n\n\nvar ScopeContext = /*#__PURE__*/createContext({\n scope: ''\n});\n/** @public */\n\nvar EditorContext = /*#__PURE__*/createContext( // eslint-disable-next-line @typescript-eslint/no-explicit-any\nundefined);\n/** @public */\n\nvar ErrorContext = /*#__PURE__*/createContext(undefined); // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Store Provider\r\n *\r\n * @param props - The {@link https://react-redux.js.org/api/provider#props | ProviderProps}\r\n * @public\r\n */\n\nfunction Provider(props) {\n return createElement(Provider$1, Object.assign({}, props, {\n context: EditorContext\n }));\n}\n/**\r\n * @param enforcedScope - If provided, used as the scope instead of the current scope\r\n *\r\n * @public\r\n */\n\nfunction useScope(enforcedScope) {\n var _React$useContext = useContext(ScopeContext),\n scope = _React$useContext.scope;\n\n return enforcedScope === undefined ? scope : enforcedScope;\n}\n/** @public */\n\nvar useDispatch = /*#__PURE__*/createDispatchHook(EditorContext); // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * React Hook to dispatch an action in the current scope\r\n *\r\n * @param enforcedScope - If provided, used as the scope instead of the current scope\r\n * @public\r\n */\n\nfunction useScopedDispatch(enforcedScope) {\n var scope = useScope(enforcedScope);\n var dispatch = useDispatch();\n return useCallback(scopeDispatch(dispatch, scope), [dispatch, scope]);\n}\n\nfunction scopeDispatch(dispatch, scope) {\n return function (scopedAction) {\n dispatch(scopedAction(scope));\n };\n}\n/** @public */\n\n\nvar useSelector = /*#__PURE__*/createSelectorHook(EditorContext);\n/**\r\n * React Hook to get the value of an selector in the current scope\r\n *\r\n * @param scopedSelector - The selector\r\n * @param enforcedScope - If provided, used as the scope instead of the current scope\r\n * @returns The value of the selector in the current scope\r\n * @public\r\n */\n\nfunction useScopedSelector(scopedSelector, enforcedScope) {\n var scope = useScope(enforcedScope);\n return useSelector(function (state) {\n return scopedSelector(getScope(state, scope));\n });\n}\n/** @public */\n\nvar useStore = /*#__PURE__*/createStoreHook(EditorContext);\n/**\r\n * React Hook to obtain a reference to the scoped store\r\n *\r\n * @param enforcedScope - If provided, used as the scope instead of the current scope\r\n * @returns The scoped store\r\n * @public\r\n */\n\nfunction useScopedStore(enforcedScope) {\n var scope = useScope(enforcedScope);\n var store = useStore();\n return useMemo(function () {\n return {\n dispatch: scopeDispatch(store.dispatch, scope),\n getState: function getState() {\n return getScope(store.getState(), scope);\n },\n subscribe: function subscribe(listener) {\n return store.subscribe(listener);\n }\n };\n }, [scope, store]);\n}\n\n/** @public */\n\nvar DocumentEditorContext = /*#__PURE__*/createContext( // eslint-disable-next-line @typescript-eslint/no-explicit-any\nundefined);\n\n/** @public */\n\nvar PluginToolbarContext = /*#__PURE__*/createContext( // eslint-disable-next-line @typescript-eslint/no-explicit-any\nundefined);\n\n/** @beta */\n\nvar PreferenceContext = /*#__PURE__*/createContext({\n getKey: function getKey() {},\n setKey: function setKey() {}\n});\nvar store = {};\n/**\r\n * Sets a preference\r\n *\r\n * @param key - The preference\r\n * @param val - The value\r\n * @beta\r\n */\n\nfunction setDefaultPreference(key, val) {\n store[key] = val;\n}\nfunction PreferenceContextProvider(props) {\n var _React$useState = useState(1),\n state = _React$useState[0],\n setState = _React$useState[1];\n\n function setKey(key, val) {\n store[key] = val;\n setState(state + 1);\n }\n\n function getKey(key) {\n return store[key];\n }\n\n return createElement(PreferenceContext.Provider, {\n value: {\n setKey: setKey,\n getKey: getKey\n }\n }, props.children);\n}\n\nvar StyledDocument = /*#__PURE__*/styled.div({\n outline: 'none'\n});\nvar hotKeysKeyMap = {\n FOCUS_PREVIOUS: 'up',\n FOCUS_NEXT: 'down',\n INSERT_DEFAULT_PLUGIN: 'enter',\n DELETE_EMPTY: ['backspace', 'del'],\n UNDO: ['ctrl+z', 'command+z'],\n REDO: ['ctrl+y', 'command+y', 'ctrl+shift+z', 'command+shift+z']\n};\nfunction SubDocumentEditor(_ref) {\n var id = _ref.id,\n pluginProps = _ref.pluginProps;\n\n var _React$useState = useState(false),\n hasSettings = _React$useState[0],\n setHasSettings = _React$useState[1];\n\n var _React$useState2 = useState(false),\n hasToolbar = _React$useState2[0],\n setHasToolbar = _React$useState2[1];\n\n var document = useScopedSelector(getDocument(id));\n var focused = useScopedSelector(isFocused(id));\n var plugin = useScopedSelector(function (state) {\n return document && getPlugin(document.plugin)(state);\n });\n var store = useScopedStore();\n var container = useRef(null);\n var settingsRef = useRef(window.document.createElement('div'));\n var toolbarRef = useRef(window.document.createElement('div'));\n var DocumentEditor = useContext(DocumentEditorContext);\n var PluginToolbar = useContext(PluginToolbarContext);\n var autofocusRef = useRef(null);\n useEffect(function () {\n if (focused) {\n setTimeout(function () {\n if (autofocusRef.current) {\n autofocusRef.current.focus();\n }\n });\n }\n }, [focused]);\n useEffect(function () {\n if (focused && container.current && document && plugin && !plugin.state.getFocusableChildren(document.state).length) {\n container.current.focus();\n } // `document` should not be part of the dependencies because we only want to call this once when the document gets focused\n // eslint-disable-next-line react-hooks/exhaustive-deps\n\n }, [focused, plugin]);\n var hotKeysHandlers = useMemo(function () {\n return {\n FOCUS_PREVIOUS: function FOCUS_PREVIOUS(e) {\n handleKeyDown(e, function () {\n store.dispatch(focusPrevious());\n });\n },\n FOCUS_NEXT: function FOCUS_NEXT(e) {\n handleKeyDown(e, function () {\n store.dispatch(focusNext());\n });\n },\n INSERT_DEFAULT_PLUGIN: function INSERT_DEFAULT_PLUGIN(e) {\n handleKeyDown(e, function () {\n var parent = getParent(id)(store.getState());\n if (!parent) return;\n store.dispatch(insertChildAfter({\n parent: parent.id,\n sibling: id\n }));\n });\n },\n DELETE_EMPTY: function DELETE_EMPTY(e) {\n if (isEmpty(id)(store.getState())) {\n handleKeyDown(e, function () {\n if (!e) return;\n\n if (mayRemoveChild(id)(store.getState())) {\n var parent = getParent(id)(store.getState());\n if (!parent) return;\n\n if (e.key === 'Backspace') {\n store.dispatch(focusPrevious());\n } else if (e.key === 'Delete') {\n store.dispatch(focusNext());\n }\n\n store.dispatch(removeChild({\n parent: parent.id,\n child: id\n }));\n }\n });\n }\n },\n // TODO: workaround for https://github.com/edtr-io/edtr-io/issues/272\n UNDO: function UNDO() {\n store.dispatch(undo());\n },\n REDO: function REDO() {\n store.dispatch(redo());\n }\n };\n\n function handleKeyDown(e, next) {\n if (e && plugin && typeof plugin.onKeyDown === 'function' && !plugin.onKeyDown(e)) {\n return;\n }\n\n e && e.preventDefault();\n next();\n }\n }, [id, store, plugin]);\n var handleFocus = useCallback(function (e) {\n // Find closest document\n var target = e.target.closest('[data-document]');\n\n if (!focused && target === container.current) {\n store.dispatch(focus(id));\n }\n }, [store, focused, id]);\n var renderIntoSettings = useCallback(function (children) {\n return createElement(RenderIntoSettings, {\n setHasSettings: setHasSettings,\n settingsRef: settingsRef\n }, children);\n }, [settingsRef]);\n var renderIntoToolbar = useCallback(function (children) {\n setHasToolbar(true);\n if (!toolbarRef.current) return null;\n return createPortal(children, toolbarRef.current);\n }, [toolbarRef]);\n var theme = useTheme();\n return useMemo(function () {\n if (!document) return null;\n\n if (!plugin) {\n // eslint-disable-next-line no-console\n console.log('Plugin does not exist');\n return null;\n }\n\n var defaultConfig = typeof plugin.config === 'function' ? plugin.config(theme) : plugin.config;\n var overrideConfig = pluginProps && pluginProps.config || {};\n var config = mergeDeepRight(defaultConfig, overrideConfig);\n\n var onChange = function onChange(initial, executor) {\n store.dispatch(change({\n id: id,\n state: {\n initial: initial,\n executor: executor\n }\n }));\n };\n\n var state = plugin.state.init(document.state, onChange);\n return createElement(HotKeys, {\n keyMap: hotKeysKeyMap,\n handlers: hotKeysHandlers,\n allowChanges: true\n }, createElement(StyledDocument, {\n onMouseDown: handleFocus,\n ref: container,\n \"data-document\": true,\n tabIndex: -1\n }, createElement(DocumentEditor, {\n hasSettings: hasSettings,\n hasToolbar: hasToolbar,\n focused: focused,\n renderSettings: pluginProps && pluginProps.renderSettings,\n renderToolbar: pluginProps && pluginProps.renderToolbar,\n settingsRef: settingsRef,\n toolbarRef: toolbarRef,\n PluginToolbar: PluginToolbar\n }, createElement(plugin.Component, {\n renderIntoSettings: renderIntoSettings,\n renderIntoToolbar: renderIntoToolbar,\n id: id,\n editable: true,\n focused: focused,\n config: config,\n state: state,\n autofocusRef: autofocusRef\n }))));\n }, [document, plugin, theme, pluginProps, handleFocus, hasSettings, hasToolbar, focused, PluginToolbar, renderIntoSettings, renderIntoToolbar, id, hotKeysHandlers, store]);\n}\n\nfunction RenderIntoSettings(_ref2) {\n var children = _ref2.children,\n setHasSettings = _ref2.setHasSettings,\n settingsRef = _ref2.settingsRef;\n useEffect(function () {\n setHasSettings(true);\n });\n if (!settingsRef.current) return null;\n return createPortal(createElement(IgnoreKeys, null, children), settingsRef.current);\n}\n\nfunction SubDocumentRenderer(_ref) {\n var id = _ref.id,\n pluginProps = _ref.pluginProps;\n var document = useScopedSelector(getDocument(id));\n var plugin = useScopedSelector(function (state) {\n return document && getPlugin(document.plugin)(state);\n });\n var focusRef = useRef(null);\n var theme = useTheme();\n if (!document) return null;\n\n if (!plugin) {\n // TODO:\n // eslint-disable-next-line no-console\n console.log('Plugin does not exist');\n return null;\n }\n\n var defaultConfig = typeof plugin.config === 'function' ? plugin.config(theme) : plugin.config;\n var overrideConfig = pluginProps && pluginProps.config || {};\n var config = mergeDeepRight(defaultConfig, overrideConfig);\n var pluginState = plugin.state.init(document.state, function () {});\n return createElement(plugin.Component, {\n config: config,\n state: pluginState,\n id: id,\n editable: false,\n focused: false,\n autofocusRef: focusRef,\n renderIntoSettings: function renderIntoSettings() {\n return null;\n },\n renderIntoToolbar: function renderIntoToolbar() {\n return null;\n }\n });\n}\n\n/**\r\n * Renders a document inside another document\r\n *\r\n * @param props - The {@link SubDocumentProps}\r\n * @public\r\n */\n\nvar SubDocument = function SubDocument(props) {\n var _React$useContext = useContext(ScopeContext),\n editable = _React$useContext.editable;\n\n var dispatch = useScopedDispatch();\n var undoMemo = useCallback(function () {\n dispatch(undo());\n }, [dispatch]);\n var Component = editable ? SubDocumentEditor : SubDocumentRenderer;\n return createElement(ErrorBoundary, {\n undo: undoMemo\n }, createElement(Component, Object.assign({}, props)));\n};\nvar ErrorBoundary = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(ErrorBoundary, _React$Component);\n\n function ErrorBoundary() {\n var _this;\n\n _this = _React$Component.apply(this, arguments) || this;\n _this.state = {\n hasError: false\n };\n return _this;\n }\n\n ErrorBoundary.getDerivedStateFromError = function getDerivedStateFromError() {\n // Update state so the next render will show the fallback UI.\n return {\n hasError: true\n };\n };\n\n var _proto = ErrorBoundary.prototype;\n\n _proto.componentDidCatch = function componentDidCatch(error, errorInfo) {\n if (typeof this.context === 'function') {\n this.context(error, errorInfo);\n }\n\n console.log(error, errorInfo);\n };\n\n _proto.render = function render() {\n var _this2 = this;\n\n if (this.state.hasError) {\n return createElement(Fragment, null, \"Leider ist ein Fehler aufgetreten.\", createElement(\"button\", {\n onClick: function onClick() {\n _this2.props.undo();\n\n _this2.setState({\n hasError: false\n });\n }\n }, \"letzte \\xC4nderung r\\xFCckg\\xE4nging machen\"));\n }\n\n return this.props.children;\n };\n\n return ErrorBoundary;\n}(Component);\nErrorBoundary.contextType = ErrorContext;\n\nconfigure({\n ignoreEventsCondition: function ignoreEventsCondition() {\n return false;\n }\n});\nvar DefaultDocumentEditor = /*#__PURE__*/createDefaultDocumentEditor();\nvar DefaultPluginToolbar = /*#__PURE__*/createDefaultPluginToolbar();\nvar MAIN_SCOPE = 'main';\nvar mountedProvider = false;\nvar mountedScopes = {}; // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Renders a single editor for an Edtr.io document\r\n *\r\n * @public\r\n */\n\nfunction Editor(_ref) {\n var _ref$createStoreEnhan = _ref.createStoreEnhancer,\n createStoreEnhancer = _ref$createStoreEnhan === void 0 ? function (defaultEnhancer) {\n return defaultEnhancer;\n } : _ref$createStoreEnhan,\n props = _objectWithoutPropertiesLoose(_ref, [\"createStoreEnhancer\"]);\n\n var store = useMemo(function () {\n var _scopes;\n\n return createStore({\n scopes: (_scopes = {}, _scopes[MAIN_SCOPE] = props.plugins, _scopes),\n createEnhancer: createStoreEnhancer\n }).store; // We want to create the store only once\n // TODO: add effects that handle changes to plugins and defaultPlugin (by dispatching an action)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return createElement(Provider, {\n store: store\n }, renderChildren());\n\n function renderChildren() {\n var children = createElement(InnerDocument, Object.assign({}, props, {\n scope: MAIN_SCOPE,\n editable: props.editable === undefined ? true : props.editable\n }));\n if (props.omitDragDropContext) return children;\n return createElement(DndProvider, {\n backend: HTML5Backend\n }, children);\n }\n} // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Hydrates the required contexts\r\n *\r\n * @param createStoreEnhancer - Optional {@link @edtr-io/store#StoreEnhancerFactory | store enhancer factory}\r\n * @param omitDragDropContext - If set to `true`, we omit the hydration of {@link react-dnd#DndProvider}\r\n * @param children - The children\r\n * @beta\r\n */\n\nfunction EditorProvider(_ref2) {\n var _ref2$createStoreEnha = _ref2.createStoreEnhancer,\n createStoreEnhancer = _ref2$createStoreEnha === void 0 ? function (defaultEnhancer) {\n return defaultEnhancer;\n } : _ref2$createStoreEnha,\n omitDragDropContext = _ref2.omitDragDropContext,\n children = _ref2.children;\n useEffect(function () {\n if (mountedProvider) {\n // eslint-disable-next-line no-console\n console.error('You may only render one .');\n }\n\n mountedProvider = true;\n return function () {\n mountedProvider = false;\n };\n }, []);\n var store = useMemo(function () {\n return createStore({\n scopes: {},\n createEnhancer: createStoreEnhancer\n }).store; // We want to create the store only once\n // TODO: add effects that handle changes to plugins and defaultPlugin (by dispatching an action)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n var child = createElement(Provider, {\n store: store\n }, children);\n if (omitDragDropContext) return child;\n return createElement(DndProvider, {\n backend: HTML5Backend\n }, child);\n} // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Renders an editor for an Edtr.io document\r\n *\r\n * @param scope - The scope of the document\r\n * @param mirror - Should be set to `true` for all but one document of the same scope\r\n * @param props - The {@link EditorProps | props} for the document\r\n * @beta\r\n */\n\nfunction Document(_ref3) {\n var _ref3$scope = _ref3.scope,\n scope = _ref3$scope === void 0 ? MAIN_SCOPE : _ref3$scope,\n props = _objectWithoutPropertiesLoose(_ref3, [\"scope\"]);\n\n var storeContext = useContext(EditorContext);\n useEffect(function () {\n var isMainInstance = !props.mirror;\n\n if (isMainInstance) {\n if (mountedScopes[scope]) {\n // eslint-disable-next-line no-console\n console.error(\"There are multiple main instances for scope \" + scope + \". Please set the mirror prop to true to all but one instance.\");\n mountedScopes[scope] = true;\n return function () {\n mountedScopes[scope] = false;\n };\n }\n }\n }, [props.mirror, scope]);\n\n if (!storeContext) {\n // eslint-disable-next-line no-console\n console.error('Could not connect to Redux Store. Please make sure to wrap all instances of Document in an EditorProvider');\n return null;\n }\n\n return createElement(InnerDocument, Object.assign({\n scope: scope\n }, props));\n}\nvar defaultTheme = {};\nvar hotKeysKeyMap$1 = {\n UNDO: ['ctrl+z', 'command+z'],\n REDO: ['ctrl+y', 'command+y', 'ctrl+shift+z', 'command+shift+z']\n};\nfunction InnerDocument(_ref4) {\n var children = _ref4.children,\n plugins = _ref4.plugins,\n scope = _ref4.scope,\n editable = _ref4.editable,\n _ref4$theme = _ref4.theme,\n theme = _ref4$theme === void 0 ? defaultTheme : _ref4$theme,\n onChange = _ref4.onChange,\n onError = _ref4.onError,\n _ref4$DocumentEditor = _ref4.DocumentEditor,\n DocumentEditor = _ref4$DocumentEditor === void 0 ? DefaultDocumentEditor : _ref4$DocumentEditor,\n _ref4$PluginToolbar = _ref4.PluginToolbar,\n PluginToolbar = _ref4$PluginToolbar === void 0 ? DefaultPluginToolbar : _ref4$PluginToolbar,\n props = _objectWithoutPropertiesLoose(_ref4, [\"children\", \"plugins\", \"scope\", \"editable\", \"theme\", \"onChange\", \"onError\", \"DocumentEditor\", \"PluginToolbar\"]);\n\n // Can't use `useScopedSelector` here since `InnerDocument` initializes the scoped state and `ScopeContext`\n var id = useSelector(function (state) {\n var scopedState = state[scope];\n if (!scopedState) return null;\n return getRoot()(scopedState);\n });\n var dispatch = useDispatch(); // Can't use `useScopedStore` here since `InnerDocument` initializes the scoped state and `ScopeContext`\n\n var fullStore = useStore();\n useEffect(function () {\n if (typeof onChange !== 'function') return;\n var pendingChanges = getPendingChanges()(getScope(fullStore.getState(), scope));\n return fullStore.subscribe(function () {\n var currentPendingChanges = getPendingChanges()(getScope(fullStore.getState(), scope));\n\n if (currentPendingChanges !== pendingChanges) {\n onChange({\n changed: hasPendingChanges()(getScope(fullStore.getState(), scope)),\n getDocument: function getDocument() {\n return serializeRootDocument()(getScope(fullStore.getState(), scope));\n }\n });\n pendingChanges = currentPendingChanges;\n }\n });\n }, [onChange, fullStore, scope]);\n useEffect(function () {\n if (!props.mirror) {\n dispatch(initRoot({\n initialState: props.initialState,\n plugins: plugins\n })(scope));\n } // TODO: initRoot changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n\n }, [props.initialState, plugins, props.mirror]);\n var scopeContextValue = useMemo(function () {\n return {\n scope: scope,\n editable: editable\n };\n }, [scope, editable]);\n var hotKeysHandlers = useMemo(function () {\n return {\n UNDO: function UNDO() {\n return dispatch(undo()(scope));\n },\n REDO: function REDO() {\n return dispatch(redo()(scope));\n }\n };\n }, [dispatch, scope]);\n if (!id) return null;\n return createElement(GlobalHotKeys, {\n allowChanges: true,\n keyMap: hotKeysKeyMap$1,\n handlers: hotKeysHandlers\n }, createElement(\"div\", {\n style: {\n position: 'relative'\n }\n }, createElement(ErrorContext.Provider, {\n value: onError\n }, createElement(DocumentEditorContext.Provider, {\n value: DocumentEditor\n }, createElement(PluginToolbarContext.Provider, {\n value: PluginToolbar\n }, createElement(RootThemeProvider, {\n theme: theme\n }, createElement(PreferenceContextProvider, null, createElement(ScopeContext.Provider, {\n value: scopeContextValue\n }, renderChildren(id)))))))));\n\n function renderChildren(id) {\n var document = createElement(SubDocument, {\n id: id\n });\n\n if (typeof children === 'function') {\n return children(document);\n }\n\n return createElement(Fragment, null, document, children);\n }\n}\n\n/**\r\n * Renders the {@link @edtr-io/plugin-toolbar#PluginToolbar | OverlayButton}\r\n *\r\n * @param props - {@link @edtr-io/plugin-toolbar#OverlayButtonProps}\r\n * @public\r\n */\n\nfunction OverlayButton(props) {\n var _React$useContext = useContext(PluginToolbarContext),\n OverlayButton = _React$useContext.OverlayButton;\n\n return createElement(OverlayButton, Object.assign({}, props));\n}\n\n/**\r\n * Renders the {@link @edtr-io/plugin-toolbar#PluginToolbar | OverlayCheckbox}\r\n *\r\n * @param props - {@link @edtr-io/plugin-toolbar#OverlayCheckboxProps}\r\n * @public\r\n */\n\nfunction OverlayCheckbox(props) {\n var _React$useContext = useContext(PluginToolbarContext),\n OverlayCheckbox = _React$useContext.OverlayCheckbox;\n\n return createElement(OverlayCheckbox, Object.assign({}, props));\n}\n\n/**\r\n * Renders the {@link @edtr-io/plugin-toolbar#PluginToolbar | OverlayInput}\r\n *\r\n * @param props - {@link @edtr-io/plugin-toolbar#OverlayInputProps}\r\n * @public\r\n */\n\nfunction OverlayInput(props) {\n var _React$useContext = useContext(PluginToolbarContext),\n OverlayInput = _React$useContext.OverlayInput;\n\n return createElement(OverlayInput, Object.assign({}, props, {\n ref: undefined\n }));\n}\n\n/**\r\n * Renders the {@link @edtr-io/plugin-toolbar#PluginToolbar | OverlaySelect}\r\n *\r\n * @param props - {@link @edtr-io/plugin-toolbar#OverlaySelectProps}\r\n * @public\r\n */\n\nfunction OverlaySelect(props) {\n var _React$useContext = useContext(PluginToolbarContext),\n OverlaySelect = _React$useContext.OverlaySelect;\n\n return createElement(OverlaySelect, Object.assign({}, props));\n}\n\n/**\r\n * Renders the {@link @edtr-io/plugin-toolbar#PluginToolbar | OverlayTextarea}\r\n *\r\n * @param props - {@link @edtr-io/plugin-toolbar#OverlayTextareaProps}\r\n * @public\r\n */\n\nfunction OverlayTextarea(props) {\n var _React$useContext = useContext(PluginToolbarContext),\n OverlayTextarea = _React$useContext.OverlayTextarea;\n\n return createElement(OverlayTextarea, Object.assign({}, props));\n}\n\n/**\r\n * Renders the {@link @edtr-io/plugin-toolbar#PluginToolbar | PluginToolbarButton}\r\n *\r\n * @public\r\n */\n\nvar PluginToolbarButton = /*#__PURE__*/forwardRef(function PluginToolbarButton(props, ref) {\n var _React$useContext = useContext(PluginToolbarContext),\n PluginToolbarButton = _React$useContext.PluginToolbarButton;\n\n return createElement(PluginToolbarButton, Object.assign({}, props, {\n ref: ref\n }));\n});\n\n/**\r\n * Renders the {@link @edtr-io/plugin-toolbar#PluginToolbar | PluginToolbarOverlayButton}\r\n *\r\n * @param props - {@link @edtr-io/plugin-toolbar#PluginToolbarOverlayButtonProps}\r\n * @public\r\n */\n\nfunction PluginToolbarOverlayButton(props) {\n var _React$useContext = useContext(PluginToolbarContext),\n PluginToolbarOverlayButton = _React$useContext.PluginToolbarOverlayButton;\n\n return createElement(PluginToolbarOverlayButton, Object.assign({}, props));\n}\n\nexport { Document, DocumentEditorContext, Editor, EditorProvider, ErrorContext, OverlayButton, OverlayCheckbox, OverlayInput, OverlaySelect, OverlayTextarea, PluginToolbarButton, PluginToolbarContext, PluginToolbarOverlayButton, PreferenceContext, Provider, ScopeContext, SubDocument, setDefaultPreference, useDispatch, useScope, useScopedDispatch, useScopedSelector, useScopedStore, useSelector, useStore };\n\n","export const createTheme = (theme) => ({\n\teditor: {\n\t\tprimary: {\n\t\t\tbackground: theme.colors.primary,\n\t\t},\n\t},\n\tplugins: {\n\t\trows: {\n\t\t\tmenu: {\n\t\t\t\thighlightColor: theme.colors.primary,\n\t\t\t\tdropzone: {\n\t\t\t\t\thighlightColor: theme.colors.primary,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\ttext: {\n\t\t\thoverColor: \"#B6B6B6\",\n\t\t},\n\t},\n});","import StyledComponents__default, { ThemeContext as ThemeContext$1, ThemeProvider as ThemeProvider$1 } from 'styled-components';\nimport { mergeDeepRight, pick } from 'ramda';\nimport { useContext, createElement, useMemo } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nexport { faFileDownload } from '@fortawesome/free-solid-svg-icons/faFileDownload';\nexport { faFileArchive } from '@fortawesome/free-solid-svg-icons/faFileArchive';\nexport { faFileAudio } from '@fortawesome/free-solid-svg-icons/faFileAudio';\nexport { faCheckCircle } from '@fortawesome/free-solid-svg-icons/faCheckCircle';\nexport { faFileExcel } from '@fortawesome/free-solid-svg-icons/faFileExcel';\nexport { faFileImage } from '@fortawesome/free-solid-svg-icons/faFileImage';\nexport { faFilePdf } from '@fortawesome/free-solid-svg-icons/faFilePdf';\nexport { faSmile } from '@fortawesome/free-solid-svg-icons/faSmile';\nexport { faFileWord } from '@fortawesome/free-solid-svg-icons/faFileWord';\nexport { faFileVideo } from '@fortawesome/free-solid-svg-icons/faFileVideo';\nexport { faFilePowerpoint } from '@fortawesome/free-solid-svg-icons/faFilePowerpoint';\nexport { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';\nexport { faCut } from '@fortawesome/free-solid-svg-icons/faCut';\nexport { faCog } from '@fortawesome/free-solid-svg-icons/faCog';\nexport { faCopy } from '@fortawesome/free-solid-svg-icons/faCopy';\nexport { faFileAlt } from '@fortawesome/free-solid-svg-icons/faFileAlt';\nexport { faImages } from '@fortawesome/free-solid-svg-icons/faImages';\nexport { faPhotoVideo } from '@fortawesome/free-solid-svg-icons/faPhotoVideo';\nexport { faLink } from '@fortawesome/free-solid-svg-icons/faLink';\nexport { faMinus } from '@fortawesome/free-solid-svg-icons/faMinus';\nexport { faPaste } from '@fortawesome/free-solid-svg-icons/faPaste';\nexport { faPencilAlt } from '@fortawesome/free-solid-svg-icons/faPencilAlt';\nexport { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';\nexport { faSpinner } from '@fortawesome/free-solid-svg-icons/faSpinner';\nexport { faTable } from '@fortawesome/free-solid-svg-icons/faTable';\nexport { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';\nexport { faTrashAlt } from '@fortawesome/free-solid-svg-icons/faTrashAlt';\nexport { faFilm } from '@fortawesome/free-solid-svg-icons/faFilm';\nexport { faCaretSquareUp } from '@fortawesome/free-solid-svg-icons/faCaretSquareUp';\nexport { faCaretSquareDown } from '@fortawesome/free-solid-svg-icons/faCaretSquareDown';\nexport { faSortUp } from '@fortawesome/free-solid-svg-icons/faSortUp';\nexport { faSortDown } from '@fortawesome/free-solid-svg-icons/faSortDown';\nexport { faToolbox } from '@fortawesome/free-solid-svg-icons/faToolbox';\nexport { faEllipsisH } from '@fortawesome/free-solid-svg-icons/faEllipsisH';\nexport { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';\nexport { faCloudUploadAlt } from '@fortawesome/free-solid-svg-icons/faCloudUploadAlt';\nexport { faQuestionCircle } from '@fortawesome/free-solid-svg-icons/faQuestionCircle';\nexport { faAnchor } from '@fortawesome/free-solid-svg-icons/faAnchor';\nexport { faQuoteRight } from '@fortawesome/free-solid-svg-icons/faQuoteRight';\nexport { faEquals } from '@fortawesome/free-solid-svg-icons/faEquals';\nexport { faCubes } from '@fortawesome/free-solid-svg-icons/faCubes';\nexport { faCode } from '@fortawesome/free-solid-svg-icons/faCode';\nexport { faLightbulb } from '@fortawesome/free-solid-svg-icons/faLightbulb';\nexport { faKeyboard } from '@fortawesome/free-solid-svg-icons/faKeyboard';\nexport { faDotCircle } from '@fortawesome/free-solid-svg-icons/faDotCircle';\nexport { faCheckSquare } from '@fortawesome/free-solid-svg-icons/faCheckSquare';\nexport { faParagraph } from '@fortawesome/free-solid-svg-icons/faParagraph';\nexport { faRedoAlt } from '@fortawesome/free-solid-svg-icons/faRedoAlt';\nexport { faRandom } from '@fortawesome/free-solid-svg-icons/faRandom';\nexport { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons/faExternalLinkAlt';\nexport { faNewspaper } from '@fortawesome/free-solid-svg-icons/faNewspaper';\n\n/** @public */\n\nvar defaultEditorTheme = {\n primary: {\n color: '#ffffff',\n background: 'rgb(70, 155, 255)'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n },\n color: '#EEEEEE',\n backgroundColor: 'rgba(51,51,51,0.95)'\n};\n/**\r\n * React Hook for the editor theming\r\n *\r\n * @returns An object containing the current {@link EditorTheme | editor theme} and {@link EditorUiTheme | editor UI theme}\r\n * @public\r\n */\n\nfunction useEditorTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link EditorThemeProps} to the current theme of the specified editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link EditorThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createEditorUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.editor), theme.editorUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of an editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useEditorUiTheme(key, createDefaultTheme) {\n var theme = useEditorTheme();\n return createEditorUiTheme(key, createDefaultTheme)(theme);\n}\n\n/**\r\n * Font Awesome Icon component\r\n *\r\n * @param props - Most of {@link https://github.com/FortAwesome/react-fontawesome | FontAwesomeIconProps}\r\n * @public\r\n */\n\nfunction Icon(props) {\n var allowedProps = pick(['icon', 'mask', 'className', 'color', 'spin', 'pulse', 'border', 'fixedWidth', 'inverse', 'listItem', 'flip', 'size', 'pull', 'rotation', 'transform', 'symbol', 'style', 'tabIndex', 'title'], props);\n return createElement(FontAwesomeIcon, Object.assign({}, allowedProps));\n}\n/**\r\n * Creates an icon component\r\n *\r\n * @param i - The icon to use\r\n * @returns A component for the specified icon\r\n * @public\r\n */\n\nfunction createIcon(i) {\n return function I() {\n return createElement(Icon, {\n icon: i,\n size: \"4x\"\n });\n };\n}\nvar EdtrSVG =\n/*#__PURE__*/\nStyledComponents__default.svg({\n display: 'inline-block',\n verticalAlign: 'middle',\n overflow: 'hidden'\n});\n/**\r\n * Edtr.io icon component\r\n *\r\n * @param props - An Edtr.io icon definition and an optional className\r\n * @returns The icon\r\n * @public\r\n */\n\nfunction EdtrIcon(props) {\n return createElement(EdtrSVG, {\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n className: props.className\n }, createElement(\"path\", {\n fill: \"currentcolor\",\n d: props.icon\n }));\n}\n/** @public */\n\nvar edtrAlignBlock = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignCenter = 'M7 16c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zm-3 5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm3-5c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignRight = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zm-6-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignLeft = 'M14 15H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zm0-8H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zM4 13h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0 8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrClose = 'M18.3,5.71 C17.91,5.32 17.28,5.32 16.89,5.71 L12,10.59 L7.11,5.7 C6.72,5.31 6.09,5.31 5.7,5.7 C5.31,6.09 5.31,6.72 5.7,7.11 L10.59,12 L5.7,16.89 C5.31,17.28 5.31,17.91 5.7,18.3 C6.09,18.69 6.72,18.69 7.11,18.3 L12,13.41 L16.89,18.3 C17.28,18.69 17.91,18.69 18.3,18.3 C18.69,17.91 18.69,17.28 18.3,16.89 L13.41,12 L18.3,7.11 C18.68,6.73 18.68,6.09 18.3,5.71 Z';\n/** @public */\n\nvar edtrFormula = 'M9.796061,6.84358189 L9.546061,9.73358189 L11.366061,9.73358189 C11.9183457,9.73358189 12.366061,10.1812971 12.366061,10.7335819 L12.366061,10.7335819 C12.366061,11.2858666 11.9183457,11.7335819 11.366061,11.7335819 L9.366061,11.7335819 L8.926061,16.8035819 C8.726061,19.0035819 6.786061,20.6335819 4.586061,20.4335819 C3.95133688,20.3777262 3.21218763,20.0027937 2.36861326,19.3087844 L2.3686112,19.3087869 C1.93754177,18.9541458 1.8755844,18.3172015 2.23022554,17.8861321 C2.25098506,17.8608987 2.27295601,17.8366869 2.296061,17.8135819 L2.296061,17.8135819 C2.68943711,17.4202058 3.31879167,17.3943638 3.74309403,17.7541652 C4.42335978,18.3310001 5.0243456,18.5341427 5.546061,18.3635819 C6.326061,18.1235819 6.876061,17.4335819 6.946061,16.6235819 L7.366061,11.7335819 L5.366061,11.7335819 C4.81377625,11.7335819 4.366061,11.2858666 4.366061,10.7335819 L4.366061,10.7335819 C4.366061,10.1812971 4.81377625,9.73358189 5.366061,9.73358189 L7.546061,9.73358189 L7.816061,6.66358189 C8.006061,4.46358189 9.936061,2.83358189 12.146061,3.01358189 C12.7876823,3.06959645 13.5343235,3.45039469 14.3859845,4.15597662 L14.3859731,4.15599041 C14.8171452,4.51320676 14.8770982,5.1523219 14.5198819,5.58349402 C14.4997127,5.60783893 14.4784158,5.63122712 14.456061,5.65358189 L14.456061,5.65358189 C14.077745,6.03189793 13.4644763,6.03223098 13.0857495,5.65432608 C12.6951429,5.26458609 12.3219165,5.05433484 11.966061,5.02358189 C10.866061,4.92358189 9.896061,5.73358189 9.796061,6.84358189 Z M20.841061,12.6785819 L20.841061,12.6785819 C20.4517003,12.2892211 19.8204217,12.2892211 19.431061,12.6785819 L17.306061,14.8035819 L15.1860786,12.6835995 C14.7931405,12.2906614 14.1567565,12.2884206 13.761061,12.6785819 L13.761061,12.6785819 C13.3689485,13.0652103 13.3645027,13.6965046 13.7511312,14.0886171 C13.7527745,14.0902837 13.7544236,14.0919445 13.7560786,14.0935995 L15.896061,16.2335819 L13.7610785,18.3385997 C13.3717179,18.7224956 13.3672879,19.3493438 13.7511838,19.7387045 C13.7544529,19.7420201 13.7577454,19.7453127 13.761061,19.7485819 L13.761061,19.7485819 C14.1567565,20.1387432 14.7931405,20.1365024 15.1860786,19.7435643 L17.306061,17.6235819 L19.431061,19.7485819 C19.8204217,20.1379426 20.4517003,20.1379426 20.841061,19.7485819 L20.841061,19.7485819 C21.2290435,19.3605994 21.2290435,18.7315555 20.841061,18.343573 C20.8402306,18.3427426 20.8393988,18.3419137 20.8385654,18.3410863 L18.716061,16.2335819 L20.8435477,14.0910599 C21.2319346,13.6999283 21.2308227,13.0683435 20.841061,12.6785819 Z';\n/** @public */\n\nvar edtrText = 'M2.5 5.5C2.5 6.33 3.17 7 4 7h3.5v10.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V7H14c.83 0 1.5-.67 1.5-1.5S14.83 4 14 4H4c-.83 0-1.5.67-1.5 1.5zM20 9h-6c-.83 0-1.5.67-1.5 1.5S13.17 12 14 12h1.5v5.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V12H20c.83 0 1.5-.67 1.5-1.5S20.83 9 20 9z';\n/** @public */\n\nvar edtrLink = 'M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1zm2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1z';\n/** @public */\n\nvar edtrQuote = 'M7.17 17c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94zm10 0c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94z';\n/** @public */\n\nvar edtrListNumbered = 'M8 7h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm12 10H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zm0-6H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zM4.5 16h-2c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5h-.5c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h2c.28 0 .5-.22.5-.5v-3c0-.28-.22-.5-.5-.5zm-2-11H3v2.5c0 .28.22.5.5.5s.5-.22.5-.5v-3c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5s.22.5.5.5zm2 5h-2c-.28 0-.5.22-.5.5s.22.5.5.5h1.3l-1.68 1.96c-.08.09-.12.21-.12.32v.22c0 .28.22.5.5.5h2c.28 0 .5-.22.5-.5s-.22-.5-.5-.5H3.2l1.68-1.96c.08-.09.12-.21.12-.32v-.22c0-.28-.22-.5-.5-.5z';\n/** @public */\n\nvar edtrListBullets = 'M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM8 19h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm0-6h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zM7 6c0 .55.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrItalic = 'M10 5.5c0 .83.67 1.5 1.5 1.5h.71l-3.42 8H7.5c-.83 0-1.5.67-1.5 1.5S6.67 18 7.5 18h5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5h-.71l3.42-8h1.29c.83 0 1.5-.67 1.5-1.5S17.33 4 16.5 4h-5c-.83 0-1.5.67-1.5 1.5z';\n/** @public */\n\nvar edtrColorText = 'M10.63 3.93L6.06 15.58c-.27.68.23 1.42.97 1.42.43 0 .82-.27.98-.68L8.87 14h6.25l.87 2.32c.15.41.54.68.98.68.73 0 1.24-.74.97-1.42L13.37 3.93C13.14 3.37 12.6 3 12 3c-.6 0-1.15.37-1.37.93zM9.62 12L12 5.67 14.38 12H9.62z';\n/** @public */\n\nvar edtrFill = 'M16.56 8.94L8.32.7C7.93.31 7.3.31 6.91.7c-.39.39-.39 1.02 0 1.41l1.68 1.68-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z';\n/** @public */\n\nvar edtrBold = 'M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H8c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h5.78c2.07 0 3.96-1.69 3.97-3.77.01-1.53-.85-2.84-2.15-3.44zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z';\n/** @public */\n\nvar edtrPlus = 'M12,2 C6.48,2 2,6.48 2,12 C2,17.52 6.48,22 12,22 C17.52,22 22,17.52 22,12 C22,6.48 17.52,2 12,2 Z M16,13 L13,13 L13,16 C13,16.55 12.55,17 12,17 C11.45,17 11,16.55 11,16 L11,13 L8,13 C7.45,13 7,12.55 7,12 C7,11.45 7.45,11 8,11 L11,11 L11,8 C11,7.45 11.45,7 12,7 C12.55,7 13,7.45 13,8 L13,11 L16,11 C16.55,11 17,11.45 17,12 C17,12.55 16.55,13 16,13 Z';\n/** @public */\n\nvar edtrSearch = 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z';\n/** @public */\n\nvar edtrDefaultPlugin = 'M20.6190476,11.5238095 L19.1904762,11.5238095 L19.1904762,7.71428571 C19.1904762,6.65714286 18.3333333,5.80952381 17.2857143,5.80952381 L13.4761905,5.80952381 L13.4761905,4.38095238 C13.4761905,3.06598869 12.4102018,2 11.0952381,2 C9.78027441,2 8.71428571,3.06598869 8.71428571,4.38095238 L8.71428571,5.80952381 L4.9047619,5.80952381 C3.85279095,5.80952381 3,6.66231476 3,7.71428571 L3,11.3333333 L4.42857143,11.3333333 C5.85714286,11.3333333 7,12.4761905 7,13.9047619 C7,15.3333333 5.85714286,16.4761905 4.42857143,16.4761905 L3,16.4761905 L3,20.0952381 C3,21.147209 3.85279095,22 4.9047619,22 L8.52380952,22 L8.52380952,20.5714286 C8.52380952,19.1428571 9.66666667,18 11.0952381,18 C12.5238095,18 13.6666667,19.1428571 13.6666667,20.5714286 L13.6666667,22 L17.2857143,22 C18.3376852,22 19.1904762,21.147209 19.1904762,20.0952381 L19.1904762,16.2857143 L20.6190476,16.2857143 C21.9340113,16.2857143 23,15.2197256 23,13.9047619 C23,12.5897982 21.9340113,11.5238095 20.6190476,11.5238095 Z';\n/** @public */\n\nvar edtrDragHandle = 'M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z';\n\n/** @public */\n\nvar defaultRendererTheme = {\n backgroundColor: '#ffffff',\n color: '#333333',\n primary: {\n color: '#ffffff',\n background: '#337ab7'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n }\n};\n/**\r\n * React Hook for the renderer theming\r\n *\r\n * @returns An object containing the current {@link RendererTheme | renderer theme} and {@link RendererUiTheme | renderer UI theme}\r\n * @public\r\n */\n\nfunction useRendererTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link RendererThemeProps} to the current theme of the specified renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link RendererThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createRendererUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.renderer), theme.rendererUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of a renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useRendererUiTheme(key, createDefaultTheme) {\n var theme = useRendererTheme();\n return createRendererUiTheme(key, createDefaultTheme)(theme);\n}\n\nvar defaultTheme = {\n editor: defaultEditorTheme,\n editorUi: {},\n renderer: defaultRendererTheme,\n rendererUi: {}\n}; // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to hydrate the context for the {@link Theme | Theme}\r\n *\r\n * @remarks\r\n * You probably don't want to use this component directly since it is already used by the core.\r\n * If you want to override the theme in some plugin, you probably want to use {@link ThemeProvider | ThemeProvider} instead.\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | default Theme}, and children\r\n * @public\r\n */\n\nfunction RootThemeProvider(props) {\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n/**\r\n * Context used for the {@link Theme | Theme}, see also {@link https://styled-components.com/docs/advanced#theming | Theming }\r\n *\r\n * @public\r\n */\n\nvar ThemeContext = ThemeContext$1;\n/**\r\n * React Hook to get the current {@link Theme | Theme}\r\n *\r\n * @returns The current {@link Theme | Theme}\r\n * @public\r\n */\n\nfunction useTheme() {\n return useContext(ThemeContext);\n} // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to override the current {@link Theme | theme}\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | current Theme}, and children\r\n * @public\r\n */\n\nfunction ThemeProvider(props) {\n var defaultTheme = useTheme();\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [defaultTheme, props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n\n/**\r\n * Provides utils for the User Interface\r\n *\r\n * @packageDocumentation\r\n */\n/**\r\n * Re-export of {@link https://styled-components.com/docs/api#primary | `styled` in `styled-components` }\r\n *\r\n * @public\r\n */\n\nvar styled = StyledComponents__default;\n\nexport { EdtrIcon, Icon, RootThemeProvider, ThemeContext, ThemeProvider, createEditorUiTheme, createIcon, createRendererUiTheme, defaultEditorTheme, defaultRendererTheme, edtrAlignBlock, edtrAlignCenter, edtrAlignLeft, edtrAlignRight, edtrBold, edtrClose, edtrColorText, edtrDefaultPlugin, edtrDragHandle, edtrFill, edtrFormula, edtrItalic, edtrLink, edtrListBullets, edtrListNumbered, edtrPlus, edtrQuote, edtrSearch, edtrText, styled, useEditorTheme, useEditorUiTheme, useRendererTheme, useRendererUiTheme, useTheme };\n\n","import { SubDocument } from '@edtr-io/core';\nimport { mergeDeepRight, findIndex, propEq, update, map, insert, remove, move, times, flatten, mapObjIndexed, set, lensProp, values } from 'ramda';\nimport { createElement, useState, useEffect } from 'react';\nimport { generate } from 'shortid';\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\n/** @public */\n\nfunction child(_ref) {\n var plugin = _ref.plugin,\n initialState = _ref.initialState,\n config = _ref.config;\n return {\n init: function init(id, onChange) {\n return {\n get: function get() {\n return id;\n },\n id: id,\n render: function Child(props) {\n if (props === void 0) {\n props = {};\n }\n\n var pluginProps = _extends({}, props, {\n config: mergeDeepRight(config || {}, props.config || {})\n });\n\n return createElement(SubDocument, {\n key: id,\n pluginProps: pluginProps,\n id: id\n });\n },\n replace: function replace(plugin, state) {\n onChange(function (_id, helpers) {\n helpers.createDocument({\n id: id,\n plugin: plugin,\n state: state\n });\n return id;\n });\n }\n };\n },\n createInitialState: function createInitialState(_ref2) {\n var createDocument = _ref2.createDocument;\n var id = generate();\n createDocument({\n id: id,\n plugin: plugin,\n state: initialState\n });\n return id;\n },\n deserialize: function deserialize(serialized, _ref3) {\n var createDocument = _ref3.createDocument;\n var id = generate();\n createDocument(_extends({\n id: id\n }, serialized));\n return id;\n },\n serialize: function serialize(id, _ref4) {\n var getDocument = _ref4.getDocument;\n var document = getDocument(id);\n\n if (document === null) {\n throw new Error('There exists no document with the given id');\n }\n\n return document;\n },\n getFocusableChildren: function getFocusableChildren(id) {\n return [{\n id: id\n }];\n }\n };\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\r\n * @param type - The {@link @edtr-io/internal__plugin-state#StateType | state type} of the list items\r\n * @param initialCount - The initial number of list items\r\n * @public\r\n */\n\nfunction list(type, initialCount) {\n if (initialCount === void 0) {\n initialCount = 0;\n }\n\n return {\n init: function init(rawItems, onChange) {\n var items = rawItems.map(function (item) {\n return type.init(item.value, createOnChange(item.id));\n });\n return Object.assign(items, {\n set: function set(updater) {\n onChange(function (wrappedItems, helpers) {\n var unwrapped = map(function (wrapped) {\n return wrapped.value;\n }, wrappedItems);\n return map(wrap, updater(unwrapped, function (options) {\n return type.deserialize(options, helpers);\n }));\n });\n },\n insert: function insert$1(index, options) {\n onChange(function (items, helpers) {\n var wrappedSubState = wrap(options ? type.deserialize(options, helpers) : type.createInitialState(helpers));\n return insert(index === undefined ? items.length : index, wrappedSubState, items);\n });\n },\n remove: function remove$1(index) {\n onChange(function (items) {\n return remove(index, 1, items);\n });\n },\n move: function move$1(from, to) {\n onChange(function (items) {\n return move(from, to, items);\n });\n }\n });\n\n function createOnChange(id) {\n return function (initial, executor) {\n function wrapUpdater(initial) {\n return function (oldItems, helpers) {\n var index = findIndex(propEq('id', id), oldItems);\n var result = update(index, {\n value: initial(oldItems[index].value, helpers),\n id: id\n }, oldItems);\n return result;\n };\n }\n\n onChange(wrapUpdater(initial), executor ? function (resolve, reject, next) {\n executor(function (innerUpdater) {\n return resolve(wrapUpdater(innerUpdater));\n }, function (innerUpdater) {\n return reject(wrapUpdater(innerUpdater));\n }, function (innerUpdater) {\n return next(wrapUpdater(innerUpdater));\n });\n } : undefined);\n };\n }\n },\n createInitialState: function createInitialState(helpers) {\n return times(function () {\n return wrap(type.createInitialState(helpers));\n }, initialCount);\n },\n deserialize: function deserialize(serialized, helpers) {\n return map(function (s) {\n return wrap(type.deserialize(s, helpers));\n }, serialized);\n },\n serialize: function serialize(deserialized, helpers) {\n return map(function (_ref) {\n var value = _ref.value;\n return type.serialize(value, helpers);\n }, deserialized);\n },\n getFocusableChildren: function getFocusableChildren(items) {\n return flatten(map(function (item) {\n return type.getFocusableChildren(item.value);\n }, items));\n }\n };\n\n function wrap(value) {\n return {\n id: generate(),\n value: value\n };\n }\n}\n\n/**\r\n * @param initialValue - The initial value\r\n * @public\r\n */\nfunction _boolean(initialValue) {\n return scalar(initialValue || false);\n}\nfunction number(initialValue) {\n return scalar(initialValue || 0);\n}\n/**\r\n * @param initialValue - The initial value\r\n * @public\r\n */\n\nfunction string(initialValue) {\n return scalar(initialValue || '');\n}\n/**\r\n * @param initialState - The initial value\r\n * @public\r\n */\n\nfunction scalar(initialState) {\n return serializedScalar(initialState, {\n deserialize: function deserialize(state) {\n return state;\n },\n serialize: function serialize(state) {\n return state;\n }\n });\n}\n/**\r\n * @param initialState - The initial state\r\n * @param serializer - The {@link Serializer | serializer}\r\n * @public\r\n */\n\nfunction serializedScalar(initialState, serializer) {\n return _extends({\n init: function init(state, onChange) {\n var SerializedScalarType = /*#__PURE__*/function () {\n function SerializedScalarType() {}\n\n var _proto = SerializedScalarType.prototype;\n\n _proto.get = function get() {\n return state;\n };\n\n _proto.set = function set(param) {\n onChange(function (previousValue) {\n if (typeof param === 'function') {\n var updater = param;\n return updater(previousValue);\n }\n\n return param;\n });\n };\n\n _createClass(SerializedScalarType, [{\n key: \"value\",\n get: function get() {\n return state;\n },\n set: function set(param) {\n this.set(param);\n }\n }]);\n\n return SerializedScalarType;\n }();\n\n return new SerializedScalarType();\n },\n createInitialState: function createInitialState() {\n return initialState;\n },\n getFocusableChildren: function getFocusableChildren() {\n return [];\n }\n }, serializer);\n}\n/**\r\n * @param initial - The initialValue\r\n * @param isTemporaryValue - Checks whether the given value is temporary\r\n * @public\r\n */\n\nfunction asyncScalar(initial, isTemporaryValue) {\n // warp boolean to typeguard\n function isTemporary(field) {\n return isTemporaryValue(field);\n }\n\n return {\n init: function init(state, onChange) {\n return {\n value: state,\n get: function get() {\n return state;\n },\n set: function set(initial, executor) {\n onChange(function (previousState) {\n if (typeof initial === 'function') {\n var f = initial;\n return f(previousState);\n }\n\n return initial;\n }, executor ? function (resolve, reject, next) {\n if (!executor) return;\n executor(wrapResolverParam(resolve), wrapResolverParam(reject), wrapResolverParam(next));\n } : undefined);\n }\n };\n\n function wrapResolverParam(callback) {\n return function (update) {\n if (typeof update === 'function') {\n var f = update;\n return callback(f);\n }\n\n return callback(function () {\n return update;\n });\n };\n }\n },\n createInitialState: function createInitialState() {\n return initial;\n },\n getFocusableChildren: function getFocusableChildren() {\n return [];\n },\n deserialize: function deserialize(serialized) {\n return serialized;\n },\n serialize: function serialize(deserialized) {\n if (isTemporary(deserialized)) {\n return initial;\n }\n\n return deserialized;\n }\n };\n}\n\n/**\r\n * @param type - The initial {@link @edtr-io/internal__plugin-state#StateType | state type} to start the migration from\r\n * @public\r\n */\nfunction migratable(type) {\n return _migrate(function (state) {\n return state;\n }, type, 0, function (state) {\n return state;\n });\n}\n\nfunction _migrate(recursiveMigrate, nextType, nextVersion, f) {\n return _extends({}, nextType, {\n deserialize: function deserialize(serialized, helpers) {\n if (isVersionized(serialized, nextVersion)) {\n return nextType.deserialize(serialized.value, helpers);\n }\n\n var s = serialized;\n return nextType.deserialize(f(recursiveMigrate(s)), helpers);\n },\n serialize: function serialize(deserialized, helpers) {\n return {\n __version__: nextVersion,\n value: nextType.serialize(deserialized, helpers)\n };\n },\n migrate: function migrate(nextNextType, f2) {\n return _migrate(function (previousState) {\n if (isVersionized(previousState, nextVersion)) {\n return previousState.value;\n }\n\n return f(recursiveMigrate(previousState));\n }, nextNextType, nextVersion + 1, f2);\n }\n });\n}\n\nfunction isVersionized(state, version) {\n return state.__version__ === version;\n}\n\n/**\r\n * @param types - The {@link @edtr-io/internal__plugin-state#StateType | state types} of the properties of the object\r\n * @param getFocusableChildren - Allows to override the default order of focusable children\r\n * @public\r\n */\n\nfunction object(types, _getFocusableChildren) {\n if (_getFocusableChildren === void 0) {\n _getFocusableChildren = function getFocusableChildren(children) {\n return flatten(values(children));\n };\n }\n\n return {\n init: function init(state, onChange) {\n return mapObjIndexed(function (type, key) {\n return type.init(state[key], innerOnChange);\n\n function innerOnChange(initial, executor) {\n function wrapUpdater(initial) {\n return function (oldObj, helpers) {\n return set(lensProp(key), initial(oldObj[key], helpers), oldObj);\n };\n }\n\n onChange(wrapUpdater(initial), executor ? function (resolve, reject, next) {\n executor(function (innerUpdater) {\n return resolve(wrapUpdater(innerUpdater));\n }, function (innerUpdater) {\n return reject(wrapUpdater(innerUpdater));\n }, function (innerUpdater) {\n return next(wrapUpdater(innerUpdater));\n });\n } : undefined);\n }\n }, types);\n },\n createInitialState: function createInitialState(helpers) {\n return map(function (type) {\n return type.createInitialState(helpers);\n }, types);\n },\n deserialize: function deserialize(serialized, helpers) {\n return mapObjIndexed(function (type, key) {\n return type.deserialize(serialized[key], helpers);\n }, types);\n },\n serialize: function serialize(deserialized, helpers) {\n return mapObjIndexed(function (type, key) {\n return type.serialize(deserialized[key], helpers);\n }, types);\n },\n getFocusableChildren: function getFocusableChildren(state) {\n var children = mapObjIndexed(function (type, key) {\n return type.getFocusableChildren(state[key]);\n }, types);\n return _getFocusableChildren(children);\n }\n };\n}\n\n/**\r\n * @param type - The {@link @edtr-io/internal__plugin-state#StateType | state type} for defined values\r\n * @param initiallyDefined - Whether the value should be defined initially\r\n * @public\r\n */\nfunction optional(type, initiallyDefined) {\n if (initiallyDefined === void 0) {\n initiallyDefined = false;\n }\n\n return {\n init: function init(state, onChange) {\n if (state.defined) {\n var value = type.init(state.value, innerOnChange);\n return Object.assign(value, {\n defined: true,\n remove: function remove() {\n onChange(function () {\n return {\n defined: false,\n value: null\n };\n });\n }\n });\n }\n\n return {\n defined: false,\n create: function create(value) {\n onChange(function (_previousState, helpers) {\n return {\n defined: true,\n value: value === undefined ? type.createInitialState(helpers) : type.deserialize(value, helpers)\n };\n });\n }\n };\n\n function innerOnChange(initial, executor) {\n return onChange(wrapStateUpdater(initial), typeof executor === 'function' ? function (resolve, reject, next) {\n executor(function (value) {\n resolve(wrapStateUpdater(value));\n }, function (value) {\n reject(wrapStateUpdater(value));\n }, function (value) {\n next(wrapStateUpdater(value));\n });\n } : undefined);\n }\n\n function wrapStateUpdater(f) {\n return function (previousState, helpers) {\n if (previousState.defined) {\n return {\n defined: true,\n value: f(previousState.value, helpers)\n };\n } else {\n return {\n defined: true,\n value: f(type.createInitialState(helpers), helpers)\n };\n }\n };\n }\n },\n createInitialState: function createInitialState(helpers) {\n if (initiallyDefined) {\n return {\n defined: true,\n value: type.createInitialState(helpers)\n };\n }\n\n return {\n defined: false,\n value: null\n };\n },\n deserialize: function deserialize(serialized, helpers) {\n if (serialized === undefined) {\n return {\n defined: false,\n value: null\n };\n }\n\n return {\n defined: true,\n value: type.deserialize(serialized, helpers)\n };\n },\n serialize: function serialize(deserialized, helpers) {\n if (deserialized.defined) {\n return type.serialize(deserialized.value, helpers);\n }\n\n return undefined;\n },\n getFocusableChildren: function getFocusableChildren(state) {\n if (state.defined) return type.getFocusableChildren(state.value);\n return [];\n }\n };\n}\n\n/**\r\n * @param defaultState - The default state\r\n * @public\r\n */\n\nfunction upload(defaultState) {\n var state = asyncScalar(defaultState, isTempFile);\n return _extends({}, state, {\n init: function init() {\n var s = state.init.apply(state, arguments);\n return _extends({}, s, {\n set: function set(value) {\n s.set(value);\n },\n isPending: isTempFile(s.value) && !!s.value.pending,\n upload: function upload(file, handler) {\n var uploaded = handler(file);\n s.set(defaultState, function (resolve, reject, next) {\n var read = readFile(file);\n var uploadFinished = false;\n read.then(function (loaded) {\n if (!uploadFinished) {\n next(function () {\n return {\n uploadHandled: true,\n loaded: loaded\n };\n });\n }\n });\n uploaded.then(function (uploaded) {\n uploadFinished = true;\n return uploaded;\n }).then(function (uploaded) {\n resolve(function () {\n return uploaded;\n });\n })[\"catch\"](function () {\n reject(function () {\n return {\n uploadHandled: true,\n failed: file\n };\n });\n });\n });\n return uploaded;\n }\n });\n }\n });\n}\n\nfunction readFile(file) {\n return new Promise(function (resolve) {\n var reader = new FileReader();\n\n reader.onload = function (e) {\n if (!e.target) return;\n var result = e.target.result;\n resolve({\n file: file,\n dataUrl: result\n });\n };\n\n reader.readAsDataURL(file);\n });\n}\n/**\r\n * @param file - The {@link UploadStateReturnType | upload state type}\r\n * @param uploadHandler - The {@link UploadHandler | upload handler}\r\n * @public\r\n */\n\n\nfunction usePendingFileUploader(file, uploadHandler) {\n usePendingFilesUploader([file], uploadHandler);\n}\n/**\r\n * @param files - The {@link UploadStateReturnType | upload state type}\r\n * @param uploadHandler - The {@link UploadHandler | upload handler}\r\n * @public\r\n */\n\nfunction usePendingFilesUploader(files, uploadHandler) {\n var _React$useState = useState(0),\n uploading = _React$useState[0],\n setUploading = _React$useState[1];\n\n useEffect(function () {\n // everything uploaded already\n if (uploading >= files.length) return;\n var fileState = files[uploading];\n\n if (isTempFile(fileState.value) && fileState.value.pending && !fileState.value.uploadHandled) {\n fileState.value.uploadHandled = true;\n fileState.upload(fileState.value.pending, uploadHandler)[\"catch\"](onDone).then(onDone);\n }\n\n function onDone() {\n setUploading(function (currentUploading) {\n return currentUploading + 1;\n });\n }\n }, [files, uploadHandler, uploading]);\n}\n/**\r\n * @param state - The current {@link FileState | state}\r\n * @public\r\n */\n\nfunction isTempFile(state) {\n var file = state;\n return !!(file.pending || file.failed || file.loaded);\n}\n\nexport { asyncScalar, _boolean as boolean, child, isTempFile, list, migratable, number, object, optional, scalar, serializedScalar, string, upload, usePendingFileUploader, usePendingFilesUploader };\n\n","import StyledComponents__default, { ThemeContext as ThemeContext$1, ThemeProvider as ThemeProvider$1 } from 'styled-components';\nimport { mergeDeepRight, pick } from 'ramda';\nimport { useContext, createElement, useMemo } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nexport { faFileDownload } from '@fortawesome/free-solid-svg-icons/faFileDownload';\nexport { faFileArchive } from '@fortawesome/free-solid-svg-icons/faFileArchive';\nexport { faFileAudio } from '@fortawesome/free-solid-svg-icons/faFileAudio';\nexport { faCheckCircle } from '@fortawesome/free-solid-svg-icons/faCheckCircle';\nexport { faFileExcel } from '@fortawesome/free-solid-svg-icons/faFileExcel';\nexport { faFileImage } from '@fortawesome/free-solid-svg-icons/faFileImage';\nexport { faFilePdf } from '@fortawesome/free-solid-svg-icons/faFilePdf';\nexport { faSmile } from '@fortawesome/free-solid-svg-icons/faSmile';\nexport { faFileWord } from '@fortawesome/free-solid-svg-icons/faFileWord';\nexport { faFileVideo } from '@fortawesome/free-solid-svg-icons/faFileVideo';\nexport { faFilePowerpoint } from '@fortawesome/free-solid-svg-icons/faFilePowerpoint';\nexport { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';\nexport { faCut } from '@fortawesome/free-solid-svg-icons/faCut';\nexport { faCog } from '@fortawesome/free-solid-svg-icons/faCog';\nexport { faCopy } from '@fortawesome/free-solid-svg-icons/faCopy';\nexport { faFileAlt } from '@fortawesome/free-solid-svg-icons/faFileAlt';\nexport { faImages } from '@fortawesome/free-solid-svg-icons/faImages';\nexport { faPhotoVideo } from '@fortawesome/free-solid-svg-icons/faPhotoVideo';\nexport { faLink } from '@fortawesome/free-solid-svg-icons/faLink';\nexport { faMinus } from '@fortawesome/free-solid-svg-icons/faMinus';\nexport { faPaste } from '@fortawesome/free-solid-svg-icons/faPaste';\nexport { faPencilAlt } from '@fortawesome/free-solid-svg-icons/faPencilAlt';\nexport { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';\nexport { faSpinner } from '@fortawesome/free-solid-svg-icons/faSpinner';\nexport { faTable } from '@fortawesome/free-solid-svg-icons/faTable';\nexport { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';\nexport { faTrashAlt } from '@fortawesome/free-solid-svg-icons/faTrashAlt';\nexport { faFilm } from '@fortawesome/free-solid-svg-icons/faFilm';\nexport { faCaretSquareUp } from '@fortawesome/free-solid-svg-icons/faCaretSquareUp';\nexport { faCaretSquareDown } from '@fortawesome/free-solid-svg-icons/faCaretSquareDown';\nexport { faSortUp } from '@fortawesome/free-solid-svg-icons/faSortUp';\nexport { faSortDown } from '@fortawesome/free-solid-svg-icons/faSortDown';\nexport { faToolbox } from '@fortawesome/free-solid-svg-icons/faToolbox';\nexport { faEllipsisH } from '@fortawesome/free-solid-svg-icons/faEllipsisH';\nexport { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';\nexport { faCloudUploadAlt } from '@fortawesome/free-solid-svg-icons/faCloudUploadAlt';\nexport { faQuestionCircle } from '@fortawesome/free-solid-svg-icons/faQuestionCircle';\nexport { faAnchor } from '@fortawesome/free-solid-svg-icons/faAnchor';\nexport { faQuoteRight } from '@fortawesome/free-solid-svg-icons/faQuoteRight';\nexport { faEquals } from '@fortawesome/free-solid-svg-icons/faEquals';\nexport { faCubes } from '@fortawesome/free-solid-svg-icons/faCubes';\nexport { faCode } from '@fortawesome/free-solid-svg-icons/faCode';\nexport { faLightbulb } from '@fortawesome/free-solid-svg-icons/faLightbulb';\nexport { faKeyboard } from '@fortawesome/free-solid-svg-icons/faKeyboard';\nexport { faDotCircle } from '@fortawesome/free-solid-svg-icons/faDotCircle';\nexport { faCheckSquare } from '@fortawesome/free-solid-svg-icons/faCheckSquare';\nexport { faParagraph } from '@fortawesome/free-solid-svg-icons/faParagraph';\nexport { faRedoAlt } from '@fortawesome/free-solid-svg-icons/faRedoAlt';\nexport { faRandom } from '@fortawesome/free-solid-svg-icons/faRandom';\nexport { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons/faExternalLinkAlt';\nexport { faNewspaper } from '@fortawesome/free-solid-svg-icons/faNewspaper';\n\n/** @public */\n\nvar defaultEditorTheme = {\n primary: {\n color: '#ffffff',\n background: 'rgb(70, 155, 255)'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n },\n color: '#EEEEEE',\n backgroundColor: 'rgba(51,51,51,0.95)'\n};\n/**\r\n * React Hook for the editor theming\r\n *\r\n * @returns An object containing the current {@link EditorTheme | editor theme} and {@link EditorUiTheme | editor UI theme}\r\n * @public\r\n */\n\nfunction useEditorTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link EditorThemeProps} to the current theme of the specified editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link EditorThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createEditorUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.editor), theme.editorUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of an editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useEditorUiTheme(key, createDefaultTheme) {\n var theme = useEditorTheme();\n return createEditorUiTheme(key, createDefaultTheme)(theme);\n}\n\n/**\r\n * Font Awesome Icon component\r\n *\r\n * @param props - Most of {@link https://github.com/FortAwesome/react-fontawesome | FontAwesomeIconProps}\r\n * @public\r\n */\n\nfunction Icon(props) {\n var allowedProps = pick(['icon', 'mask', 'className', 'color', 'spin', 'pulse', 'border', 'fixedWidth', 'inverse', 'listItem', 'flip', 'size', 'pull', 'rotation', 'transform', 'symbol', 'style', 'tabIndex', 'title'], props);\n return createElement(FontAwesomeIcon, Object.assign({}, allowedProps));\n}\n/**\r\n * Creates an icon component\r\n *\r\n * @param i - The icon to use\r\n * @returns A component for the specified icon\r\n * @public\r\n */\n\nfunction createIcon(i) {\n return function I() {\n return createElement(Icon, {\n icon: i,\n size: \"4x\"\n });\n };\n}\nvar EdtrSVG = /*#__PURE__*/StyledComponents__default.svg({\n display: 'inline-block',\n verticalAlign: 'middle',\n overflow: 'hidden'\n});\n/**\r\n * Edtr.io icon component\r\n *\r\n * @param props - An Edtr.io icon definition and an optional className\r\n * @returns The icon\r\n * @public\r\n */\n\nfunction EdtrIcon(props) {\n return createElement(EdtrSVG, {\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n className: props.className\n }, createElement(\"path\", {\n fill: \"currentcolor\",\n d: props.icon\n }));\n}\n/** @public */\n\nvar edtrAlignBlock = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignCenter = 'M7 16c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zm-3 5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm3-5c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignRight = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zm-6-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignLeft = 'M14 15H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zm0-8H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zM4 13h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0 8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrClose = 'M18.3,5.71 C17.91,5.32 17.28,5.32 16.89,5.71 L12,10.59 L7.11,5.7 C6.72,5.31 6.09,5.31 5.7,5.7 C5.31,6.09 5.31,6.72 5.7,7.11 L10.59,12 L5.7,16.89 C5.31,17.28 5.31,17.91 5.7,18.3 C6.09,18.69 6.72,18.69 7.11,18.3 L12,13.41 L16.89,18.3 C17.28,18.69 17.91,18.69 18.3,18.3 C18.69,17.91 18.69,17.28 18.3,16.89 L13.41,12 L18.3,7.11 C18.68,6.73 18.68,6.09 18.3,5.71 Z';\n/** @public */\n\nvar edtrFormula = 'M9.796061,6.84358189 L9.546061,9.73358189 L11.366061,9.73358189 C11.9183457,9.73358189 12.366061,10.1812971 12.366061,10.7335819 L12.366061,10.7335819 C12.366061,11.2858666 11.9183457,11.7335819 11.366061,11.7335819 L9.366061,11.7335819 L8.926061,16.8035819 C8.726061,19.0035819 6.786061,20.6335819 4.586061,20.4335819 C3.95133688,20.3777262 3.21218763,20.0027937 2.36861326,19.3087844 L2.3686112,19.3087869 C1.93754177,18.9541458 1.8755844,18.3172015 2.23022554,17.8861321 C2.25098506,17.8608987 2.27295601,17.8366869 2.296061,17.8135819 L2.296061,17.8135819 C2.68943711,17.4202058 3.31879167,17.3943638 3.74309403,17.7541652 C4.42335978,18.3310001 5.0243456,18.5341427 5.546061,18.3635819 C6.326061,18.1235819 6.876061,17.4335819 6.946061,16.6235819 L7.366061,11.7335819 L5.366061,11.7335819 C4.81377625,11.7335819 4.366061,11.2858666 4.366061,10.7335819 L4.366061,10.7335819 C4.366061,10.1812971 4.81377625,9.73358189 5.366061,9.73358189 L7.546061,9.73358189 L7.816061,6.66358189 C8.006061,4.46358189 9.936061,2.83358189 12.146061,3.01358189 C12.7876823,3.06959645 13.5343235,3.45039469 14.3859845,4.15597662 L14.3859731,4.15599041 C14.8171452,4.51320676 14.8770982,5.1523219 14.5198819,5.58349402 C14.4997127,5.60783893 14.4784158,5.63122712 14.456061,5.65358189 L14.456061,5.65358189 C14.077745,6.03189793 13.4644763,6.03223098 13.0857495,5.65432608 C12.6951429,5.26458609 12.3219165,5.05433484 11.966061,5.02358189 C10.866061,4.92358189 9.896061,5.73358189 9.796061,6.84358189 Z M20.841061,12.6785819 L20.841061,12.6785819 C20.4517003,12.2892211 19.8204217,12.2892211 19.431061,12.6785819 L17.306061,14.8035819 L15.1860786,12.6835995 C14.7931405,12.2906614 14.1567565,12.2884206 13.761061,12.6785819 L13.761061,12.6785819 C13.3689485,13.0652103 13.3645027,13.6965046 13.7511312,14.0886171 C13.7527745,14.0902837 13.7544236,14.0919445 13.7560786,14.0935995 L15.896061,16.2335819 L13.7610785,18.3385997 C13.3717179,18.7224956 13.3672879,19.3493438 13.7511838,19.7387045 C13.7544529,19.7420201 13.7577454,19.7453127 13.761061,19.7485819 L13.761061,19.7485819 C14.1567565,20.1387432 14.7931405,20.1365024 15.1860786,19.7435643 L17.306061,17.6235819 L19.431061,19.7485819 C19.8204217,20.1379426 20.4517003,20.1379426 20.841061,19.7485819 L20.841061,19.7485819 C21.2290435,19.3605994 21.2290435,18.7315555 20.841061,18.343573 C20.8402306,18.3427426 20.8393988,18.3419137 20.8385654,18.3410863 L18.716061,16.2335819 L20.8435477,14.0910599 C21.2319346,13.6999283 21.2308227,13.0683435 20.841061,12.6785819 Z';\n/** @public */\n\nvar edtrText = 'M2.5 5.5C2.5 6.33 3.17 7 4 7h3.5v10.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V7H14c.83 0 1.5-.67 1.5-1.5S14.83 4 14 4H4c-.83 0-1.5.67-1.5 1.5zM20 9h-6c-.83 0-1.5.67-1.5 1.5S13.17 12 14 12h1.5v5.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V12H20c.83 0 1.5-.67 1.5-1.5S20.83 9 20 9z';\n/** @public */\n\nvar edtrLink = 'M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1zm2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1z';\n/** @public */\n\nvar edtrQuote = 'M7.17 17c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94zm10 0c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94z';\n/** @public */\n\nvar edtrListNumbered = 'M8 7h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm12 10H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zm0-6H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zM4.5 16h-2c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5h-.5c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h2c.28 0 .5-.22.5-.5v-3c0-.28-.22-.5-.5-.5zm-2-11H3v2.5c0 .28.22.5.5.5s.5-.22.5-.5v-3c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5s.22.5.5.5zm2 5h-2c-.28 0-.5.22-.5.5s.22.5.5.5h1.3l-1.68 1.96c-.08.09-.12.21-.12.32v.22c0 .28.22.5.5.5h2c.28 0 .5-.22.5-.5s-.22-.5-.5-.5H3.2l1.68-1.96c.08-.09.12-.21.12-.32v-.22c0-.28-.22-.5-.5-.5z';\n/** @public */\n\nvar edtrListBullets = 'M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM8 19h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm0-6h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zM7 6c0 .55.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrItalic = 'M10 5.5c0 .83.67 1.5 1.5 1.5h.71l-3.42 8H7.5c-.83 0-1.5.67-1.5 1.5S6.67 18 7.5 18h5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5h-.71l3.42-8h1.29c.83 0 1.5-.67 1.5-1.5S17.33 4 16.5 4h-5c-.83 0-1.5.67-1.5 1.5z';\n/** @public */\n\nvar edtrColorText = 'M10.63 3.93L6.06 15.58c-.27.68.23 1.42.97 1.42.43 0 .82-.27.98-.68L8.87 14h6.25l.87 2.32c.15.41.54.68.98.68.73 0 1.24-.74.97-1.42L13.37 3.93C13.14 3.37 12.6 3 12 3c-.6 0-1.15.37-1.37.93zM9.62 12L12 5.67 14.38 12H9.62z';\n/** @public */\n\nvar edtrFill = 'M16.56 8.94L8.32.7C7.93.31 7.3.31 6.91.7c-.39.39-.39 1.02 0 1.41l1.68 1.68-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z';\n/** @public */\n\nvar edtrBold = 'M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H8c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h5.78c2.07 0 3.96-1.69 3.97-3.77.01-1.53-.85-2.84-2.15-3.44zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z';\n/** @public */\n\nvar edtrPlus = 'M12,2 C6.48,2 2,6.48 2,12 C2,17.52 6.48,22 12,22 C17.52,22 22,17.52 22,12 C22,6.48 17.52,2 12,2 Z M16,13 L13,13 L13,16 C13,16.55 12.55,17 12,17 C11.45,17 11,16.55 11,16 L11,13 L8,13 C7.45,13 7,12.55 7,12 C7,11.45 7.45,11 8,11 L11,11 L11,8 C11,7.45 11.45,7 12,7 C12.55,7 13,7.45 13,8 L13,11 L16,11 C16.55,11 17,11.45 17,12 C17,12.55 16.55,13 16,13 Z';\n/** @public */\n\nvar edtrSearch = 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z';\n/** @public */\n\nvar edtrDefaultPlugin = 'M20.6190476,11.5238095 L19.1904762,11.5238095 L19.1904762,7.71428571 C19.1904762,6.65714286 18.3333333,5.80952381 17.2857143,5.80952381 L13.4761905,5.80952381 L13.4761905,4.38095238 C13.4761905,3.06598869 12.4102018,2 11.0952381,2 C9.78027441,2 8.71428571,3.06598869 8.71428571,4.38095238 L8.71428571,5.80952381 L4.9047619,5.80952381 C3.85279095,5.80952381 3,6.66231476 3,7.71428571 L3,11.3333333 L4.42857143,11.3333333 C5.85714286,11.3333333 7,12.4761905 7,13.9047619 C7,15.3333333 5.85714286,16.4761905 4.42857143,16.4761905 L3,16.4761905 L3,20.0952381 C3,21.147209 3.85279095,22 4.9047619,22 L8.52380952,22 L8.52380952,20.5714286 C8.52380952,19.1428571 9.66666667,18 11.0952381,18 C12.5238095,18 13.6666667,19.1428571 13.6666667,20.5714286 L13.6666667,22 L17.2857143,22 C18.3376852,22 19.1904762,21.147209 19.1904762,20.0952381 L19.1904762,16.2857143 L20.6190476,16.2857143 C21.9340113,16.2857143 23,15.2197256 23,13.9047619 C23,12.5897982 21.9340113,11.5238095 20.6190476,11.5238095 Z';\n/** @public */\n\nvar edtrDragHandle = 'M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z';\n\n/** @public */\n\nvar defaultRendererTheme = {\n backgroundColor: '#ffffff',\n color: '#333333',\n primary: {\n color: '#ffffff',\n background: '#337ab7'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n }\n};\n/**\r\n * React Hook for the renderer theming\r\n *\r\n * @returns An object containing the current {@link RendererTheme | renderer theme} and {@link RendererUiTheme | renderer UI theme}\r\n * @public\r\n */\n\nfunction useRendererTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link RendererThemeProps} to the current theme of the specified renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link RendererThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createRendererUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.renderer), theme.rendererUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of a renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useRendererUiTheme(key, createDefaultTheme) {\n var theme = useRendererTheme();\n return createRendererUiTheme(key, createDefaultTheme)(theme);\n}\n\nvar defaultTheme = {\n editor: defaultEditorTheme,\n editorUi: {},\n renderer: defaultRendererTheme,\n rendererUi: {}\n}; // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to hydrate the context for the {@link Theme | Theme}\r\n *\r\n * @remarks\r\n * You probably don't want to use this component directly since it is already used by the core.\r\n * If you want to override the theme in some plugin, you probably want to use {@link ThemeProvider | ThemeProvider} instead.\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | default Theme}, and children\r\n * @public\r\n */\n\nfunction RootThemeProvider(props) {\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n/**\r\n * Context used for the {@link Theme | Theme}, see also {@link https://styled-components.com/docs/advanced#theming | Theming }\r\n *\r\n * @public\r\n */\n\nvar ThemeContext = ThemeContext$1;\n/**\r\n * React Hook to get the current {@link Theme | Theme}\r\n *\r\n * @returns The current {@link Theme | Theme}\r\n * @public\r\n */\n\nfunction useTheme() {\n return useContext(ThemeContext);\n} // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to override the current {@link Theme | theme}\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | current Theme}, and children\r\n * @public\r\n */\n\nfunction ThemeProvider(props) {\n var defaultTheme = useTheme();\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [defaultTheme, props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n\n/**\r\n * Provides utils for the User Interface\r\n *\r\n * @packageDocumentation\r\n */\n/**\r\n * Re-export of {@link https://styled-components.com/docs/api#primary | `styled` in `styled-components` }\r\n *\r\n * @public\r\n */\n\nvar styled = StyledComponents__default;\n\nexport { EdtrIcon, Icon, RootThemeProvider, ThemeContext, ThemeProvider, createEditorUiTheme, createIcon, createRendererUiTheme, defaultEditorTheme, defaultRendererTheme, edtrAlignBlock, edtrAlignCenter, edtrAlignLeft, edtrAlignRight, edtrBold, edtrClose, edtrColorText, edtrDefaultPlugin, edtrDragHandle, edtrFill, edtrFormula, edtrItalic, edtrLink, edtrListBullets, edtrListNumbered, edtrPlus, edtrQuote, edtrSearch, edtrText, styled, useEditorTheme, useEditorUiTheme, useRendererTheme, useRendererUiTheme, useTheme };\n\n","import { list, child } from '@edtr-io/plugin';\nimport { findIndex, remove, insert, mergeDeepRight } from 'ramda';\nimport { useScopedStore, PluginToolbarButton, OverlayButton, useScopedSelector } from '@edtr-io/core';\nimport { getDocument, getFocusPath, getFocusTree, findParent, serializeDocument, isFocused, getPlugins } from '@edtr-io/store';\nimport { styled, edtrDefaultPlugin, EdtrIcon, edtrClose, edtrSearch, Icon as Icon$1, faCopy, faTrashAlt, edtrDragHandle, edtrPlus } from '@edtr-io/ui';\nimport { createElement, Fragment, useState, useCallback, useEffect, useRef, useMemo } from 'react';\nimport { useDrag, useDrop } from 'react-dnd';\nimport { NativeTypes } from 'react-dnd-html5-backend';\n\nvar Row = /*#__PURE__*/styled.div({\n marginBottom: '25px'\n});\nfunction RowsRenderer(props) {\n return createElement(Fragment, null, props.state.map(function (row) {\n return createElement(Row, {\n key: row.id\n }, row.render());\n }));\n}\n\nvar StyledPlugin = /*#__PURE__*/styled.div(function (_ref) {\n var config = _ref.config;\n var theme = config.theme;\n return {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'flex-start',\n margin: '15px',\n width: '175px',\n borderRadius: '5px',\n padding: '15px',\n cursor: 'pointer',\n transition: '250ms all ease-in-out',\n color: theme.menu.primary.color,\n '&:hover': {\n backgroundColor: theme.menu.secondary.backgroundColor\n }\n };\n});\nvar DefaultIcon = /*#__PURE__*/styled(EdtrIcon)({\n height: '100%',\n width: '100%'\n});\nvar IconWrapper = /*#__PURE__*/styled.div({\n height: '50px'\n});\nvar Title = /*#__PURE__*/styled.h3({\n marginTop: '15px',\n fontSize: '24px',\n marginBottom: '10px',\n fontWeight: 'bold',\n textAlign: 'center'\n});\nvar Description = /*#__PURE__*/styled.p({\n margin: 0,\n textAlign: 'center',\n fontSize: '16px'\n});\nvar Plugin = function Plugin(_ref2) {\n var config = _ref2.config,\n plugin = _ref2.plugin,\n pluginName = _ref2.pluginName,\n onClick = _ref2.onClick;\n return createElement(StyledPlugin, {\n config: config,\n onClick: onClick\n }, createElement(IconWrapper, null, plugin.icon ? createElement(plugin.icon, null) : createElement(DefaultIcon, {\n icon: edtrDefaultPlugin\n })), createElement(Title, null, plugin.title || pluginName), plugin.description && createElement(Description, null, plugin.description));\n};\n\nvar StyledSearch = /*#__PURE__*/styled.div({\n paddingTop: '25px',\n paddingBottom: '25px',\n display: 'flex',\n justifyContent: 'center',\n width: '600px',\n '@media (max-width: 650px)': {\n width: '100%'\n }\n});\nvar InputWrapper = /*#__PURE__*/styled.div({\n position: 'relative',\n width: '100%'\n});\nvar StyledInput = /*#__PURE__*/styled.input(function (_ref) {\n var config = _ref.config;\n var theme = config.theme;\n return {\n padding: '5px 30px',\n border: \"2px solid \" + theme.menu.secondary.color,\n borderRadius: '5px',\n fontSize: '20px',\n outline: 'none',\n backgroundColor: theme.menu.primary.backgroundColor,\n transition: '250ms all ease-in-out',\n width: '100%',\n '&:focus': {\n borderColor: theme.menu.highlightColor\n },\n '&::placeholder': {\n color: theme.menu.secondary.color\n }\n };\n});\nvar ClearSearchContainer = /*#__PURE__*/styled.div(function (_ref2) {\n var config = _ref2.config,\n visible = _ref2.visible;\n var theme = config.theme;\n return {\n height: '55%',\n position: 'absolute',\n top: '50%',\n right: '5px',\n transform: 'translateY(-50%)',\n opacity: visible ? 1 : 0,\n transition: '250ms all ease-in-out',\n cursor: 'pointer',\n color: theme.menu.secondary.color,\n '&:hover': {\n color: theme.menu.highlightColor\n }\n };\n});\nvar SearchIcon = /*#__PURE__*/styled(EdtrIcon)(function (_ref3) {\n var config = _ref3.config;\n var theme = config.theme;\n return {\n height: '55%',\n position: 'absolute',\n color: theme.menu.secondary.color,\n top: '50%',\n left: '5px',\n transform: 'translateY(-50%)'\n };\n});\nvar Search = function Search(_ref4) {\n var search = _ref4.search,\n setSearch = _ref4.setSearch,\n config = _ref4.config;\n return createElement(StyledSearch, null, createElement(InputWrapper, null, createElement(StyledInput, {\n config: config,\n placeholder: config.i18n.menu.searchPlaceholder,\n value: search,\n onChange: function onChange(e) {\n return setSearch(e.target.value);\n }\n }), createElement(ClearSearchContainer, {\n config: config,\n visible: search.length > 0,\n onClick: function onClick() {\n return setSearch('');\n }\n }, createElement(EdtrIcon, {\n icon: edtrClose\n })), createElement(SearchIcon, {\n config: config,\n icon: edtrSearch\n })));\n};\n\nvar Wrapper = /*#__PURE__*/styled.div(function (_ref) {\n var config = _ref.config;\n var theme = config.theme;\n return {\n display: 'flex',\n padding: '25px calc((100vw - 960px) / 2) 0',\n flexDirection: 'column',\n backgroundColor: theme.menu.primary.backgroundColor,\n alignItems: 'center',\n position: 'fixed',\n top: 0,\n left: 0,\n width: '100vw',\n height: '100vh',\n zIndex: 9999,\n '@media (max-width: 1000px)': {\n padding: '25px 20px 0'\n }\n };\n});\nvar CloseButtonContainer = /*#__PURE__*/styled.div({\n position: 'absolute',\n top: '15px',\n right: '15px',\n width: '30px',\n cursor: 'pointer'\n});\nvar PluginList = /*#__PURE__*/styled.div({\n display: 'flex',\n justifyContent: 'space-around',\n flexWrap: 'wrap',\n overflowY: 'auto',\n alignItems: 'stretch'\n});\nfunction Menu(_ref2) {\n var menu = _ref2.menu,\n setMenu = _ref2.setMenu,\n config = _ref2.config;\n\n var _React$useState = useState(''),\n search = _React$useState[0],\n setSearch = _React$useState[1];\n\n var close = useCallback(function (evt) {\n if (evt.key === 'Escape') setMenu(undefined);\n }, [setMenu]);\n useEffect(function () {\n window.addEventListener('keydown', close);\n return function () {\n window.removeEventListener('keydown', close);\n };\n }, [close]);\n var mappedPlugins = config.plugins.filter(function (_ref3) {\n var pluginKey = _ref3.name,\n title = _ref3.title,\n description = _ref3.description;\n if (!search.length) return true;\n if (title && title.toLowerCase().includes(search.toLowerCase())) return true;\n if (description && description.toLowerCase().includes(search.toLowerCase())) return true;\n return pluginKey.toLowerCase().includes(search.toLowerCase());\n }).map(function (plugin) {\n return createElement(Plugin, {\n config: config,\n onClick: function onClick() {\n return menu.onClose({\n plugin: plugin.name\n });\n },\n key: plugin.name,\n pluginName: plugin.name,\n plugin: plugin\n });\n });\n return createElement(Wrapper, {\n config: config\n }, createElement(Search, {\n config: config,\n search: search,\n setSearch: setSearch\n }), createElement(PluginList, null, mappedPlugins), createElement(CloseButtonContainer, {\n onClick: function onClick() {\n return setMenu(undefined);\n }\n }, createElement(EdtrIcon, {\n icon: edtrClose\n })));\n}\n\nfunction useCanDrop(id, draggingAbove, allowedPlugins) {\n var store = useScopedStore();\n return function (dragId) {\n return dragId && isAllowedPlugin(dragId) && !wouldDropInOwnChildren(dragId) && !wouldDropAtInitialPosition(dragId);\n };\n\n function isAllowedPlugin(dragId) {\n var doc = getDocument(dragId)(store.getState());\n return doc && allowedPlugins.includes(doc.plugin);\n }\n\n function wouldDropInOwnChildren(dragId) {\n var focusPath = getFocusPath(id)(store.getState()) || [];\n return focusPath.includes(dragId);\n }\n\n function wouldDropAtInitialPosition(dragId) {\n var focusTree = getFocusTree()(store.getState());\n if (!focusTree) return true;\n var parent = findParent(focusTree, dragId);\n var dropIndex = getChildPosition(parent, id); // Different parents, so definitely not dropped at initial position\n\n if (dropIndex === null) return false;\n var dragIndex = getChildPosition(parent, dragId);\n return draggingAbove ? dragIndex === dropIndex - 1 : dragIndex === dropIndex + 1;\n }\n\n function getChildPosition(parent, childId) {\n if (!parent) return null;\n var position = findIndex(function (node) {\n return node.id === childId;\n }, parent.children || []);\n return position > -1 ? position : null;\n }\n}\n\nvar DragToolbarButton = /*#__PURE__*/styled(PluginToolbarButton)({\n marginBottom: '5px',\n marginTop: '-3px',\n cursor: 'grab',\n userSelect: 'none',\n '&:active': {\n cursor: 'grabbing'\n }\n});\nvar ButtonContainer = /*#__PURE__*/styled.div({\n display: 'flex'\n});\nvar Left = /*#__PURE__*/styled.div({\n flex: 1\n});\nvar BorderlessOverlayButton = /*#__PURE__*/styled(OverlayButton)({\n border: 'none !important',\n padding: '0 !important',\n minWidth: '0 !important'\n});\nvar GrayOut = /*#__PURE__*/styled.div({\n opacity: 0.3\n});\nvar Inserted = /*#__PURE__*/styled.hr(function (_ref) {\n var config = _ref.config;\n return {\n margin: 0,\n padding: 0,\n border: \"1px solid \" + config.theme.highlightColor\n };\n});\nvar validFileTypes = [NativeTypes.FILE, NativeTypes.URL];\nfunction RowRenderer(_ref2) {\n var config = _ref2.config,\n row = _ref2.row,\n rows = _ref2.rows,\n index = _ref2.index,\n plugins = _ref2.plugins,\n dropContainer = _ref2.dropContainer;\n var container = useRef(null);\n\n var _React$useState = useState(true),\n draggingAbove = _React$useState[0],\n setDraggingAbove = _React$useState[1];\n\n var allowedPlugins = useMemo(function () {\n return config.plugins.map(function (plugin) {\n return plugin.name;\n });\n }, [config]);\n var canDrop = useCanDrop(row.id, draggingAbove, allowedPlugins);\n var store = useScopedStore();\n\n var _useDrag = useDrag({\n item: {\n id: row.id,\n type: 'row',\n serialized: {\n plugin: '',\n state: ''\n },\n onDrop: function onDrop() {}\n },\n begin: function begin() {\n var serialized = serializeDocument(row.id)(store.getState());\n return {\n id: row.id,\n type: 'row',\n serialized: serialized,\n onDrop: function onDrop() {\n rows.set(function (list) {\n var i = findIndex(function (id) {\n return id === row.id;\n }, list);\n return remove(i, 1, list);\n });\n }\n };\n },\n collect: function collect(monitor) {\n return {\n isDragging: !!monitor.isDragging()\n };\n }\n }),\n collectedDragProps = _useDrag[0],\n drag = _useDrag[1],\n dragPreview = _useDrag[2];\n\n var _useDrop = useDrop({\n accept: ['row'].concat(validFileTypes),\n collect: function collect(monitor) {\n var type = monitor.getItemType();\n var isDragging = monitor.canDrop() && monitor.isOver({\n shallow: true\n });\n\n if (isFileType(type)) {\n return {\n isDragging: isDragging,\n isFile: true\n };\n }\n\n if (type == 'row') {\n return {\n isDragging: isDragging,\n id: monitor.getItem().id\n };\n }\n\n return {\n isDragging: false\n };\n },\n hover: function hover(item, monitor) {\n if (monitor.getItemType() === 'row' && monitor.canDrop() && monitor.isOver({\n shallow: true\n })) {\n setDraggingAbove(isDraggingAbove(monitor));\n }\n },\n drop: function drop(item, monitor) {\n var type = monitor.getItemType(); // handled in nested drop zone\n\n if (monitor.didDrop()) return;\n\n if (!isFileType(type)) {\n if (!canDrop(item.id)) return;\n\n var _draggingAbove = isDraggingAbove(monitor);\n\n rows.set(function (list, deserializer) {\n var i = findIndex(function (id) {\n return id === row.id;\n }, list);\n return insert(_draggingAbove ? i : i + 1, deserializer(item.serialized), list);\n });\n item.onDrop();\n return;\n }\n\n var dropIndex = index;\n\n switch (type) {\n case NativeTypes.FILE:\n {\n var files = monitor.getItem().files;\n\n for (var key in plugins) {\n var onFiles = plugins[key].onFiles;\n\n if (typeof onFiles === 'function') {\n var result = onFiles(files);\n\n if (result !== undefined) {\n handleResult(key, result);\n return;\n }\n }\n }\n\n break;\n }\n\n case NativeTypes.URL:\n {\n var urls = monitor.getItem().urls;\n var text = urls[0];\n\n for (var _key in plugins) {\n var onText = plugins[_key].onText;\n\n if (typeof onText === 'function') {\n var _result = onText(text);\n\n if (_result !== undefined) {\n handleResult(_key, _result);\n return;\n }\n }\n }\n\n break;\n }\n }\n\n function handleResult(key, result) {\n if (isDraggingAbove(monitor)) {\n rows.insert(dropIndex, {\n plugin: key,\n state: result.state\n });\n } else {\n rows.insert(dropIndex + 1, {\n plugin: key,\n state: result.state\n });\n }\n }\n }\n }),\n collectedDropProps = _useDrop[0],\n drop = _useDrop[1];\n\n var pluginProps = useMemo(function () {\n return {\n renderSettings: function renderSettings(children, _ref3) {\n var close = _ref3.close;\n return createElement(Fragment, null, children, createElement(\"hr\", null), createElement(ButtonContainer, null, createElement(Left, null, createElement(BorderlessOverlayButton, {\n onClick: function onClick() {\n var document = getDocument(row.id)(store.getState());\n if (!document) return;\n rows.insert(index, document);\n close();\n },\n label: config.i18n.settings.duplicateLabel\n }, createElement(Icon$1, {\n icon: faCopy\n }), \" \", config.i18n.settings.duplicateLabel), createElement(BorderlessOverlayButton, {\n onClick: function onClick() {\n rows.remove(index);\n close();\n },\n label: config.i18n.settings.removeLabel\n }, createElement(Icon$1, {\n icon: faTrashAlt\n }), \" \", config.i18n.settings.removeLabel)), createElement(\"div\", null, createElement(BorderlessOverlayButton, {\n onClick: function onClick() {\n close();\n },\n label: config.i18n.settings.closeLabel\n }))));\n },\n renderToolbar: function renderToolbar(children) {\n return createElement(Fragment, null, createElement(DragToolbarButton, {\n ref: drag,\n icon: createElement(EdtrIcon, {\n icon: edtrDragHandle\n }),\n label: config.i18n.toolbar.dragLabel\n }), children);\n }\n };\n }, [config.i18n.settings.duplicateLabel, config.i18n.settings.removeLabel, config.i18n.settings.closeLabel, config.i18n.toolbar.dragLabel, row.id, store, rows, index, drag]);\n dragPreview(drop(dropContainer));\n var dropPreview = collectedDropProps.isDragging && (collectedDropProps.isFile || canDrop(collectedDropProps.id)) ? createElement(Inserted, {\n config: config\n }) : null;\n return createElement(Fragment, null, draggingAbove ? dropPreview : null, createElement(\"div\", {\n ref: container\n }, collectedDragProps.isDragging ? createElement(GrayOut, null, row.render(pluginProps)) : createElement(\"div\", null, row.render(pluginProps))), !draggingAbove ? dropPreview : null);\n\n function isDraggingAbove(monitor) {\n if (!container.current) {\n return false;\n }\n\n var domBoundingRect = container.current.getBoundingClientRect();\n var domMiddleY = (domBoundingRect.bottom - domBoundingRect.top) / 2;\n var dropClientOffset = monitor.getClientOffset();\n var dragClientY = dropClientOffset ? dropClientOffset.y - domBoundingRect.top : 0;\n return dragClientY < domMiddleY;\n }\n}\n\nfunction isFileType(type) {\n return validFileTypes.includes(type);\n}\n\nvar StyledSeparator = /*#__PURE__*/styled.div(function (_ref) {\n var isFirst = _ref.isFirst;\n return {\n position: 'absolute',\n height: 'auto',\n width: '100%',\n transform: isFirst ? 'translateY(-100%)' : 'translateY(100%)',\n top: isFirst ? 0 : undefined,\n bottom: isFirst ? undefined : 0\n };\n});\nvar AddTrigger = /*#__PURE__*/styled.div(function (_ref2) {\n var focused = _ref2.focused,\n config = _ref2.config;\n var theme = config.theme;\n return {\n width: '26px',\n height: '26px',\n borderRadius: '13px',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n color: theme.color,\n backgroundColor: theme.backgroundColor,\n padding: '5px 0 10px',\n opacity: focused ? 0.6 : 0,\n transition: '250ms all ease-in-out 250ms',\n // position: inline ? 'absolute' : 'relative',\n zIndex: 70,\n '&:hover': {\n color: theme.highlightColor,\n opacity: 1,\n cursor: 'pointer'\n }\n };\n});\nvar TriggerArea = /*#__PURE__*/styled.div({\n width: '100%',\n padding: '2px 0 4px',\n display: 'flex',\n justifyContent: 'center',\n '&:hover .add-trigger': {\n opacity: 0.6\n }\n});\nvar Icon = /*#__PURE__*/styled(EdtrIcon)({\n width: '26px'\n});\nfunction Add(props) {\n return createElement(AddTrigger, {\n className: \"add-trigger\",\n config: props.config,\n focused: props.focused,\n title: props.config.i18n.addLabel,\n onMouseDown: props.onClick\n }, createElement(Icon, {\n icon: edtrPlus\n }));\n}\nfunction Separator(_ref3) {\n var config = _ref3.config,\n isFirst = _ref3.isFirst,\n onClick = _ref3.onClick,\n focused = _ref3.focused;\n return createElement(StyledSeparator, {\n isFirst: isFirst\n }, createElement(TriggerArea, null, createElement(Add, {\n config: config,\n focused: focused || false,\n onClick: onClick\n })));\n}\n\nvar DropContainer = /*#__PURE__*/styled.div({\n position: 'relative',\n // increase dropZone\n marginLeft: '-50px',\n paddingLeft: '50px'\n});\n\nfunction RowEditor(_ref) {\n var config = _ref.config,\n openMenu = _ref.openMenu,\n index = _ref.index,\n row = _ref.row,\n rows = _ref.rows;\n var focused = useScopedSelector(isFocused(row.id));\n var plugins = useScopedSelector(getPlugins());\n var dropContainer = useRef(null);\n return createElement(DropContainer, {\n key: row.id,\n ref: dropContainer\n }, createElement(RowRenderer, {\n config: config,\n row: row,\n rows: rows,\n index: index,\n plugins: plugins,\n dropContainer: dropContainer\n }), createElement(Separator, {\n config: config,\n focused: focused,\n onClick: function onClick() {\n openMenu(index + 1);\n }\n }));\n}\n\nfunction RowsEditor(props) {\n var _React$useState = useState(undefined),\n menu = _React$useState[0],\n setMenu = _React$useState[1];\n\n function _openMenu(insertIndex) {\n setMenu({\n index: insertIndex,\n onClose: function onClose(pluginState) {\n props.state.insert(insertIndex, pluginState);\n setMenu(undefined);\n }\n });\n }\n\n if (!props.editable) return createElement(RowsRenderer, Object.assign({}, props));\n return createElement(\"div\", {\n style: {\n position: 'relative',\n marginTop: '25px'\n }\n }, createElement(Separator, {\n config: props.config,\n isFirst: true,\n focused: props.state.length == 0,\n onClick: function onClick() {\n _openMenu(0);\n }\n }), props.state.map(function (row, index) {\n return createElement(RowEditor, {\n config: props.config,\n key: row.id,\n openMenu: function openMenu() {\n _openMenu(index + 1);\n },\n index: index,\n rows: props.state,\n row: row\n });\n }), menu ? createElement(Menu, {\n menu: menu,\n setMenu: setMenu,\n config: props.config\n }) : null);\n}\n\n/**\r\n * @param config - {@link RowsConfig | Plugin configuration}\r\n * @public\r\n */\n\nfunction createRowsPlugin(config) {\n var _config$i18n = config.i18n,\n i18n = _config$i18n === void 0 ? {} : _config$i18n,\n _config$theme = config.theme,\n theme = _config$theme === void 0 ? {} : _config$theme,\n content = config.content,\n plugins = config.plugins;\n return {\n Component: RowsEditor,\n config: function config(_ref) {\n var editor = _ref.editor;\n return {\n plugins: plugins,\n i18n: mergeDeepRight({\n menu: {\n searchPlaceholder: 'Search for tools…'\n },\n settings: {\n duplicateLabel: 'Duplicate',\n removeLabel: 'Remove',\n closeLabel: 'Close'\n },\n toolbar: {\n dragLabel: 'Drag the element within the document'\n },\n addLabel: 'Add an element'\n }, i18n),\n theme: mergeDeepRight({\n color: editor.secondary.color,\n backgroundColor: editor.primary.color,\n highlightColor: editor.primary.background,\n lightBackgroundColor: 'rgb(182,182,182)',\n menu: {\n highlightColor: editor.primary.background,\n primary: {\n backgroundColor: 'rgba(255, 255, 255, 0.95)',\n color: editor.backgroundColor\n },\n secondary: {\n backgroundColor: 'rgba(0, 0, 0, 0.1)',\n color: '#999999'\n },\n dropzone: {\n backgroundColor: 'rgb(73, 73, 73)',\n color: '#dbdbdb',\n highlightColor: editor.primary.background,\n highlightBackgroundColor: 'rgb(60,60,60)'\n }\n }\n }, theme)\n };\n },\n state: list(child(content), 1),\n insertChild: function insertChild(state, _ref2) {\n var previousSibling = _ref2.previousSibling,\n document = _ref2.document;\n var index = getIndexToInsert();\n if (index === null) return;\n state.insert(index, document);\n\n function getIndexToInsert() {\n if (!previousSibling) return 0;\n var index = findIndex(function (sibling) {\n return sibling.id === previousSibling;\n }, state);\n if (index === -1) return null;\n return index + 1;\n }\n },\n removeChild: function removeChild(state, id) {\n var index = findIndex(function (child) {\n return child.id === id;\n }, state);\n if (index === -1) return;\n state.remove(index);\n }\n };\n}\n\nexport { createRowsPlugin };\n\n","import { child } from '@edtr-io/plugin';\nimport { createElement } from 'react';\n\nfunction BlockquoteRenderer(props) {\n return createElement(\"blockquote\", null, props.state.render());\n}\n\n/**\r\n * @param config - {@link BlockquoteConfig | Plugin configuration}\r\n * @public\r\n */\n\nfunction createBlockquotePlugin(config) {\n return {\n Component: BlockquoteRenderer,\n config: {},\n state: createState()\n };\n\n function createState() {\n return child(config.content);\n }\n}\n\nexport { createBlockquotePlugin };\n\n","import StyledComponents__default, { ThemeContext as ThemeContext$1, ThemeProvider as ThemeProvider$1 } from 'styled-components';\nimport { mergeDeepRight, pick } from 'ramda';\nimport { useContext, createElement, useMemo } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nexport { faFileDownload } from '@fortawesome/free-solid-svg-icons/faFileDownload';\nexport { faFileArchive } from '@fortawesome/free-solid-svg-icons/faFileArchive';\nexport { faFileAudio } from '@fortawesome/free-solid-svg-icons/faFileAudio';\nexport { faCheckCircle } from '@fortawesome/free-solid-svg-icons/faCheckCircle';\nexport { faFileExcel } from '@fortawesome/free-solid-svg-icons/faFileExcel';\nexport { faFileImage } from '@fortawesome/free-solid-svg-icons/faFileImage';\nexport { faFilePdf } from '@fortawesome/free-solid-svg-icons/faFilePdf';\nexport { faSmile } from '@fortawesome/free-solid-svg-icons/faSmile';\nexport { faFileWord } from '@fortawesome/free-solid-svg-icons/faFileWord';\nexport { faFileVideo } from '@fortawesome/free-solid-svg-icons/faFileVideo';\nexport { faFilePowerpoint } from '@fortawesome/free-solid-svg-icons/faFilePowerpoint';\nexport { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';\nexport { faCut } from '@fortawesome/free-solid-svg-icons/faCut';\nexport { faCog } from '@fortawesome/free-solid-svg-icons/faCog';\nexport { faCopy } from '@fortawesome/free-solid-svg-icons/faCopy';\nexport { faFileAlt } from '@fortawesome/free-solid-svg-icons/faFileAlt';\nexport { faImages } from '@fortawesome/free-solid-svg-icons/faImages';\nexport { faPhotoVideo } from '@fortawesome/free-solid-svg-icons/faPhotoVideo';\nexport { faLink } from '@fortawesome/free-solid-svg-icons/faLink';\nexport { faMinus } from '@fortawesome/free-solid-svg-icons/faMinus';\nexport { faPaste } from '@fortawesome/free-solid-svg-icons/faPaste';\nexport { faPencilAlt } from '@fortawesome/free-solid-svg-icons/faPencilAlt';\nexport { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';\nexport { faSpinner } from '@fortawesome/free-solid-svg-icons/faSpinner';\nexport { faTable } from '@fortawesome/free-solid-svg-icons/faTable';\nexport { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';\nexport { faTrashAlt } from '@fortawesome/free-solid-svg-icons/faTrashAlt';\nexport { faFilm } from '@fortawesome/free-solid-svg-icons/faFilm';\nexport { faCaretSquareUp } from '@fortawesome/free-solid-svg-icons/faCaretSquareUp';\nexport { faCaretSquareDown } from '@fortawesome/free-solid-svg-icons/faCaretSquareDown';\nexport { faSortUp } from '@fortawesome/free-solid-svg-icons/faSortUp';\nexport { faSortDown } from '@fortawesome/free-solid-svg-icons/faSortDown';\nexport { faToolbox } from '@fortawesome/free-solid-svg-icons/faToolbox';\nexport { faEllipsisH } from '@fortawesome/free-solid-svg-icons/faEllipsisH';\nexport { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';\nexport { faCloudUploadAlt } from '@fortawesome/free-solid-svg-icons/faCloudUploadAlt';\nexport { faQuestionCircle } from '@fortawesome/free-solid-svg-icons/faQuestionCircle';\nexport { faAnchor } from '@fortawesome/free-solid-svg-icons/faAnchor';\nexport { faQuoteRight } from '@fortawesome/free-solid-svg-icons/faQuoteRight';\nexport { faEquals } from '@fortawesome/free-solid-svg-icons/faEquals';\nexport { faCubes } from '@fortawesome/free-solid-svg-icons/faCubes';\nexport { faCode } from '@fortawesome/free-solid-svg-icons/faCode';\nexport { faLightbulb } from '@fortawesome/free-solid-svg-icons/faLightbulb';\nexport { faKeyboard } from '@fortawesome/free-solid-svg-icons/faKeyboard';\nexport { faDotCircle } from '@fortawesome/free-solid-svg-icons/faDotCircle';\nexport { faCheckSquare } from '@fortawesome/free-solid-svg-icons/faCheckSquare';\nexport { faParagraph } from '@fortawesome/free-solid-svg-icons/faParagraph';\nexport { faRedoAlt } from '@fortawesome/free-solid-svg-icons/faRedoAlt';\nexport { faRandom } from '@fortawesome/free-solid-svg-icons/faRandom';\nexport { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons/faExternalLinkAlt';\nexport { faNewspaper } from '@fortawesome/free-solid-svg-icons/faNewspaper';\n\n/** @public */\n\nvar defaultEditorTheme = {\n primary: {\n color: '#ffffff',\n background: 'rgb(70, 155, 255)'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n },\n color: '#EEEEEE',\n backgroundColor: 'rgba(51,51,51,0.95)'\n};\n/**\r\n * React Hook for the editor theming\r\n *\r\n * @returns An object containing the current {@link EditorTheme | editor theme} and {@link EditorUiTheme | editor UI theme}\r\n * @public\r\n */\n\nfunction useEditorTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link EditorThemeProps} to the current theme of the specified editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link EditorThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createEditorUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.editor), theme.editorUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of an editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useEditorUiTheme(key, createDefaultTheme) {\n var theme = useEditorTheme();\n return createEditorUiTheme(key, createDefaultTheme)(theme);\n}\n\n/**\r\n * Font Awesome Icon component\r\n *\r\n * @param props - Most of {@link https://github.com/FortAwesome/react-fontawesome | FontAwesomeIconProps}\r\n * @public\r\n */\n\nfunction Icon(props) {\n var allowedProps = pick(['icon', 'mask', 'className', 'color', 'spin', 'pulse', 'border', 'fixedWidth', 'inverse', 'listItem', 'flip', 'size', 'pull', 'rotation', 'transform', 'symbol', 'style', 'tabIndex', 'title'], props);\n return createElement(FontAwesomeIcon, Object.assign({}, allowedProps));\n}\n/**\r\n * Creates an icon component\r\n *\r\n * @param i - The icon to use\r\n * @returns A component for the specified icon\r\n * @public\r\n */\n\nfunction createIcon(i) {\n return function I() {\n return createElement(Icon, {\n icon: i,\n size: \"4x\"\n });\n };\n}\nvar EdtrSVG = /*#__PURE__*/StyledComponents__default.svg({\n display: 'inline-block',\n verticalAlign: 'middle',\n overflow: 'hidden'\n});\n/**\r\n * Edtr.io icon component\r\n *\r\n * @param props - An Edtr.io icon definition and an optional className\r\n * @returns The icon\r\n * @public\r\n */\n\nfunction EdtrIcon(props) {\n return createElement(EdtrSVG, {\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n className: props.className\n }, createElement(\"path\", {\n fill: \"currentcolor\",\n d: props.icon\n }));\n}\n/** @public */\n\nvar edtrAlignBlock = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignCenter = 'M7 16c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zm-3 5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm3-5c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignRight = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zm-6-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignLeft = 'M14 15H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zm0-8H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zM4 13h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0 8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrClose = 'M18.3,5.71 C17.91,5.32 17.28,5.32 16.89,5.71 L12,10.59 L7.11,5.7 C6.72,5.31 6.09,5.31 5.7,5.7 C5.31,6.09 5.31,6.72 5.7,7.11 L10.59,12 L5.7,16.89 C5.31,17.28 5.31,17.91 5.7,18.3 C6.09,18.69 6.72,18.69 7.11,18.3 L12,13.41 L16.89,18.3 C17.28,18.69 17.91,18.69 18.3,18.3 C18.69,17.91 18.69,17.28 18.3,16.89 L13.41,12 L18.3,7.11 C18.68,6.73 18.68,6.09 18.3,5.71 Z';\n/** @public */\n\nvar edtrFormula = 'M9.796061,6.84358189 L9.546061,9.73358189 L11.366061,9.73358189 C11.9183457,9.73358189 12.366061,10.1812971 12.366061,10.7335819 L12.366061,10.7335819 C12.366061,11.2858666 11.9183457,11.7335819 11.366061,11.7335819 L9.366061,11.7335819 L8.926061,16.8035819 C8.726061,19.0035819 6.786061,20.6335819 4.586061,20.4335819 C3.95133688,20.3777262 3.21218763,20.0027937 2.36861326,19.3087844 L2.3686112,19.3087869 C1.93754177,18.9541458 1.8755844,18.3172015 2.23022554,17.8861321 C2.25098506,17.8608987 2.27295601,17.8366869 2.296061,17.8135819 L2.296061,17.8135819 C2.68943711,17.4202058 3.31879167,17.3943638 3.74309403,17.7541652 C4.42335978,18.3310001 5.0243456,18.5341427 5.546061,18.3635819 C6.326061,18.1235819 6.876061,17.4335819 6.946061,16.6235819 L7.366061,11.7335819 L5.366061,11.7335819 C4.81377625,11.7335819 4.366061,11.2858666 4.366061,10.7335819 L4.366061,10.7335819 C4.366061,10.1812971 4.81377625,9.73358189 5.366061,9.73358189 L7.546061,9.73358189 L7.816061,6.66358189 C8.006061,4.46358189 9.936061,2.83358189 12.146061,3.01358189 C12.7876823,3.06959645 13.5343235,3.45039469 14.3859845,4.15597662 L14.3859731,4.15599041 C14.8171452,4.51320676 14.8770982,5.1523219 14.5198819,5.58349402 C14.4997127,5.60783893 14.4784158,5.63122712 14.456061,5.65358189 L14.456061,5.65358189 C14.077745,6.03189793 13.4644763,6.03223098 13.0857495,5.65432608 C12.6951429,5.26458609 12.3219165,5.05433484 11.966061,5.02358189 C10.866061,4.92358189 9.896061,5.73358189 9.796061,6.84358189 Z M20.841061,12.6785819 L20.841061,12.6785819 C20.4517003,12.2892211 19.8204217,12.2892211 19.431061,12.6785819 L17.306061,14.8035819 L15.1860786,12.6835995 C14.7931405,12.2906614 14.1567565,12.2884206 13.761061,12.6785819 L13.761061,12.6785819 C13.3689485,13.0652103 13.3645027,13.6965046 13.7511312,14.0886171 C13.7527745,14.0902837 13.7544236,14.0919445 13.7560786,14.0935995 L15.896061,16.2335819 L13.7610785,18.3385997 C13.3717179,18.7224956 13.3672879,19.3493438 13.7511838,19.7387045 C13.7544529,19.7420201 13.7577454,19.7453127 13.761061,19.7485819 L13.761061,19.7485819 C14.1567565,20.1387432 14.7931405,20.1365024 15.1860786,19.7435643 L17.306061,17.6235819 L19.431061,19.7485819 C19.8204217,20.1379426 20.4517003,20.1379426 20.841061,19.7485819 L20.841061,19.7485819 C21.2290435,19.3605994 21.2290435,18.7315555 20.841061,18.343573 C20.8402306,18.3427426 20.8393988,18.3419137 20.8385654,18.3410863 L18.716061,16.2335819 L20.8435477,14.0910599 C21.2319346,13.6999283 21.2308227,13.0683435 20.841061,12.6785819 Z';\n/** @public */\n\nvar edtrText = 'M2.5 5.5C2.5 6.33 3.17 7 4 7h3.5v10.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V7H14c.83 0 1.5-.67 1.5-1.5S14.83 4 14 4H4c-.83 0-1.5.67-1.5 1.5zM20 9h-6c-.83 0-1.5.67-1.5 1.5S13.17 12 14 12h1.5v5.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V12H20c.83 0 1.5-.67 1.5-1.5S20.83 9 20 9z';\n/** @public */\n\nvar edtrLink = 'M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1zm2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1z';\n/** @public */\n\nvar edtrQuote = 'M7.17 17c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94zm10 0c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94z';\n/** @public */\n\nvar edtrListNumbered = 'M8 7h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm12 10H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zm0-6H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zM4.5 16h-2c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5h-.5c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h2c.28 0 .5-.22.5-.5v-3c0-.28-.22-.5-.5-.5zm-2-11H3v2.5c0 .28.22.5.5.5s.5-.22.5-.5v-3c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5s.22.5.5.5zm2 5h-2c-.28 0-.5.22-.5.5s.22.5.5.5h1.3l-1.68 1.96c-.08.09-.12.21-.12.32v.22c0 .28.22.5.5.5h2c.28 0 .5-.22.5-.5s-.22-.5-.5-.5H3.2l1.68-1.96c.08-.09.12-.21.12-.32v-.22c0-.28-.22-.5-.5-.5z';\n/** @public */\n\nvar edtrListBullets = 'M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM8 19h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm0-6h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zM7 6c0 .55.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrItalic = 'M10 5.5c0 .83.67 1.5 1.5 1.5h.71l-3.42 8H7.5c-.83 0-1.5.67-1.5 1.5S6.67 18 7.5 18h5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5h-.71l3.42-8h1.29c.83 0 1.5-.67 1.5-1.5S17.33 4 16.5 4h-5c-.83 0-1.5.67-1.5 1.5z';\n/** @public */\n\nvar edtrColorText = 'M10.63 3.93L6.06 15.58c-.27.68.23 1.42.97 1.42.43 0 .82-.27.98-.68L8.87 14h6.25l.87 2.32c.15.41.54.68.98.68.73 0 1.24-.74.97-1.42L13.37 3.93C13.14 3.37 12.6 3 12 3c-.6 0-1.15.37-1.37.93zM9.62 12L12 5.67 14.38 12H9.62z';\n/** @public */\n\nvar edtrFill = 'M16.56 8.94L8.32.7C7.93.31 7.3.31 6.91.7c-.39.39-.39 1.02 0 1.41l1.68 1.68-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z';\n/** @public */\n\nvar edtrBold = 'M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H8c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h5.78c2.07 0 3.96-1.69 3.97-3.77.01-1.53-.85-2.84-2.15-3.44zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z';\n/** @public */\n\nvar edtrPlus = 'M12,2 C6.48,2 2,6.48 2,12 C2,17.52 6.48,22 12,22 C17.52,22 22,17.52 22,12 C22,6.48 17.52,2 12,2 Z M16,13 L13,13 L13,16 C13,16.55 12.55,17 12,17 C11.45,17 11,16.55 11,16 L11,13 L8,13 C7.45,13 7,12.55 7,12 C7,11.45 7.45,11 8,11 L11,11 L11,8 C11,7.45 11.45,7 12,7 C12.55,7 13,7.45 13,8 L13,11 L16,11 C16.55,11 17,11.45 17,12 C17,12.55 16.55,13 16,13 Z';\n/** @public */\n\nvar edtrSearch = 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z';\n/** @public */\n\nvar edtrDefaultPlugin = 'M20.6190476,11.5238095 L19.1904762,11.5238095 L19.1904762,7.71428571 C19.1904762,6.65714286 18.3333333,5.80952381 17.2857143,5.80952381 L13.4761905,5.80952381 L13.4761905,4.38095238 C13.4761905,3.06598869 12.4102018,2 11.0952381,2 C9.78027441,2 8.71428571,3.06598869 8.71428571,4.38095238 L8.71428571,5.80952381 L4.9047619,5.80952381 C3.85279095,5.80952381 3,6.66231476 3,7.71428571 L3,11.3333333 L4.42857143,11.3333333 C5.85714286,11.3333333 7,12.4761905 7,13.9047619 C7,15.3333333 5.85714286,16.4761905 4.42857143,16.4761905 L3,16.4761905 L3,20.0952381 C3,21.147209 3.85279095,22 4.9047619,22 L8.52380952,22 L8.52380952,20.5714286 C8.52380952,19.1428571 9.66666667,18 11.0952381,18 C12.5238095,18 13.6666667,19.1428571 13.6666667,20.5714286 L13.6666667,22 L17.2857143,22 C18.3376852,22 19.1904762,21.147209 19.1904762,20.0952381 L19.1904762,16.2857143 L20.6190476,16.2857143 C21.9340113,16.2857143 23,15.2197256 23,13.9047619 C23,12.5897982 21.9340113,11.5238095 20.6190476,11.5238095 Z';\n/** @public */\n\nvar edtrDragHandle = 'M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z';\n\n/** @public */\n\nvar defaultRendererTheme = {\n backgroundColor: '#ffffff',\n color: '#333333',\n primary: {\n color: '#ffffff',\n background: '#337ab7'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n }\n};\n/**\r\n * React Hook for the renderer theming\r\n *\r\n * @returns An object containing the current {@link RendererTheme | renderer theme} and {@link RendererUiTheme | renderer UI theme}\r\n * @public\r\n */\n\nfunction useRendererTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link RendererThemeProps} to the current theme of the specified renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link RendererThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createRendererUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.renderer), theme.rendererUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of a renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useRendererUiTheme(key, createDefaultTheme) {\n var theme = useRendererTheme();\n return createRendererUiTheme(key, createDefaultTheme)(theme);\n}\n\nvar defaultTheme = {\n editor: defaultEditorTheme,\n editorUi: {},\n renderer: defaultRendererTheme,\n rendererUi: {}\n}; // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to hydrate the context for the {@link Theme | Theme}\r\n *\r\n * @remarks\r\n * You probably don't want to use this component directly since it is already used by the core.\r\n * If you want to override the theme in some plugin, you probably want to use {@link ThemeProvider | ThemeProvider} instead.\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | default Theme}, and children\r\n * @public\r\n */\n\nfunction RootThemeProvider(props) {\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n/**\r\n * Context used for the {@link Theme | Theme}, see also {@link https://styled-components.com/docs/advanced#theming | Theming }\r\n *\r\n * @public\r\n */\n\nvar ThemeContext = ThemeContext$1;\n/**\r\n * React Hook to get the current {@link Theme | Theme}\r\n *\r\n * @returns The current {@link Theme | Theme}\r\n * @public\r\n */\n\nfunction useTheme() {\n return useContext(ThemeContext);\n} // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to override the current {@link Theme | theme}\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | current Theme}, and children\r\n * @public\r\n */\n\nfunction ThemeProvider(props) {\n var defaultTheme = useTheme();\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [defaultTheme, props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n\n/**\r\n * Provides utils for the User Interface\r\n *\r\n * @packageDocumentation\r\n */\n/**\r\n * Re-export of {@link https://styled-components.com/docs/api#primary | `styled` in `styled-components` }\r\n *\r\n * @public\r\n */\n\nvar styled = StyledComponents__default;\n\nexport { EdtrIcon, Icon, RootThemeProvider, ThemeContext, ThemeProvider, createEditorUiTheme, createIcon, createRendererUiTheme, defaultEditorTheme, defaultRendererTheme, edtrAlignBlock, edtrAlignCenter, edtrAlignLeft, edtrAlignRight, edtrBold, edtrClose, edtrColorText, edtrDefaultPlugin, edtrDragHandle, edtrFill, edtrFormula, edtrItalic, edtrLink, edtrListBullets, edtrListNumbered, edtrPlus, edtrQuote, edtrSearch, edtrText, styled, useEditorTheme, useEditorUiTheme, useRendererTheme, useRendererUiTheme, useTheme };\n\n","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import _extends from '@babel/runtime/helpers/esm/extends';\nimport _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose';\nimport _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';\nimport _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';\nimport { createElement, Component } from 'react';\nimport { oneOfType, func, shape, any, number, object, bool, string } from 'prop-types';\n\nvar isIE = !!document.documentElement.currentStyle ;\nvar HIDDEN_TEXTAREA_STYLE = {\n 'min-height': '0',\n 'max-height': 'none',\n height: '0',\n visibility: 'hidden',\n overflow: 'hidden',\n position: 'absolute',\n 'z-index': '-1000',\n top: '0',\n right: '0'\n};\nvar SIZING_STYLE = ['letter-spacing', 'line-height', 'font-family', 'font-weight', 'font-size', 'font-style', 'tab-size', 'text-rendering', 'text-transform', 'width', 'text-indent', 'padding-top', 'padding-right', 'padding-bottom', 'padding-left', 'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width', 'box-sizing'];\nvar computedStyleCache = {};\nvar hiddenTextarea = document.createElement('textarea');\n\nvar forceHiddenStyles = function forceHiddenStyles(node) {\n Object.keys(HIDDEN_TEXTAREA_STYLE).forEach(function (key) {\n node.style.setProperty(key, HIDDEN_TEXTAREA_STYLE[key], 'important');\n });\n};\n\n{\n hiddenTextarea.setAttribute('tab-index', '-1');\n hiddenTextarea.setAttribute('aria-hidden', 'true');\n forceHiddenStyles(hiddenTextarea);\n}\n\nfunction calculateNodeHeight(uiTextNode, uid, useCache, minRows, maxRows) {\n if (useCache === void 0) {\n useCache = false;\n }\n\n if (minRows === void 0) {\n minRows = null;\n }\n\n if (maxRows === void 0) {\n maxRows = null;\n }\n\n if (hiddenTextarea.parentNode === null) {\n document.body.appendChild(hiddenTextarea);\n } // Copy all CSS properties that have an impact on the height of the content in\n // the textbox\n\n\n var nodeStyling = calculateNodeStyling(uiTextNode, uid, useCache);\n\n if (nodeStyling === null) {\n return null;\n }\n\n var paddingSize = nodeStyling.paddingSize,\n borderSize = nodeStyling.borderSize,\n boxSizing = nodeStyling.boxSizing,\n sizingStyle = nodeStyling.sizingStyle; // Need to have the overflow attribute to hide the scrollbar otherwise\n // text-lines will not calculated properly as the shadow will technically be\n // narrower for content\n\n Object.keys(sizingStyle).forEach(function (key) {\n hiddenTextarea.style[key] = sizingStyle[key];\n });\n forceHiddenStyles(hiddenTextarea);\n hiddenTextarea.value = uiTextNode.value || uiTextNode.placeholder || 'x';\n var minHeight = -Infinity;\n var maxHeight = Infinity;\n var height = hiddenTextarea.scrollHeight;\n\n if (boxSizing === 'border-box') {\n // border-box: add border, since height = content + padding + border\n height = height + borderSize;\n } else if (boxSizing === 'content-box') {\n // remove padding, since height = content\n height = height - paddingSize;\n } // measure height of a textarea with a single row\n\n\n hiddenTextarea.value = 'x';\n var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize; // Stores the value's rows count rendered in `hiddenTextarea`,\n // regardless if `maxRows` or `minRows` props are passed\n\n var valueRowCount = Math.floor(height / singleRowHeight);\n\n if (minRows !== null) {\n minHeight = singleRowHeight * minRows;\n\n if (boxSizing === 'border-box') {\n minHeight = minHeight + paddingSize + borderSize;\n }\n\n height = Math.max(minHeight, height);\n }\n\n if (maxRows !== null) {\n maxHeight = singleRowHeight * maxRows;\n\n if (boxSizing === 'border-box') {\n maxHeight = maxHeight + paddingSize + borderSize;\n }\n\n height = Math.min(maxHeight, height);\n }\n\n var rowCount = Math.floor(height / singleRowHeight);\n return {\n height: height,\n minHeight: minHeight,\n maxHeight: maxHeight,\n rowCount: rowCount,\n valueRowCount: valueRowCount\n };\n}\n\nfunction calculateNodeStyling(node, uid, useCache) {\n if (useCache === void 0) {\n useCache = false;\n }\n\n if (useCache && computedStyleCache[uid]) {\n return computedStyleCache[uid];\n }\n\n var style = window.getComputedStyle(node);\n\n if (style === null) {\n return null;\n }\n\n var sizingStyle = SIZING_STYLE.reduce(function (obj, name) {\n obj[name] = style.getPropertyValue(name);\n return obj;\n }, {});\n var boxSizing = sizingStyle['box-sizing']; // probably node is detached from DOM, can't read computed dimensions\n\n if (boxSizing === '') {\n return null;\n } // IE (Edge has already correct behaviour) returns content width as computed width\n // so we need to add manually padding and border widths\n\n\n if (isIE && boxSizing === 'border-box') {\n sizingStyle.width = parseFloat(sizingStyle.width) + parseFloat(style['border-right-width']) + parseFloat(style['border-left-width']) + parseFloat(style['padding-right']) + parseFloat(style['padding-left']) + 'px';\n }\n\n var paddingSize = parseFloat(sizingStyle['padding-bottom']) + parseFloat(sizingStyle['padding-top']);\n var borderSize = parseFloat(sizingStyle['border-bottom-width']) + parseFloat(sizingStyle['border-top-width']);\n var nodeInfo = {\n sizingStyle: sizingStyle,\n paddingSize: paddingSize,\n borderSize: borderSize,\n boxSizing: boxSizing\n };\n\n if (useCache) {\n computedStyleCache[uid] = nodeInfo;\n }\n\n return nodeInfo;\n}\n\nvar purgeCache = function purgeCache(uid) {\n delete computedStyleCache[uid];\n};\n\nvar noop = function noop() {};\n\nvar uid = 0;\n\nvar TextareaAutosize =\n/*#__PURE__*/\nfunction (_React$Component) {\n _inheritsLoose(TextareaAutosize, _React$Component);\n\n function TextareaAutosize(props) {\n var _this;\n\n _this = _React$Component.call(this, props) || this;\n\n _this._onRef = function (node) {\n _this._ref = node;\n var inputRef = _this.props.inputRef;\n\n if (typeof inputRef === 'function') {\n inputRef(node);\n return;\n }\n\n inputRef.current = node;\n };\n\n _this._onChange = function (event) {\n if (!_this._controlled) {\n _this._resizeComponent();\n }\n\n _this.props.onChange(event, _assertThisInitialized(_this));\n };\n\n _this._resizeComponent = function (callback) {\n if (callback === void 0) {\n callback = noop;\n }\n\n var nodeHeight = calculateNodeHeight(_this._ref, _this._uid, _this.props.useCacheForDOMMeasurements, _this.props.minRows, _this.props.maxRows);\n\n if (nodeHeight === null) {\n callback();\n return;\n }\n\n var height = nodeHeight.height,\n minHeight = nodeHeight.minHeight,\n maxHeight = nodeHeight.maxHeight,\n rowCount = nodeHeight.rowCount,\n valueRowCount = nodeHeight.valueRowCount;\n _this.rowCount = rowCount;\n _this.valueRowCount = valueRowCount;\n\n if (_this.state.height !== height || _this.state.minHeight !== minHeight || _this.state.maxHeight !== maxHeight) {\n _this.setState({\n height: height,\n minHeight: minHeight,\n maxHeight: maxHeight\n }, callback);\n\n return;\n }\n\n callback();\n };\n\n _this.state = {\n height: props.style && props.style.height || 0,\n minHeight: -Infinity,\n maxHeight: Infinity\n };\n _this._uid = uid++;\n _this._controlled = props.value !== undefined;\n _this._resizeLock = false;\n return _this;\n }\n\n var _proto = TextareaAutosize.prototype;\n\n _proto.render = function render() {\n var _this$props = this.props,\n _inputRef = _this$props.inputRef,\n _maxRows = _this$props.maxRows,\n _minRows = _this$props.minRows,\n _onHeightChange = _this$props.onHeightChange,\n _useCacheForDOMMeasurements = _this$props.useCacheForDOMMeasurements,\n props = _objectWithoutPropertiesLoose(_this$props, [\"inputRef\", \"maxRows\", \"minRows\", \"onHeightChange\", \"useCacheForDOMMeasurements\"]);\n\n props.style = _extends({}, props.style, {\n height: this.state.height\n });\n var maxHeight = Math.max(props.style.maxHeight || Infinity, this.state.maxHeight);\n\n if (maxHeight < this.state.height) {\n props.style.overflow = 'hidden';\n }\n\n return createElement(\"textarea\", _extends({}, props, {\n onChange: this._onChange,\n ref: this._onRef\n }));\n };\n\n _proto.componentDidMount = function componentDidMount() {\n var _this2 = this;\n\n this._resizeComponent(); // Working around Firefox bug which runs resize listeners even when other JS is running at the same moment\n // causing competing rerenders (due to setState in the listener) in React.\n // More can be found here - facebook/react#6324\n\n\n this._resizeListener = function () {\n if (_this2._resizeLock) {\n return;\n }\n\n _this2._resizeLock = true;\n\n _this2._resizeComponent(function () {\n _this2._resizeLock = false;\n });\n };\n\n window.addEventListener('resize', this._resizeListener);\n };\n\n _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {\n if (prevProps !== this.props) {\n this._resizeComponent();\n }\n\n if (this.state.height !== prevState.height) {\n this.props.onHeightChange(this.state.height, this);\n }\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n window.removeEventListener('resize', this._resizeListener);\n purgeCache(this._uid);\n };\n\n return TextareaAutosize;\n}(Component);\n\nTextareaAutosize.defaultProps = {\n inputRef: noop,\n onChange: noop,\n onHeightChange: noop,\n useCacheForDOMMeasurements: false\n};\nprocess.env.NODE_ENV !== \"production\" ? TextareaAutosize.propTypes = {\n inputRef: oneOfType([func, shape({\n current: any\n })]),\n maxRows: number,\n minRows: number,\n onChange: func,\n onHeightChange: func,\n style: object,\n useCacheForDOMMeasurements: bool,\n value: string\n} : void 0;\n\nexport default TextareaAutosize;\n","import { styled, useEditorUiTheme, Icon, faPlus, faTimes } from '@edtr-io/ui';\nexport { styled } from '@edtr-io/ui';\nimport { createElement, Component, forwardRef, useState, useCallback, useEffect } from 'react';\nimport { IgnoreKeys, useScope, ScopeContext } from '@edtr-io/core';\nimport TextareaAutosize from 'react-textarea-autosize';\n\n/** @public */\n\nvar EditorBottomToolbar = /*#__PURE__*/styled.div(function () {\n var theme = useEditorUiTheme('bottomToolbar', function (theme) {\n return {\n backgroundColor: theme.backgroundColor,\n color: theme.color\n };\n });\n return {\n boxShadow: '0 2px 4px 0 rgba(0,0,0,0.50)',\n backgroundColor: theme.backgroundColor,\n color: theme.color,\n borderRadius: '4px',\n position: 'fixed',\n left: '50%',\n transform: 'translate(-50%,-50%)',\n bottom: '0',\n zIndex: 90,\n whiteSpace: 'nowrap'\n };\n});\n\n/** @public */\n\nvar EditorButton = /*#__PURE__*/styled.button(function () {\n var theme = useEditorUiTheme('button', function (theme) {\n return {\n backgroundColor: theme.backgroundColor,\n color: theme.color,\n borderColor: theme.color,\n hoverBackgroundColor: 'rgba(0,0,0,0.50)',\n hoverColor: theme.primary.background,\n hoverBorderColor: theme.primary.background\n };\n });\n return {\n margin: '3px',\n backgroundColor: theme.backgroundColor,\n outline: 'none',\n border: 'none',\n boxShadow: '0 1px 2px 0 rgba(0,0,0,0.50)',\n color: theme.color,\n borderRadius: '4px',\n cursor: 'pointer',\n '&:hover': {\n backgroundColor: theme.hoverBackgroundColor,\n color: theme.hoverColor,\n borderColor: theme.hoverBorderColor\n }\n };\n});\n\nvar useEditorCheckboxTheme = function useEditorCheckboxTheme() {\n return useEditorUiTheme('checkbox', function (theme) {\n return {\n boxSelectedColor: theme.backgroundColor,\n boxDeselectedColor: 'transparent',\n color: theme.backgroundColor\n };\n });\n};\n\nvar Container = /*#__PURE__*/styled.label(function () {\n var theme = useEditorCheckboxTheme();\n return {\n color: theme.color\n };\n});\nvar ToggleContainer = /*#__PURE__*/styled.div(function () {\n var theme = useEditorCheckboxTheme();\n return {\n cursor: 'pointer',\n margin: '0 5px -1px 5px',\n border: \"2px solid \" + theme.color,\n borderRadius: '15%',\n width: '15px',\n height: '15px',\n display: 'inline-block',\n backgroundColor: theme.boxDeselectedColor\n };\n});\nvar Label = /*#__PURE__*/styled.span({\n width: '5%'\n});\nvar Toggle = /*#__PURE__*/styled.div(function (_ref) {\n var value = _ref.value;\n var theme = useEditorCheckboxTheme();\n return {\n opacity: value ? 1 : 0,\n content: '',\n position: 'absolute',\n fontWeight: 'bold',\n margin: '3px 0 0 2px',\n width: '10px',\n height: '5px',\n border: \"2px solid \" + theme.boxSelectedColor,\n borderTop: 'none',\n borderRight: 'none',\n transform: 'rotate(-45deg)',\n zIndex: 1000\n };\n});\n/** @public */\n\nfunction EditorCheckbox(_ref2) {\n var checked = _ref2.checked,\n onChange = _ref2.onChange,\n label = _ref2.label;\n return createElement(Container, null, createElement(Label, null, label), \"=\", createElement(ToggleContainer, {\n onClick: function onClick() {\n if (onChange) {\n onChange(!checked);\n }\n }\n }, createElement(Toggle, {\n value: checked\n })));\n}\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nvar AddButtonComponent = /*#__PURE__*/styled.button({\n margin: '5px 2% 5px 2%',\n width: '96%',\n borderRadius: '10px',\n backgroundColor: 'white',\n textAlign: 'left',\n color: 'lightgrey',\n minHeight: '50px',\n border: '2px solid lightgrey',\n outline: 'none',\n '&:hover': {\n border: '3px solid #007ec1',\n color: '#007ec1'\n }\n});\n/**\r\n * @param props - Props\r\n * @internal\r\n */\n\nfunction AddButton(props) {\n return createElement(AddButtonComponent, {\n title: props.title,\n onMouseDown: props.onClick\n }, createElement(Icon, {\n icon: faPlus\n }), \" \", props.children);\n}\nvar AnswerContainer = /*#__PURE__*/styled.div({\n marginBottom: '10px',\n display: 'flex',\n alignItems: 'center'\n});\nvar CheckboxContainer = /*#__PURE__*/styled.div({\n width: '10%',\n textAlign: 'center',\n marginRight: '10px',\n fontWeight: 'bold'\n});\nvar RemoveButton = /*#__PURE__*/styled.button({\n borderRadius: '50%',\n outline: 'none',\n background: 'white',\n zIndex: 20,\n \"float\": 'right',\n transform: 'translate(50%, -40%)',\n '&:hover': {\n border: '3px solid #007ec1',\n color: '#007ec1'\n }\n});\nvar FeedbackField = /*#__PURE__*/styled.div({\n paddingLeft: '20px',\n paddingBottom: '10px',\n paddingTop: '10px',\n marginTop: '5px'\n});\nvar FramedContainer = /*#__PURE__*/styled.div(function (_ref) {\n var _defaultBorders, _focusedBorders;\n\n var focused = _ref.focused;\n var defaultBorders = (_defaultBorders = {\n border: '2px solid lightgrey'\n }, _defaultBorders[\"\" + RemoveButton] = {\n border: '2px solid lightgrey',\n color: 'lightgrey'\n }, _defaultBorders[\"\" + FeedbackField] = {\n borderTop: '2px solid lightgrey'\n }, _defaultBorders);\n var focusedBorders = (_focusedBorders = {\n border: '3px solid #007ec1'\n }, _focusedBorders[\"\" + RemoveButton] = {\n border: '3px solid #007ec1',\n color: '#007ec1'\n }, _focusedBorders[\"\" + FeedbackField] = {\n borderTop: '2px solid #007ec1'\n }, _focusedBorders);\n return _extends({\n width: '100%',\n marginLeft: '10px',\n borderRadius: '10px'\n }, focused ? focusedBorders : defaultBorders, {\n '&:focus-within': focusedBorders\n });\n});\nvar AnswerField = /*#__PURE__*/styled.div({\n paddingLeft: '20px',\n paddingTop: '10px'\n});\nvar Container$1 = /*#__PURE__*/styled.div(function (_ref2) {\n var isRadio = _ref2.isRadio,\n checked = _ref2.checked;\n return {\n cursor: 'pointer',\n border: checked ? isRadio ? '5px solid #007ec1' : '2px solid #007ec1' : '2px solid lightgray',\n borderRadius: isRadio ? '50%' : '15%',\n width: '20px',\n height: '20px',\n display: 'inline-block',\n verticalAlign: 'middle',\n backgroundColor: checked && !isRadio ? '#007ec1' : 'white'\n };\n});\nvar Tick = /*#__PURE__*/styled.div(function (_ref3) {\n var checked = _ref3.checked;\n return {\n opacity: checked ? 1 : 0,\n content: '',\n position: 'absolute',\n fontWeight: 'bold',\n width: '15px',\n height: '10px',\n border: '3px solid white',\n borderTop: 'none',\n borderRight: 'none',\n borderRadius: '2px',\n zIndex: 10,\n transform: 'rotate(-45deg)'\n };\n});\n/** @internal */\n\nvar CheckElement = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(CheckElement, _React$Component);\n\n function CheckElement() {\n return _React$Component.apply(this, arguments) || this;\n }\n\n var _proto = CheckElement.prototype;\n\n _proto.render = function render() {\n var _this$props = this.props,\n isRadio = _this$props.isRadio,\n isActive = _this$props.isActive,\n handleChange = _this$props.handleChange;\n return createElement(Container$1, {\n isRadio: isRadio,\n checked: isActive,\n onClick: function onClick(e) {\n handleChange(e);\n }\n }, isRadio ? null : createElement(Tick, {\n checked: isActive\n }));\n };\n\n return CheckElement;\n}(Component);\n/**\r\n * @param props - Props\r\n * @internal\r\n */\n\nfunction InteractiveAnswer(props) {\n return createElement(AnswerContainer, null, createElement(CheckboxContainer, null, \"Richtig?\", createElement(CheckElement, {\n isRadio: props.isRadio || false,\n isActive: props.isActive || false,\n handleChange: props.handleChange\n })), createElement(FramedContainer, {\n focused: props.answerID === props.focusedElement || props.feedbackID === props.focusedElement\n }, createElement(AnswerField, null, props.answer), createElement(RemoveButton, {\n onClick: props.remove\n }, createElement(Icon, {\n icon: faTimes\n })), createElement(FeedbackField, null, props.feedback)));\n}\n\nfunction useEditorInputTheme() {\n return useEditorUiTheme('input', function (theme) {\n return {\n color: theme.backgroundColor,\n backgroundColor: 'transparent',\n highlightColor: theme.primary.background\n };\n });\n}\n\nvar Label$1 = /*#__PURE__*/styled.label(function (_ref) {\n var width = _ref.width;\n var theme = useEditorInputTheme();\n return {\n width: width,\n color: theme.color\n };\n});\nvar Input = /*#__PURE__*/styled.input(function (_ref2) {\n var textWidth = _ref2.textWidth;\n var theme = useEditorInputTheme();\n return {\n backgroundColor: theme.backgroundColor,\n border: 'none',\n width: textWidth,\n borderBottom: \"2px solid \" + theme.color,\n color: theme.color,\n paddingLeft: '10px',\n '&:focus': {\n outline: 'none',\n borderBottom: \"2px solid \" + theme.highlightColor\n }\n };\n});\n/** @public */\n\nvar EditorInput = /*#__PURE__*/forwardRef(function EditorInput(_ref3, ref) {\n var label = _ref3.label,\n props = _objectWithoutPropertiesLoose(_ref3, [\"label\"]);\n\n return createElement(Label$1, {\n width: props.width\n }, label ? label + \":\" : '', createElement(Input, Object.assign({\n textWidth: props.inputWidth\n }, props, {\n ref: ref\n })));\n});\n\n/** @public */\n\nvar EditorInlineSettings = /*#__PURE__*/styled.div({\n marginTop: '15px'\n});\n\nvar Textarea = /*#__PURE__*/styled(TextareaAutosize)({\n minHeight: '100px',\n width: '100%',\n margin: 'auto',\n padding: '10px',\n resize: 'none',\n fontFamily: 'Menlo, Monaco, \"Courier New\", monospace',\n border: 'none',\n outline: 'none',\n boxShadow: '0 1px 1px 0 rgba(0,0,0,0.50)',\n '&::-webkit-input-placeholder': {\n color: 'rgba(0,0,0,0.5)'\n }\n});\nvar StyledIgnoreKeys = /*#__PURE__*/styled(IgnoreKeys)({\n width: '100%'\n});\n/** @public */\n\nvar EditorTextarea = /*#__PURE__*/forwardRef(function EditorTextarea(props, ref) {\n return createElement(StyledIgnoreKeys, {\n except: ['up', 'down']\n }, createElement(Textarea, Object.assign({}, props, {\n inputRef: ref || undefined,\n onKeyDown: function onKeyDown(e) {\n if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') {\n return;\n }\n\n if (ref && typeof ref !== 'function' && ref.current) {\n var _ref$current = ref.current,\n selectionStart = _ref$current.selectionStart,\n selectionEnd = _ref$current.selectionEnd,\n value = _ref$current.value;\n\n if (selectionStart !== selectionEnd) {\n return;\n }\n\n if (e.key === 'ArrowUp' && selectionStart !== 0) {\n e.stopPropagation();\n }\n\n if (e.key === 'ArrowDown' && selectionStart !== value.length) {\n e.stopPropagation();\n }\n }\n }\n })));\n});\n\nvar NoClickArea = /*#__PURE__*/styled.div(function (props) {\n return {\n pointerEvents: props.active ? 'unset' : 'none',\n position: 'relative'\n };\n});\nvar Overlay = /*#__PURE__*/styled.div(function (props) {\n return {\n display: props.active ? 'none' : undefined,\n position: 'absolute',\n width: '100%',\n height: '100%',\n top: 0,\n backgroundColor: props.blur ? 'rgba(255,255,255,0.8)' : undefined,\n zIndex: 10\n };\n});\nvar ButtonWrapper = /*#__PURE__*/styled.div({\n width: '100%',\n height: '100%',\n textAlign: 'center',\n display: 'flex'\n});\nvar ActivateButton = /*#__PURE__*/styled.button({\n pointerEvents: 'all',\n color: 'white',\n border: 'none',\n borderRadius: '5px',\n padding: '2px 10px',\n textAlign: 'center',\n outline: 'none',\n backgroundColor: 'rgb(0,126,193)',\n zIndex: 10,\n margin: 'auto'\n});\n/**\r\n * @param props - Props\r\n * @internal\r\n */\n\nfunction PreviewOverlay(props) {\n var _React$useState = useState(false),\n active = _React$useState[0],\n setActiveState = _React$useState[1];\n\n var scope = useScope();\n var onChange = props.onChange;\n var setActive = useCallback(function (active) {\n if (typeof onChange === 'function') {\n onChange(active);\n }\n\n setActiveState(active);\n }, [onChange]);\n useEffect(function () {\n if (!props.focused && active) {\n setActive(false);\n }\n }, [props.focused, active, setActive]);\n return createElement(NoClickArea, {\n active: active\n }, createElement(Overlay, {\n blur: props.focused,\n active: active\n }, props.focused ? createElement(ButtonWrapper, null, createElement(ActivateButton, {\n onClick: function onClick() {\n setActive(true);\n }\n }, \"Aktivieren\")) : null), !props.editable ? createElement(ScopeContext.Provider, {\n value: {\n scope: scope,\n editable: false\n }\n }, props.children) : props.children, active ? createElement(ButtonWrapper, null, createElement(ActivateButton, {\n onClick: function onClick() {\n setActive(false);\n }\n }, \"Editieren\")) : null);\n}\n\nexport { AddButton, CheckElement, EditorBottomToolbar, EditorButton, EditorCheckbox, EditorInlineSettings, EditorInput, EditorTextarea, InteractiveAnswer, PreviewOverlay };\n\n","import StyledComponents__default, { ThemeContext as ThemeContext$1, ThemeProvider as ThemeProvider$1 } from 'styled-components';\nimport { mergeDeepRight, pick } from 'ramda';\nimport { useContext, createElement, useMemo } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nexport { faFileDownload } from '@fortawesome/free-solid-svg-icons/faFileDownload';\nexport { faFileArchive } from '@fortawesome/free-solid-svg-icons/faFileArchive';\nexport { faFileAudio } from '@fortawesome/free-solid-svg-icons/faFileAudio';\nexport { faCheckCircle } from '@fortawesome/free-solid-svg-icons/faCheckCircle';\nexport { faFileExcel } from '@fortawesome/free-solid-svg-icons/faFileExcel';\nexport { faFileImage } from '@fortawesome/free-solid-svg-icons/faFileImage';\nexport { faFilePdf } from '@fortawesome/free-solid-svg-icons/faFilePdf';\nexport { faSmile } from '@fortawesome/free-solid-svg-icons/faSmile';\nexport { faFileWord } from '@fortawesome/free-solid-svg-icons/faFileWord';\nexport { faFileVideo } from '@fortawesome/free-solid-svg-icons/faFileVideo';\nexport { faFilePowerpoint } from '@fortawesome/free-solid-svg-icons/faFilePowerpoint';\nexport { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';\nexport { faCut } from '@fortawesome/free-solid-svg-icons/faCut';\nexport { faCog } from '@fortawesome/free-solid-svg-icons/faCog';\nexport { faCopy } from '@fortawesome/free-solid-svg-icons/faCopy';\nexport { faFileAlt } from '@fortawesome/free-solid-svg-icons/faFileAlt';\nexport { faImages } from '@fortawesome/free-solid-svg-icons/faImages';\nexport { faPhotoVideo } from '@fortawesome/free-solid-svg-icons/faPhotoVideo';\nexport { faLink } from '@fortawesome/free-solid-svg-icons/faLink';\nexport { faMinus } from '@fortawesome/free-solid-svg-icons/faMinus';\nexport { faPaste } from '@fortawesome/free-solid-svg-icons/faPaste';\nexport { faPencilAlt } from '@fortawesome/free-solid-svg-icons/faPencilAlt';\nexport { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';\nexport { faSpinner } from '@fortawesome/free-solid-svg-icons/faSpinner';\nexport { faTable } from '@fortawesome/free-solid-svg-icons/faTable';\nexport { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';\nexport { faTrashAlt } from '@fortawesome/free-solid-svg-icons/faTrashAlt';\nexport { faFilm } from '@fortawesome/free-solid-svg-icons/faFilm';\nexport { faCaretSquareUp } from '@fortawesome/free-solid-svg-icons/faCaretSquareUp';\nexport { faCaretSquareDown } from '@fortawesome/free-solid-svg-icons/faCaretSquareDown';\nexport { faSortUp } from '@fortawesome/free-solid-svg-icons/faSortUp';\nexport { faSortDown } from '@fortawesome/free-solid-svg-icons/faSortDown';\nexport { faToolbox } from '@fortawesome/free-solid-svg-icons/faToolbox';\nexport { faEllipsisH } from '@fortawesome/free-solid-svg-icons/faEllipsisH';\nexport { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';\nexport { faCloudUploadAlt } from '@fortawesome/free-solid-svg-icons/faCloudUploadAlt';\nexport { faQuestionCircle } from '@fortawesome/free-solid-svg-icons/faQuestionCircle';\nexport { faAnchor } from '@fortawesome/free-solid-svg-icons/faAnchor';\nexport { faQuoteRight } from '@fortawesome/free-solid-svg-icons/faQuoteRight';\nexport { faEquals } from '@fortawesome/free-solid-svg-icons/faEquals';\nexport { faCubes } from '@fortawesome/free-solid-svg-icons/faCubes';\nexport { faCode } from '@fortawesome/free-solid-svg-icons/faCode';\nexport { faLightbulb } from '@fortawesome/free-solid-svg-icons/faLightbulb';\nexport { faKeyboard } from '@fortawesome/free-solid-svg-icons/faKeyboard';\nexport { faDotCircle } from '@fortawesome/free-solid-svg-icons/faDotCircle';\nexport { faCheckSquare } from '@fortawesome/free-solid-svg-icons/faCheckSquare';\nexport { faParagraph } from '@fortawesome/free-solid-svg-icons/faParagraph';\nexport { faRedoAlt } from '@fortawesome/free-solid-svg-icons/faRedoAlt';\nexport { faRandom } from '@fortawesome/free-solid-svg-icons/faRandom';\nexport { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons/faExternalLinkAlt';\nexport { faNewspaper } from '@fortawesome/free-solid-svg-icons/faNewspaper';\n\n/** @public */\n\nvar defaultEditorTheme = {\n primary: {\n color: '#ffffff',\n background: 'rgb(70, 155, 255)'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n },\n color: '#EEEEEE',\n backgroundColor: 'rgba(51,51,51,0.95)'\n};\n/**\r\n * React Hook for the editor theming\r\n *\r\n * @returns An object containing the current {@link EditorTheme | editor theme} and {@link EditorUiTheme | editor UI theme}\r\n * @public\r\n */\n\nfunction useEditorTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link EditorThemeProps} to the current theme of the specified editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link EditorThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createEditorUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.editor), theme.editorUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of an editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useEditorUiTheme(key, createDefaultTheme) {\n var theme = useEditorTheme();\n return createEditorUiTheme(key, createDefaultTheme)(theme);\n}\n\n/**\r\n * Font Awesome Icon component\r\n *\r\n * @param props - Most of {@link https://github.com/FortAwesome/react-fontawesome | FontAwesomeIconProps}\r\n * @public\r\n */\n\nfunction Icon(props) {\n var allowedProps = pick(['icon', 'mask', 'className', 'color', 'spin', 'pulse', 'border', 'fixedWidth', 'inverse', 'listItem', 'flip', 'size', 'pull', 'rotation', 'transform', 'symbol', 'style', 'tabIndex', 'title'], props);\n return createElement(FontAwesomeIcon, Object.assign({}, allowedProps));\n}\n/**\r\n * Creates an icon component\r\n *\r\n * @param i - The icon to use\r\n * @returns A component for the specified icon\r\n * @public\r\n */\n\nfunction createIcon(i) {\n return function I() {\n return createElement(Icon, {\n icon: i,\n size: \"4x\"\n });\n };\n}\nvar EdtrSVG = /*#__PURE__*/StyledComponents__default.svg({\n display: 'inline-block',\n verticalAlign: 'middle',\n overflow: 'hidden'\n});\n/**\r\n * Edtr.io icon component\r\n *\r\n * @param props - An Edtr.io icon definition and an optional className\r\n * @returns The icon\r\n * @public\r\n */\n\nfunction EdtrIcon(props) {\n return createElement(EdtrSVG, {\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n className: props.className\n }, createElement(\"path\", {\n fill: \"currentcolor\",\n d: props.icon\n }));\n}\n/** @public */\n\nvar edtrAlignBlock = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignCenter = 'M7 16c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zm-3 5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm3-5c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignRight = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zm-6-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignLeft = 'M14 15H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zm0-8H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zM4 13h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0 8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrClose = 'M18.3,5.71 C17.91,5.32 17.28,5.32 16.89,5.71 L12,10.59 L7.11,5.7 C6.72,5.31 6.09,5.31 5.7,5.7 C5.31,6.09 5.31,6.72 5.7,7.11 L10.59,12 L5.7,16.89 C5.31,17.28 5.31,17.91 5.7,18.3 C6.09,18.69 6.72,18.69 7.11,18.3 L12,13.41 L16.89,18.3 C17.28,18.69 17.91,18.69 18.3,18.3 C18.69,17.91 18.69,17.28 18.3,16.89 L13.41,12 L18.3,7.11 C18.68,6.73 18.68,6.09 18.3,5.71 Z';\n/** @public */\n\nvar edtrFormula = 'M9.796061,6.84358189 L9.546061,9.73358189 L11.366061,9.73358189 C11.9183457,9.73358189 12.366061,10.1812971 12.366061,10.7335819 L12.366061,10.7335819 C12.366061,11.2858666 11.9183457,11.7335819 11.366061,11.7335819 L9.366061,11.7335819 L8.926061,16.8035819 C8.726061,19.0035819 6.786061,20.6335819 4.586061,20.4335819 C3.95133688,20.3777262 3.21218763,20.0027937 2.36861326,19.3087844 L2.3686112,19.3087869 C1.93754177,18.9541458 1.8755844,18.3172015 2.23022554,17.8861321 C2.25098506,17.8608987 2.27295601,17.8366869 2.296061,17.8135819 L2.296061,17.8135819 C2.68943711,17.4202058 3.31879167,17.3943638 3.74309403,17.7541652 C4.42335978,18.3310001 5.0243456,18.5341427 5.546061,18.3635819 C6.326061,18.1235819 6.876061,17.4335819 6.946061,16.6235819 L7.366061,11.7335819 L5.366061,11.7335819 C4.81377625,11.7335819 4.366061,11.2858666 4.366061,10.7335819 L4.366061,10.7335819 C4.366061,10.1812971 4.81377625,9.73358189 5.366061,9.73358189 L7.546061,9.73358189 L7.816061,6.66358189 C8.006061,4.46358189 9.936061,2.83358189 12.146061,3.01358189 C12.7876823,3.06959645 13.5343235,3.45039469 14.3859845,4.15597662 L14.3859731,4.15599041 C14.8171452,4.51320676 14.8770982,5.1523219 14.5198819,5.58349402 C14.4997127,5.60783893 14.4784158,5.63122712 14.456061,5.65358189 L14.456061,5.65358189 C14.077745,6.03189793 13.4644763,6.03223098 13.0857495,5.65432608 C12.6951429,5.26458609 12.3219165,5.05433484 11.966061,5.02358189 C10.866061,4.92358189 9.896061,5.73358189 9.796061,6.84358189 Z M20.841061,12.6785819 L20.841061,12.6785819 C20.4517003,12.2892211 19.8204217,12.2892211 19.431061,12.6785819 L17.306061,14.8035819 L15.1860786,12.6835995 C14.7931405,12.2906614 14.1567565,12.2884206 13.761061,12.6785819 L13.761061,12.6785819 C13.3689485,13.0652103 13.3645027,13.6965046 13.7511312,14.0886171 C13.7527745,14.0902837 13.7544236,14.0919445 13.7560786,14.0935995 L15.896061,16.2335819 L13.7610785,18.3385997 C13.3717179,18.7224956 13.3672879,19.3493438 13.7511838,19.7387045 C13.7544529,19.7420201 13.7577454,19.7453127 13.761061,19.7485819 L13.761061,19.7485819 C14.1567565,20.1387432 14.7931405,20.1365024 15.1860786,19.7435643 L17.306061,17.6235819 L19.431061,19.7485819 C19.8204217,20.1379426 20.4517003,20.1379426 20.841061,19.7485819 L20.841061,19.7485819 C21.2290435,19.3605994 21.2290435,18.7315555 20.841061,18.343573 C20.8402306,18.3427426 20.8393988,18.3419137 20.8385654,18.3410863 L18.716061,16.2335819 L20.8435477,14.0910599 C21.2319346,13.6999283 21.2308227,13.0683435 20.841061,12.6785819 Z';\n/** @public */\n\nvar edtrText = 'M2.5 5.5C2.5 6.33 3.17 7 4 7h3.5v10.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V7H14c.83 0 1.5-.67 1.5-1.5S14.83 4 14 4H4c-.83 0-1.5.67-1.5 1.5zM20 9h-6c-.83 0-1.5.67-1.5 1.5S13.17 12 14 12h1.5v5.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V12H20c.83 0 1.5-.67 1.5-1.5S20.83 9 20 9z';\n/** @public */\n\nvar edtrLink = 'M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1zm2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1z';\n/** @public */\n\nvar edtrQuote = 'M7.17 17c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94zm10 0c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94z';\n/** @public */\n\nvar edtrListNumbered = 'M8 7h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm12 10H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zm0-6H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zM4.5 16h-2c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5h-.5c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h2c.28 0 .5-.22.5-.5v-3c0-.28-.22-.5-.5-.5zm-2-11H3v2.5c0 .28.22.5.5.5s.5-.22.5-.5v-3c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5s.22.5.5.5zm2 5h-2c-.28 0-.5.22-.5.5s.22.5.5.5h1.3l-1.68 1.96c-.08.09-.12.21-.12.32v.22c0 .28.22.5.5.5h2c.28 0 .5-.22.5-.5s-.22-.5-.5-.5H3.2l1.68-1.96c.08-.09.12-.21.12-.32v-.22c0-.28-.22-.5-.5-.5z';\n/** @public */\n\nvar edtrListBullets = 'M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM8 19h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm0-6h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zM7 6c0 .55.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrItalic = 'M10 5.5c0 .83.67 1.5 1.5 1.5h.71l-3.42 8H7.5c-.83 0-1.5.67-1.5 1.5S6.67 18 7.5 18h5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5h-.71l3.42-8h1.29c.83 0 1.5-.67 1.5-1.5S17.33 4 16.5 4h-5c-.83 0-1.5.67-1.5 1.5z';\n/** @public */\n\nvar edtrColorText = 'M10.63 3.93L6.06 15.58c-.27.68.23 1.42.97 1.42.43 0 .82-.27.98-.68L8.87 14h6.25l.87 2.32c.15.41.54.68.98.68.73 0 1.24-.74.97-1.42L13.37 3.93C13.14 3.37 12.6 3 12 3c-.6 0-1.15.37-1.37.93zM9.62 12L12 5.67 14.38 12H9.62z';\n/** @public */\n\nvar edtrFill = 'M16.56 8.94L8.32.7C7.93.31 7.3.31 6.91.7c-.39.39-.39 1.02 0 1.41l1.68 1.68-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z';\n/** @public */\n\nvar edtrBold = 'M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H8c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h5.78c2.07 0 3.96-1.69 3.97-3.77.01-1.53-.85-2.84-2.15-3.44zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z';\n/** @public */\n\nvar edtrPlus = 'M12,2 C6.48,2 2,6.48 2,12 C2,17.52 6.48,22 12,22 C17.52,22 22,17.52 22,12 C22,6.48 17.52,2 12,2 Z M16,13 L13,13 L13,16 C13,16.55 12.55,17 12,17 C11.45,17 11,16.55 11,16 L11,13 L8,13 C7.45,13 7,12.55 7,12 C7,11.45 7.45,11 8,11 L11,11 L11,8 C11,7.45 11.45,7 12,7 C12.55,7 13,7.45 13,8 L13,11 L16,11 C16.55,11 17,11.45 17,12 C17,12.55 16.55,13 16,13 Z';\n/** @public */\n\nvar edtrSearch = 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z';\n/** @public */\n\nvar edtrDefaultPlugin = 'M20.6190476,11.5238095 L19.1904762,11.5238095 L19.1904762,7.71428571 C19.1904762,6.65714286 18.3333333,5.80952381 17.2857143,5.80952381 L13.4761905,5.80952381 L13.4761905,4.38095238 C13.4761905,3.06598869 12.4102018,2 11.0952381,2 C9.78027441,2 8.71428571,3.06598869 8.71428571,4.38095238 L8.71428571,5.80952381 L4.9047619,5.80952381 C3.85279095,5.80952381 3,6.66231476 3,7.71428571 L3,11.3333333 L4.42857143,11.3333333 C5.85714286,11.3333333 7,12.4761905 7,13.9047619 C7,15.3333333 5.85714286,16.4761905 4.42857143,16.4761905 L3,16.4761905 L3,20.0952381 C3,21.147209 3.85279095,22 4.9047619,22 L8.52380952,22 L8.52380952,20.5714286 C8.52380952,19.1428571 9.66666667,18 11.0952381,18 C12.5238095,18 13.6666667,19.1428571 13.6666667,20.5714286 L13.6666667,22 L17.2857143,22 C18.3376852,22 19.1904762,21.147209 19.1904762,20.0952381 L19.1904762,16.2857143 L20.6190476,16.2857143 C21.9340113,16.2857143 23,15.2197256 23,13.9047619 C23,12.5897982 21.9340113,11.5238095 20.6190476,11.5238095 Z';\n/** @public */\n\nvar edtrDragHandle = 'M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z';\n\n/** @public */\n\nvar defaultRendererTheme = {\n backgroundColor: '#ffffff',\n color: '#333333',\n primary: {\n color: '#ffffff',\n background: '#337ab7'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n }\n};\n/**\r\n * React Hook for the renderer theming\r\n *\r\n * @returns An object containing the current {@link RendererTheme | renderer theme} and {@link RendererUiTheme | renderer UI theme}\r\n * @public\r\n */\n\nfunction useRendererTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link RendererThemeProps} to the current theme of the specified renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link RendererThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createRendererUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.renderer), theme.rendererUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of a renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useRendererUiTheme(key, createDefaultTheme) {\n var theme = useRendererTheme();\n return createRendererUiTheme(key, createDefaultTheme)(theme);\n}\n\nvar defaultTheme = {\n editor: defaultEditorTheme,\n editorUi: {},\n renderer: defaultRendererTheme,\n rendererUi: {}\n}; // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to hydrate the context for the {@link Theme | Theme}\r\n *\r\n * @remarks\r\n * You probably don't want to use this component directly since it is already used by the core.\r\n * If you want to override the theme in some plugin, you probably want to use {@link ThemeProvider | ThemeProvider} instead.\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | default Theme}, and children\r\n * @public\r\n */\n\nfunction RootThemeProvider(props) {\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n/**\r\n * Context used for the {@link Theme | Theme}, see also {@link https://styled-components.com/docs/advanced#theming | Theming }\r\n *\r\n * @public\r\n */\n\nvar ThemeContext = ThemeContext$1;\n/**\r\n * React Hook to get the current {@link Theme | Theme}\r\n *\r\n * @returns The current {@link Theme | Theme}\r\n * @public\r\n */\n\nfunction useTheme() {\n return useContext(ThemeContext);\n} // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to override the current {@link Theme | theme}\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | current Theme}, and children\r\n * @public\r\n */\n\nfunction ThemeProvider(props) {\n var defaultTheme = useTheme();\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [defaultTheme, props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n\n/**\r\n * Provides utils for the User Interface\r\n *\r\n * @packageDocumentation\r\n */\n/**\r\n * Re-export of {@link https://styled-components.com/docs/api#primary | `styled` in `styled-components` }\r\n *\r\n * @public\r\n */\n\nvar styled = StyledComponents__default;\n\nexport { EdtrIcon, Icon, RootThemeProvider, ThemeContext, ThemeProvider, createEditorUiTheme, createIcon, createRendererUiTheme, defaultEditorTheme, defaultRendererTheme, edtrAlignBlock, edtrAlignCenter, edtrAlignLeft, edtrAlignRight, edtrBold, edtrClose, edtrColorText, edtrDefaultPlugin, edtrDragHandle, edtrFill, edtrFormula, edtrItalic, edtrLink, edtrListBullets, edtrListNumbered, edtrPlus, edtrQuote, edtrSearch, edtrText, styled, useEditorTheme, useEditorUiTheme, useRendererTheme, useRendererUiTheme, useTheme };\n\n","import { faSortDown, faSortUp, styled, useRendererUiTheme, Icon, faSmile, faCheckCircle } from '@edtr-io/ui';\nexport { styled } from '@edtr-io/ui';\nimport { useState, createElement, Fragment, Component } from 'react';\n\nfunction useExpandableBoxTheme() {\n return useRendererUiTheme('expandableBox', function (theme) {\n return {\n containerBorderColor: 'transparent',\n toggleBackgroundColor: theme.primary.background,\n toggleBorderColor: 'transparent',\n toggleColor: theme.primary.background\n };\n });\n}\n\nvar Container = /*#__PURE__*/styled.div(function (_ref) {\n var collapsed = _ref.collapsed;\n return {\n borderRadius: '5px',\n boxShadow: \"0 5px 5px rgba(0, 0, 0, \" + (collapsed ? 0 : 0.05) + \")\"\n };\n});\nvar Toggle = /*#__PURE__*/styled.div(function (_ref2) {\n var collapsed = _ref2.collapsed,\n editable = _ref2.editable,\n alwaysVisible = _ref2.alwaysVisible;\n\n var _useExpandableBoxThem = useExpandableBoxTheme(),\n toggleBackgroundColor = _useExpandableBoxThem.toggleBackgroundColor,\n toggleColor = _useExpandableBoxThem.toggleColor;\n\n return {\n backgroundColor: alwaysVisible || !collapsed ? toggleBackgroundColor : 'transparent',\n '& a': {\n color: toggleColor\n },\n padding: '10px 15px 10px 10px',\n marginBottom: '10px',\n position: 'relative',\n textAlign: 'left',\n borderRadius: alwaysVisible && collapsed ? '5px' : undefined,\n borderTopLeftRadius: '5px',\n borderTopRightRadius: '5px',\n cursor: editable ? undefined : 'pointer'\n };\n});\nvar Content = /*#__PURE__*/styled.div(function (_ref3) {\n var collapsed = _ref3.collapsed;\n return {\n display: collapsed ? 'none' : 'block',\n position: 'relative',\n padding: '5px 0'\n };\n});\nvar ToggleIcon = /*#__PURE__*/styled(Icon)(function (_ref4) {\n var collapsed = _ref4.collapsed;\n\n var _useExpandableBoxThem2 = useExpandableBoxTheme(),\n toggleColor = _useExpandableBoxThem2.toggleColor;\n\n return {\n marginRight: '10px',\n marginBottom: collapsed ? '3px' : '-3px',\n color: toggleColor\n };\n});\n/** @public */\n\nfunction ExpandableBox(_ref5) {\n var children = _ref5.children,\n editable = _ref5.editable,\n alwaysVisible = _ref5.alwaysVisible,\n renderTitle = _ref5.renderTitle;\n\n var _React$useState = useState(!editable),\n collapsed = _React$useState[0],\n setCollapsed = _React$useState[1];\n\n return createElement(Container, {\n collapsed: collapsed\n }, createElement(Toggle, {\n editable: editable,\n alwaysVisible: alwaysVisible,\n collapsed: collapsed,\n onClick: function onClick() {\n setCollapsed(!collapsed);\n }\n }, createElement(Fragment, null, createElement(ToggleIcon, {\n collapsed: collapsed,\n icon: collapsed ? faSortDown : faSortUp\n }), createElement(\"a\", null, renderTitle(collapsed)))), createElement(Content, {\n collapsed: collapsed\n }, children));\n}\n\nvar ContainerWithBox = /*#__PURE__*/styled.div({\n backgroundColor: '#fcf8e3',\n borderColor: '#faebcc',\n color: '#8a6d3b',\n padding: '15px'\n});\nvar ContainerWithoutBox = /*#__PURE__*/styled.div(function (_ref) {\n var correct = _ref.correct,\n showOnLeft = _ref.showOnLeft;\n return {\n color: correct ? '#95bc1a' : '#f7b07c',\n fontWeight: 'bold',\n textAlign: showOnLeft ? 'left' : 'right'\n };\n});\n/** @internal */\n\nfunction Feedback(_ref2) {\n var boxFree = _ref2.boxFree,\n children = _ref2.children,\n isTrueAnswer = _ref2.isTrueAnswer,\n showOnLeft = _ref2.showOnLeft;\n var Container = boxFree ? ContainerWithoutBox : ContainerWithBox;\n return createElement(Container, {\n correct: isTrueAnswer,\n showOnLeft: showOnLeft\n }, children);\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\n/** @internal */\n\nvar ExerciseState;\n\n(function (ExerciseState) {\n ExerciseState[ExerciseState[\"Default\"] = 1] = \"Default\";\n ExerciseState[ExerciseState[\"SolvedRight\"] = 2] = \"SolvedRight\";\n ExerciseState[ExerciseState[\"SolvedWrong\"] = 3] = \"SolvedWrong\";\n})(ExerciseState || (ExerciseState = {}));\n\nfunction useSubmitButtonTheme() {\n return useRendererUiTheme('submitButton', function (theme) {\n return {\n backgroundColor: '#337ab7',\n hoverBackgroundColor: '#d9edf7',\n color: theme.backgroundColor,\n correctBackgroundColor: theme.success.background,\n wrongBackgroundColor: theme.danger.background\n };\n });\n}\n\nvar getBackgroundColor = function getBackgroundColor(theme, exerciseState) {\n switch (exerciseState) {\n case ExerciseState.Default:\n {\n return theme.backgroundColor;\n }\n\n case ExerciseState.SolvedRight:\n {\n return theme.correctBackgroundColor;\n }\n\n case ExerciseState.SolvedWrong:\n {\n return theme.wrongBackgroundColor;\n }\n }\n};\n\nvar SubmitButtonComponent = /*#__PURE__*/styled.button(function (_ref) {\n var exerciseState = _ref.exerciseState;\n var theme = useSubmitButtonTheme();\n return {\n \"float\": 'right',\n margin: '10px 0px',\n border: 'none',\n padding: '3px',\n backgroundColor: getBackgroundColor(theme, exerciseState),\n color: theme.color,\n transition: 'background-color .5s ease',\n outline: 'none',\n '&hover': {\n backgroundColor: theme.hoverBackgroundColor\n }\n };\n});\n/** @internal */\n\nvar SubmitButton = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(SubmitButton, _React$Component);\n\n function SubmitButton() {\n return _React$Component.apply(this, arguments) || this;\n }\n\n var _proto = SubmitButton.prototype;\n\n _proto.render = function render() {\n return createElement(SubmitButtonComponent, {\n exerciseState: this.props.exerciseState,\n onClick: this.props.onClick\n }, this.props.exerciseState === ExerciseState.SolvedRight ? createElement(\"span\", null, createElement(Icon, {\n icon: faSmile\n }), \"Stimmt!\") : createElement(\"span\", null, createElement(Icon, {\n icon: faCheckCircle\n }), \"Stimmt\\u2019s?\"));\n };\n\n return SubmitButton;\n}(Component);\n\nexport { ExerciseState, ExpandableBox, Feedback, SubmitButton };\n\n","import StyledComponents__default, { ThemeContext as ThemeContext$1, ThemeProvider as ThemeProvider$1 } from 'styled-components';\nimport { mergeDeepRight, pick } from 'ramda';\nimport { useContext, createElement, useMemo } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nexport { faFileDownload } from '@fortawesome/free-solid-svg-icons/faFileDownload';\nexport { faFileArchive } from '@fortawesome/free-solid-svg-icons/faFileArchive';\nexport { faFileAudio } from '@fortawesome/free-solid-svg-icons/faFileAudio';\nexport { faCheckCircle } from '@fortawesome/free-solid-svg-icons/faCheckCircle';\nexport { faFileExcel } from '@fortawesome/free-solid-svg-icons/faFileExcel';\nexport { faFileImage } from '@fortawesome/free-solid-svg-icons/faFileImage';\nexport { faFilePdf } from '@fortawesome/free-solid-svg-icons/faFilePdf';\nexport { faSmile } from '@fortawesome/free-solid-svg-icons/faSmile';\nexport { faFileWord } from '@fortawesome/free-solid-svg-icons/faFileWord';\nexport { faFileVideo } from '@fortawesome/free-solid-svg-icons/faFileVideo';\nexport { faFilePowerpoint } from '@fortawesome/free-solid-svg-icons/faFilePowerpoint';\nexport { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';\nexport { faCut } from '@fortawesome/free-solid-svg-icons/faCut';\nexport { faCog } from '@fortawesome/free-solid-svg-icons/faCog';\nexport { faCopy } from '@fortawesome/free-solid-svg-icons/faCopy';\nexport { faFileAlt } from '@fortawesome/free-solid-svg-icons/faFileAlt';\nexport { faImages } from '@fortawesome/free-solid-svg-icons/faImages';\nexport { faPhotoVideo } from '@fortawesome/free-solid-svg-icons/faPhotoVideo';\nexport { faLink } from '@fortawesome/free-solid-svg-icons/faLink';\nexport { faMinus } from '@fortawesome/free-solid-svg-icons/faMinus';\nexport { faPaste } from '@fortawesome/free-solid-svg-icons/faPaste';\nexport { faPencilAlt } from '@fortawesome/free-solid-svg-icons/faPencilAlt';\nexport { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';\nexport { faSpinner } from '@fortawesome/free-solid-svg-icons/faSpinner';\nexport { faTable } from '@fortawesome/free-solid-svg-icons/faTable';\nexport { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';\nexport { faTrashAlt } from '@fortawesome/free-solid-svg-icons/faTrashAlt';\nexport { faFilm } from '@fortawesome/free-solid-svg-icons/faFilm';\nexport { faCaretSquareUp } from '@fortawesome/free-solid-svg-icons/faCaretSquareUp';\nexport { faCaretSquareDown } from '@fortawesome/free-solid-svg-icons/faCaretSquareDown';\nexport { faSortUp } from '@fortawesome/free-solid-svg-icons/faSortUp';\nexport { faSortDown } from '@fortawesome/free-solid-svg-icons/faSortDown';\nexport { faToolbox } from '@fortawesome/free-solid-svg-icons/faToolbox';\nexport { faEllipsisH } from '@fortawesome/free-solid-svg-icons/faEllipsisH';\nexport { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';\nexport { faCloudUploadAlt } from '@fortawesome/free-solid-svg-icons/faCloudUploadAlt';\nexport { faQuestionCircle } from '@fortawesome/free-solid-svg-icons/faQuestionCircle';\nexport { faAnchor } from '@fortawesome/free-solid-svg-icons/faAnchor';\nexport { faQuoteRight } from '@fortawesome/free-solid-svg-icons/faQuoteRight';\nexport { faEquals } from '@fortawesome/free-solid-svg-icons/faEquals';\nexport { faCubes } from '@fortawesome/free-solid-svg-icons/faCubes';\nexport { faCode } from '@fortawesome/free-solid-svg-icons/faCode';\nexport { faLightbulb } from '@fortawesome/free-solid-svg-icons/faLightbulb';\nexport { faKeyboard } from '@fortawesome/free-solid-svg-icons/faKeyboard';\nexport { faDotCircle } from '@fortawesome/free-solid-svg-icons/faDotCircle';\nexport { faCheckSquare } from '@fortawesome/free-solid-svg-icons/faCheckSquare';\nexport { faParagraph } from '@fortawesome/free-solid-svg-icons/faParagraph';\nexport { faRedoAlt } from '@fortawesome/free-solid-svg-icons/faRedoAlt';\nexport { faRandom } from '@fortawesome/free-solid-svg-icons/faRandom';\nexport { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons/faExternalLinkAlt';\nexport { faNewspaper } from '@fortawesome/free-solid-svg-icons/faNewspaper';\n\n/** @public */\n\nvar defaultEditorTheme = {\n primary: {\n color: '#ffffff',\n background: 'rgb(70, 155, 255)'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n },\n color: '#EEEEEE',\n backgroundColor: 'rgba(51,51,51,0.95)'\n};\n/**\r\n * React Hook for the editor theming\r\n *\r\n * @returns An object containing the current {@link EditorTheme | editor theme} and {@link EditorUiTheme | editor UI theme}\r\n * @public\r\n */\n\nfunction useEditorTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link EditorThemeProps} to the current theme of the specified editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link EditorThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createEditorUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.editor), theme.editorUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of an editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useEditorUiTheme(key, createDefaultTheme) {\n var theme = useEditorTheme();\n return createEditorUiTheme(key, createDefaultTheme)(theme);\n}\n\n/**\r\n * Font Awesome Icon component\r\n *\r\n * @param props - Most of {@link https://github.com/FortAwesome/react-fontawesome | FontAwesomeIconProps}\r\n * @public\r\n */\n\nfunction Icon(props) {\n var allowedProps = pick(['icon', 'mask', 'className', 'color', 'spin', 'pulse', 'border', 'fixedWidth', 'inverse', 'listItem', 'flip', 'size', 'pull', 'rotation', 'transform', 'symbol', 'style', 'tabIndex', 'title'], props);\n return createElement(FontAwesomeIcon, Object.assign({}, allowedProps));\n}\n/**\r\n * Creates an icon component\r\n *\r\n * @param i - The icon to use\r\n * @returns A component for the specified icon\r\n * @public\r\n */\n\nfunction createIcon(i) {\n return function I() {\n return createElement(Icon, {\n icon: i,\n size: \"4x\"\n });\n };\n}\nvar EdtrSVG = /*#__PURE__*/StyledComponents__default.svg({\n display: 'inline-block',\n verticalAlign: 'middle',\n overflow: 'hidden'\n});\n/**\r\n * Edtr.io icon component\r\n *\r\n * @param props - An Edtr.io icon definition and an optional className\r\n * @returns The icon\r\n * @public\r\n */\n\nfunction EdtrIcon(props) {\n return createElement(EdtrSVG, {\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n className: props.className\n }, createElement(\"path\", {\n fill: \"currentcolor\",\n d: props.icon\n }));\n}\n/** @public */\n\nvar edtrAlignBlock = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignCenter = 'M7 16c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zm-3 5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm3-5c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignRight = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zm-6-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignLeft = 'M14 15H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zm0-8H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zM4 13h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0 8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrClose = 'M18.3,5.71 C17.91,5.32 17.28,5.32 16.89,5.71 L12,10.59 L7.11,5.7 C6.72,5.31 6.09,5.31 5.7,5.7 C5.31,6.09 5.31,6.72 5.7,7.11 L10.59,12 L5.7,16.89 C5.31,17.28 5.31,17.91 5.7,18.3 C6.09,18.69 6.72,18.69 7.11,18.3 L12,13.41 L16.89,18.3 C17.28,18.69 17.91,18.69 18.3,18.3 C18.69,17.91 18.69,17.28 18.3,16.89 L13.41,12 L18.3,7.11 C18.68,6.73 18.68,6.09 18.3,5.71 Z';\n/** @public */\n\nvar edtrFormula = 'M9.796061,6.84358189 L9.546061,9.73358189 L11.366061,9.73358189 C11.9183457,9.73358189 12.366061,10.1812971 12.366061,10.7335819 L12.366061,10.7335819 C12.366061,11.2858666 11.9183457,11.7335819 11.366061,11.7335819 L9.366061,11.7335819 L8.926061,16.8035819 C8.726061,19.0035819 6.786061,20.6335819 4.586061,20.4335819 C3.95133688,20.3777262 3.21218763,20.0027937 2.36861326,19.3087844 L2.3686112,19.3087869 C1.93754177,18.9541458 1.8755844,18.3172015 2.23022554,17.8861321 C2.25098506,17.8608987 2.27295601,17.8366869 2.296061,17.8135819 L2.296061,17.8135819 C2.68943711,17.4202058 3.31879167,17.3943638 3.74309403,17.7541652 C4.42335978,18.3310001 5.0243456,18.5341427 5.546061,18.3635819 C6.326061,18.1235819 6.876061,17.4335819 6.946061,16.6235819 L7.366061,11.7335819 L5.366061,11.7335819 C4.81377625,11.7335819 4.366061,11.2858666 4.366061,10.7335819 L4.366061,10.7335819 C4.366061,10.1812971 4.81377625,9.73358189 5.366061,9.73358189 L7.546061,9.73358189 L7.816061,6.66358189 C8.006061,4.46358189 9.936061,2.83358189 12.146061,3.01358189 C12.7876823,3.06959645 13.5343235,3.45039469 14.3859845,4.15597662 L14.3859731,4.15599041 C14.8171452,4.51320676 14.8770982,5.1523219 14.5198819,5.58349402 C14.4997127,5.60783893 14.4784158,5.63122712 14.456061,5.65358189 L14.456061,5.65358189 C14.077745,6.03189793 13.4644763,6.03223098 13.0857495,5.65432608 C12.6951429,5.26458609 12.3219165,5.05433484 11.966061,5.02358189 C10.866061,4.92358189 9.896061,5.73358189 9.796061,6.84358189 Z M20.841061,12.6785819 L20.841061,12.6785819 C20.4517003,12.2892211 19.8204217,12.2892211 19.431061,12.6785819 L17.306061,14.8035819 L15.1860786,12.6835995 C14.7931405,12.2906614 14.1567565,12.2884206 13.761061,12.6785819 L13.761061,12.6785819 C13.3689485,13.0652103 13.3645027,13.6965046 13.7511312,14.0886171 C13.7527745,14.0902837 13.7544236,14.0919445 13.7560786,14.0935995 L15.896061,16.2335819 L13.7610785,18.3385997 C13.3717179,18.7224956 13.3672879,19.3493438 13.7511838,19.7387045 C13.7544529,19.7420201 13.7577454,19.7453127 13.761061,19.7485819 L13.761061,19.7485819 C14.1567565,20.1387432 14.7931405,20.1365024 15.1860786,19.7435643 L17.306061,17.6235819 L19.431061,19.7485819 C19.8204217,20.1379426 20.4517003,20.1379426 20.841061,19.7485819 L20.841061,19.7485819 C21.2290435,19.3605994 21.2290435,18.7315555 20.841061,18.343573 C20.8402306,18.3427426 20.8393988,18.3419137 20.8385654,18.3410863 L18.716061,16.2335819 L20.8435477,14.0910599 C21.2319346,13.6999283 21.2308227,13.0683435 20.841061,12.6785819 Z';\n/** @public */\n\nvar edtrText = 'M2.5 5.5C2.5 6.33 3.17 7 4 7h3.5v10.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V7H14c.83 0 1.5-.67 1.5-1.5S14.83 4 14 4H4c-.83 0-1.5.67-1.5 1.5zM20 9h-6c-.83 0-1.5.67-1.5 1.5S13.17 12 14 12h1.5v5.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V12H20c.83 0 1.5-.67 1.5-1.5S20.83 9 20 9z';\n/** @public */\n\nvar edtrLink = 'M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1zm2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1z';\n/** @public */\n\nvar edtrQuote = 'M7.17 17c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94zm10 0c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94z';\n/** @public */\n\nvar edtrListNumbered = 'M8 7h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm12 10H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zm0-6H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zM4.5 16h-2c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5h-.5c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h2c.28 0 .5-.22.5-.5v-3c0-.28-.22-.5-.5-.5zm-2-11H3v2.5c0 .28.22.5.5.5s.5-.22.5-.5v-3c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5s.22.5.5.5zm2 5h-2c-.28 0-.5.22-.5.5s.22.5.5.5h1.3l-1.68 1.96c-.08.09-.12.21-.12.32v.22c0 .28.22.5.5.5h2c.28 0 .5-.22.5-.5s-.22-.5-.5-.5H3.2l1.68-1.96c.08-.09.12-.21.12-.32v-.22c0-.28-.22-.5-.5-.5z';\n/** @public */\n\nvar edtrListBullets = 'M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM8 19h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm0-6h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zM7 6c0 .55.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrItalic = 'M10 5.5c0 .83.67 1.5 1.5 1.5h.71l-3.42 8H7.5c-.83 0-1.5.67-1.5 1.5S6.67 18 7.5 18h5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5h-.71l3.42-8h1.29c.83 0 1.5-.67 1.5-1.5S17.33 4 16.5 4h-5c-.83 0-1.5.67-1.5 1.5z';\n/** @public */\n\nvar edtrColorText = 'M10.63 3.93L6.06 15.58c-.27.68.23 1.42.97 1.42.43 0 .82-.27.98-.68L8.87 14h6.25l.87 2.32c.15.41.54.68.98.68.73 0 1.24-.74.97-1.42L13.37 3.93C13.14 3.37 12.6 3 12 3c-.6 0-1.15.37-1.37.93zM9.62 12L12 5.67 14.38 12H9.62z';\n/** @public */\n\nvar edtrFill = 'M16.56 8.94L8.32.7C7.93.31 7.3.31 6.91.7c-.39.39-.39 1.02 0 1.41l1.68 1.68-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z';\n/** @public */\n\nvar edtrBold = 'M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H8c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h5.78c2.07 0 3.96-1.69 3.97-3.77.01-1.53-.85-2.84-2.15-3.44zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z';\n/** @public */\n\nvar edtrPlus = 'M12,2 C6.48,2 2,6.48 2,12 C2,17.52 6.48,22 12,22 C17.52,22 22,17.52 22,12 C22,6.48 17.52,2 12,2 Z M16,13 L13,13 L13,16 C13,16.55 12.55,17 12,17 C11.45,17 11,16.55 11,16 L11,13 L8,13 C7.45,13 7,12.55 7,12 C7,11.45 7.45,11 8,11 L11,11 L11,8 C11,7.45 11.45,7 12,7 C12.55,7 13,7.45 13,8 L13,11 L16,11 C16.55,11 17,11.45 17,12 C17,12.55 16.55,13 16,13 Z';\n/** @public */\n\nvar edtrSearch = 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z';\n/** @public */\n\nvar edtrDefaultPlugin = 'M20.6190476,11.5238095 L19.1904762,11.5238095 L19.1904762,7.71428571 C19.1904762,6.65714286 18.3333333,5.80952381 17.2857143,5.80952381 L13.4761905,5.80952381 L13.4761905,4.38095238 C13.4761905,3.06598869 12.4102018,2 11.0952381,2 C9.78027441,2 8.71428571,3.06598869 8.71428571,4.38095238 L8.71428571,5.80952381 L4.9047619,5.80952381 C3.85279095,5.80952381 3,6.66231476 3,7.71428571 L3,11.3333333 L4.42857143,11.3333333 C5.85714286,11.3333333 7,12.4761905 7,13.9047619 C7,15.3333333 5.85714286,16.4761905 4.42857143,16.4761905 L3,16.4761905 L3,20.0952381 C3,21.147209 3.85279095,22 4.9047619,22 L8.52380952,22 L8.52380952,20.5714286 C8.52380952,19.1428571 9.66666667,18 11.0952381,18 C12.5238095,18 13.6666667,19.1428571 13.6666667,20.5714286 L13.6666667,22 L17.2857143,22 C18.3376852,22 19.1904762,21.147209 19.1904762,20.0952381 L19.1904762,16.2857143 L20.6190476,16.2857143 C21.9340113,16.2857143 23,15.2197256 23,13.9047619 C23,12.5897982 21.9340113,11.5238095 20.6190476,11.5238095 Z';\n/** @public */\n\nvar edtrDragHandle = 'M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z';\n\n/** @public */\n\nvar defaultRendererTheme = {\n backgroundColor: '#ffffff',\n color: '#333333',\n primary: {\n color: '#ffffff',\n background: '#337ab7'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n }\n};\n/**\r\n * React Hook for the renderer theming\r\n *\r\n * @returns An object containing the current {@link RendererTheme | renderer theme} and {@link RendererUiTheme | renderer UI theme}\r\n * @public\r\n */\n\nfunction useRendererTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link RendererThemeProps} to the current theme of the specified renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link RendererThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createRendererUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.renderer), theme.rendererUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of a renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useRendererUiTheme(key, createDefaultTheme) {\n var theme = useRendererTheme();\n return createRendererUiTheme(key, createDefaultTheme)(theme);\n}\n\nvar defaultTheme = {\n editor: defaultEditorTheme,\n editorUi: {},\n renderer: defaultRendererTheme,\n rendererUi: {}\n}; // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to hydrate the context for the {@link Theme | Theme}\r\n *\r\n * @remarks\r\n * You probably don't want to use this component directly since it is already used by the core.\r\n * If you want to override the theme in some plugin, you probably want to use {@link ThemeProvider | ThemeProvider} instead.\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | default Theme}, and children\r\n * @public\r\n */\n\nfunction RootThemeProvider(props) {\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n/**\r\n * Context used for the {@link Theme | Theme}, see also {@link https://styled-components.com/docs/advanced#theming | Theming }\r\n *\r\n * @public\r\n */\n\nvar ThemeContext = ThemeContext$1;\n/**\r\n * React Hook to get the current {@link Theme | Theme}\r\n *\r\n * @returns The current {@link Theme | Theme}\r\n * @public\r\n */\n\nfunction useTheme() {\n return useContext(ThemeContext);\n} // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to override the current {@link Theme | theme}\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | current Theme}, and children\r\n * @public\r\n */\n\nfunction ThemeProvider(props) {\n var defaultTheme = useTheme();\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [defaultTheme, props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n\n/**\r\n * Provides utils for the User Interface\r\n *\r\n * @packageDocumentation\r\n */\n/**\r\n * Re-export of {@link https://styled-components.com/docs/api#primary | `styled` in `styled-components` }\r\n *\r\n * @public\r\n */\n\nvar styled = StyledComponents__default;\n\nexport { EdtrIcon, Icon, RootThemeProvider, ThemeContext, ThemeProvider, createEditorUiTheme, createIcon, createRendererUiTheme, defaultEditorTheme, defaultRendererTheme, edtrAlignBlock, edtrAlignCenter, edtrAlignLeft, edtrAlignRight, edtrBold, edtrClose, edtrColorText, edtrDefaultPlugin, edtrDragHandle, edtrFill, edtrFormula, edtrItalic, edtrLink, edtrListBullets, edtrListNumbered, edtrPlus, edtrQuote, edtrSearch, edtrText, styled, useEditorTheme, useEditorUiTheme, useRendererTheme, useRendererUiTheme, useTheme };\n\n","import { object, string, child } from '@edtr-io/plugin';\nimport { mergeDeepRight } from 'ramda';\nimport { EditorInput } from '@edtr-io/editor-ui';\nimport { ExpandableBox } from '@edtr-io/renderer-ui';\nimport { ThemeProvider } from '@edtr-io/ui';\nimport { useMemo, useCallback, createElement, Fragment } from 'react';\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction SpoilerEditor(_ref) {\n var config = _ref.config,\n state = _ref.state,\n editable = _ref.editable,\n autofocusRef = _ref.autofocusRef;\n var theme = config.theme;\n var spoilerTheme = useMemo(function () {\n return {\n rendererUi: {\n expandableBox: {\n toggleBackgroundColor: theme.color,\n toggleColor: '#333',\n containerBorderColor: theme.color\n }\n }\n };\n }, [theme]);\n var renderTitle = useCallback(function (_collapsed) {\n return editable ? createElement(EditorInput, {\n onChange: function onChange(e) {\n return state.title.set(e.target.value);\n },\n value: state.title.value,\n placeholder: config.i18n.title.placeholder,\n ref: autofocusRef\n }) : createElement(Fragment, null, state.title.value);\n }, [config.i18n.title.placeholder, autofocusRef, editable, state.title]);\n return createElement(ThemeProvider, {\n theme: spoilerTheme\n }, createElement(ExpandableBox, {\n renderTitle: renderTitle,\n editable: editable,\n alwaysVisible: true\n }, state.content.render()));\n}\n\n/**\r\n * @param config - {@link SpoilerConfig | Plugin configuration}\r\n * @public\r\n */\n\nfunction createSpoilerPlugin(config) {\n var _config$i18n = config.i18n,\n i18n = _config$i18n === void 0 ? {} : _config$i18n,\n _config$theme = config.theme,\n theme = _config$theme === void 0 ? {} : _config$theme,\n content = config.content;\n return {\n Component: SpoilerEditor,\n config: function config() {\n return {\n i18n: mergeDeepRight({\n title: {\n placeholder: 'Enter a title'\n }\n }, i18n),\n theme: _extends({\n color: '#f5f5f5'\n }, theme)\n };\n },\n state: object({\n title: string(''),\n content: child(content)\n })\n };\n}\n\nexport { createSpoilerPlugin };\n\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global.Immutable = factory());\n}(this, function () { 'use strict';var SLICE$0 = Array.prototype.slice;\n\n function createClass(ctor, superClass) {\n if (superClass) {\n ctor.prototype = Object.create(superClass.prototype);\n }\n ctor.prototype.constructor = ctor;\n }\n\n function Iterable(value) {\n return isIterable(value) ? value : Seq(value);\n }\n\n\n createClass(KeyedIterable, Iterable);\n function KeyedIterable(value) {\n return isKeyed(value) ? value : KeyedSeq(value);\n }\n\n\n createClass(IndexedIterable, Iterable);\n function IndexedIterable(value) {\n return isIndexed(value) ? value : IndexedSeq(value);\n }\n\n\n createClass(SetIterable, Iterable);\n function SetIterable(value) {\n return isIterable(value) && !isAssociative(value) ? value : SetSeq(value);\n }\n\n\n\n function isIterable(maybeIterable) {\n return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]);\n }\n\n function isKeyed(maybeKeyed) {\n return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]);\n }\n\n function isIndexed(maybeIndexed) {\n return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]);\n }\n\n function isAssociative(maybeAssociative) {\n return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);\n }\n\n function isOrdered(maybeOrdered) {\n return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]);\n }\n\n Iterable.isIterable = isIterable;\n Iterable.isKeyed = isKeyed;\n Iterable.isIndexed = isIndexed;\n Iterable.isAssociative = isAssociative;\n Iterable.isOrdered = isOrdered;\n\n Iterable.Keyed = KeyedIterable;\n Iterable.Indexed = IndexedIterable;\n Iterable.Set = SetIterable;\n\n\n var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';\n\n // Used for setting prototype methods that IE8 chokes on.\n var DELETE = 'delete';\n\n // Constants describing the size of trie nodes.\n var SHIFT = 5; // Resulted in best performance after ______?\n var SIZE = 1 << SHIFT;\n var MASK = SIZE - 1;\n\n // A consistent shared value representing \"not set\" which equals nothing other\n // than itself, and nothing that could be provided externally.\n var NOT_SET = {};\n\n // Boolean references, Rough equivalent of `bool &`.\n var CHANGE_LENGTH = { value: false };\n var DID_ALTER = { value: false };\n\n function MakeRef(ref) {\n ref.value = false;\n return ref;\n }\n\n function SetRef(ref) {\n ref && (ref.value = true);\n }\n\n // A function which returns a value representing an \"owner\" for transient writes\n // to tries. The return value will only ever equal itself, and will not equal\n // the return of any subsequent call of this function.\n function OwnerID() {}\n\n // http://jsperf.com/copy-array-inline\n function arrCopy(arr, offset) {\n offset = offset || 0;\n var len = Math.max(0, arr.length - offset);\n var newArr = new Array(len);\n for (var ii = 0; ii < len; ii++) {\n newArr[ii] = arr[ii + offset];\n }\n return newArr;\n }\n\n function ensureSize(iter) {\n if (iter.size === undefined) {\n iter.size = iter.__iterate(returnTrue);\n }\n return iter.size;\n }\n\n function wrapIndex(iter, index) {\n // This implements \"is array index\" which the ECMAString spec defines as:\n //\n // A String property name P is an array index if and only if\n // ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal\n // to 2^32−1.\n //\n // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects\n if (typeof index !== 'number') {\n var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32\n if ('' + uint32Index !== index || uint32Index === 4294967295) {\n return NaN;\n }\n index = uint32Index;\n }\n return index < 0 ? ensureSize(iter) + index : index;\n }\n\n function returnTrue() {\n return true;\n }\n\n function wholeSlice(begin, end, size) {\n return (begin === 0 || (size !== undefined && begin <= -size)) &&\n (end === undefined || (size !== undefined && end >= size));\n }\n\n function resolveBegin(begin, size) {\n return resolveIndex(begin, size, 0);\n }\n\n function resolveEnd(end, size) {\n return resolveIndex(end, size, size);\n }\n\n function resolveIndex(index, size, defaultIndex) {\n return index === undefined ?\n defaultIndex :\n index < 0 ?\n Math.max(0, size + index) :\n size === undefined ?\n index :\n Math.min(size, index);\n }\n\n /* global Symbol */\n\n var ITERATE_KEYS = 0;\n var ITERATE_VALUES = 1;\n var ITERATE_ENTRIES = 2;\n\n var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\n var FAUX_ITERATOR_SYMBOL = '@@iterator';\n\n var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;\n\n\n function Iterator(next) {\n this.next = next;\n }\n\n Iterator.prototype.toString = function() {\n return '[Iterator]';\n };\n\n\n Iterator.KEYS = ITERATE_KEYS;\n Iterator.VALUES = ITERATE_VALUES;\n Iterator.ENTRIES = ITERATE_ENTRIES;\n\n Iterator.prototype.inspect =\n Iterator.prototype.toSource = function () { return this.toString(); }\n Iterator.prototype[ITERATOR_SYMBOL] = function () {\n return this;\n };\n\n\n function iteratorValue(type, k, v, iteratorResult) {\n var value = type === 0 ? k : type === 1 ? v : [k, v];\n iteratorResult ? (iteratorResult.value = value) : (iteratorResult = {\n value: value, done: false\n });\n return iteratorResult;\n }\n\n function iteratorDone() {\n return { value: undefined, done: true };\n }\n\n function hasIterator(maybeIterable) {\n return !!getIteratorFn(maybeIterable);\n }\n\n function isIterator(maybeIterator) {\n return maybeIterator && typeof maybeIterator.next === 'function';\n }\n\n function getIterator(iterable) {\n var iteratorFn = getIteratorFn(iterable);\n return iteratorFn && iteratorFn.call(iterable);\n }\n\n function getIteratorFn(iterable) {\n var iteratorFn = iterable && (\n (REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) ||\n iterable[FAUX_ITERATOR_SYMBOL]\n );\n if (typeof iteratorFn === 'function') {\n return iteratorFn;\n }\n }\n\n function isArrayLike(value) {\n return value && typeof value.length === 'number';\n }\n\n createClass(Seq, Iterable);\n function Seq(value) {\n return value === null || value === undefined ? emptySequence() :\n isIterable(value) ? value.toSeq() : seqFromValue(value);\n }\n\n Seq.of = function(/*...values*/) {\n return Seq(arguments);\n };\n\n Seq.prototype.toSeq = function() {\n return this;\n };\n\n Seq.prototype.toString = function() {\n return this.__toString('Seq {', '}');\n };\n\n Seq.prototype.cacheResult = function() {\n if (!this._cache && this.__iterateUncached) {\n this._cache = this.entrySeq().toArray();\n this.size = this._cache.length;\n }\n return this;\n };\n\n // abstract __iterateUncached(fn, reverse)\n\n Seq.prototype.__iterate = function(fn, reverse) {\n return seqIterate(this, fn, reverse, true);\n };\n\n // abstract __iteratorUncached(type, reverse)\n\n Seq.prototype.__iterator = function(type, reverse) {\n return seqIterator(this, type, reverse, true);\n };\n\n\n\n createClass(KeyedSeq, Seq);\n function KeyedSeq(value) {\n return value === null || value === undefined ?\n emptySequence().toKeyedSeq() :\n isIterable(value) ?\n (isKeyed(value) ? value.toSeq() : value.fromEntrySeq()) :\n keyedSeqFromValue(value);\n }\n\n KeyedSeq.prototype.toKeyedSeq = function() {\n return this;\n };\n\n\n\n createClass(IndexedSeq, Seq);\n function IndexedSeq(value) {\n return value === null || value === undefined ? emptySequence() :\n !isIterable(value) ? indexedSeqFromValue(value) :\n isKeyed(value) ? value.entrySeq() : value.toIndexedSeq();\n }\n\n IndexedSeq.of = function(/*...values*/) {\n return IndexedSeq(arguments);\n };\n\n IndexedSeq.prototype.toIndexedSeq = function() {\n return this;\n };\n\n IndexedSeq.prototype.toString = function() {\n return this.__toString('Seq [', ']');\n };\n\n IndexedSeq.prototype.__iterate = function(fn, reverse) {\n return seqIterate(this, fn, reverse, false);\n };\n\n IndexedSeq.prototype.__iterator = function(type, reverse) {\n return seqIterator(this, type, reverse, false);\n };\n\n\n\n createClass(SetSeq, Seq);\n function SetSeq(value) {\n return (\n value === null || value === undefined ? emptySequence() :\n !isIterable(value) ? indexedSeqFromValue(value) :\n isKeyed(value) ? value.entrySeq() : value\n ).toSetSeq();\n }\n\n SetSeq.of = function(/*...values*/) {\n return SetSeq(arguments);\n };\n\n SetSeq.prototype.toSetSeq = function() {\n return this;\n };\n\n\n\n Seq.isSeq = isSeq;\n Seq.Keyed = KeyedSeq;\n Seq.Set = SetSeq;\n Seq.Indexed = IndexedSeq;\n\n var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';\n\n Seq.prototype[IS_SEQ_SENTINEL] = true;\n\n\n\n createClass(ArraySeq, IndexedSeq);\n function ArraySeq(array) {\n this._array = array;\n this.size = array.length;\n }\n\n ArraySeq.prototype.get = function(index, notSetValue) {\n return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue;\n };\n\n ArraySeq.prototype.__iterate = function(fn, reverse) {\n var array = this._array;\n var maxIndex = array.length - 1;\n for (var ii = 0; ii <= maxIndex; ii++) {\n if (fn(array[reverse ? maxIndex - ii : ii], ii, this) === false) {\n return ii + 1;\n }\n }\n return ii;\n };\n\n ArraySeq.prototype.__iterator = function(type, reverse) {\n var array = this._array;\n var maxIndex = array.length - 1;\n var ii = 0;\n return new Iterator(function() \n {return ii > maxIndex ?\n iteratorDone() :\n iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++])}\n );\n };\n\n\n\n createClass(ObjectSeq, KeyedSeq);\n function ObjectSeq(object) {\n var keys = Object.keys(object);\n this._object = object;\n this._keys = keys;\n this.size = keys.length;\n }\n\n ObjectSeq.prototype.get = function(key, notSetValue) {\n if (notSetValue !== undefined && !this.has(key)) {\n return notSetValue;\n }\n return this._object[key];\n };\n\n ObjectSeq.prototype.has = function(key) {\n return this._object.hasOwnProperty(key);\n };\n\n ObjectSeq.prototype.__iterate = function(fn, reverse) {\n var object = this._object;\n var keys = this._keys;\n var maxIndex = keys.length - 1;\n for (var ii = 0; ii <= maxIndex; ii++) {\n var key = keys[reverse ? maxIndex - ii : ii];\n if (fn(object[key], key, this) === false) {\n return ii + 1;\n }\n }\n return ii;\n };\n\n ObjectSeq.prototype.__iterator = function(type, reverse) {\n var object = this._object;\n var keys = this._keys;\n var maxIndex = keys.length - 1;\n var ii = 0;\n return new Iterator(function() {\n var key = keys[reverse ? maxIndex - ii : ii];\n return ii++ > maxIndex ?\n iteratorDone() :\n iteratorValue(type, key, object[key]);\n });\n };\n\n ObjectSeq.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n createClass(IterableSeq, IndexedSeq);\n function IterableSeq(iterable) {\n this._iterable = iterable;\n this.size = iterable.length || iterable.size;\n }\n\n IterableSeq.prototype.__iterateUncached = function(fn, reverse) {\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var iterable = this._iterable;\n var iterator = getIterator(iterable);\n var iterations = 0;\n if (isIterator(iterator)) {\n var step;\n while (!(step = iterator.next()).done) {\n if (fn(step.value, iterations++, this) === false) {\n break;\n }\n }\n }\n return iterations;\n };\n\n IterableSeq.prototype.__iteratorUncached = function(type, reverse) {\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterable = this._iterable;\n var iterator = getIterator(iterable);\n if (!isIterator(iterator)) {\n return new Iterator(iteratorDone);\n }\n var iterations = 0;\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step : iteratorValue(type, iterations++, step.value);\n });\n };\n\n\n\n createClass(IteratorSeq, IndexedSeq);\n function IteratorSeq(iterator) {\n this._iterator = iterator;\n this._iteratorCache = [];\n }\n\n IteratorSeq.prototype.__iterateUncached = function(fn, reverse) {\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var iterator = this._iterator;\n var cache = this._iteratorCache;\n var iterations = 0;\n while (iterations < cache.length) {\n if (fn(cache[iterations], iterations++, this) === false) {\n return iterations;\n }\n }\n var step;\n while (!(step = iterator.next()).done) {\n var val = step.value;\n cache[iterations] = val;\n if (fn(val, iterations++, this) === false) {\n break;\n }\n }\n return iterations;\n };\n\n IteratorSeq.prototype.__iteratorUncached = function(type, reverse) {\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterator = this._iterator;\n var cache = this._iteratorCache;\n var iterations = 0;\n return new Iterator(function() {\n if (iterations >= cache.length) {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n cache[iterations] = step.value;\n }\n return iteratorValue(type, iterations, cache[iterations++]);\n });\n };\n\n\n\n\n // # pragma Helper functions\n\n function isSeq(maybeSeq) {\n return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]);\n }\n\n var EMPTY_SEQ;\n\n function emptySequence() {\n return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([]));\n }\n\n function keyedSeqFromValue(value) {\n var seq =\n Array.isArray(value) ? new ArraySeq(value).fromEntrySeq() :\n isIterator(value) ? new IteratorSeq(value).fromEntrySeq() :\n hasIterator(value) ? new IterableSeq(value).fromEntrySeq() :\n typeof value === 'object' ? new ObjectSeq(value) :\n undefined;\n if (!seq) {\n throw new TypeError(\n 'Expected Array or iterable object of [k, v] entries, '+\n 'or keyed object: ' + value\n );\n }\n return seq;\n }\n\n function indexedSeqFromValue(value) {\n var seq = maybeIndexedSeqFromValue(value);\n if (!seq) {\n throw new TypeError(\n 'Expected Array or iterable object of values: ' + value\n );\n }\n return seq;\n }\n\n function seqFromValue(value) {\n var seq = maybeIndexedSeqFromValue(value) ||\n (typeof value === 'object' && new ObjectSeq(value));\n if (!seq) {\n throw new TypeError(\n 'Expected Array or iterable object of values, or keyed object: ' + value\n );\n }\n return seq;\n }\n\n function maybeIndexedSeqFromValue(value) {\n return (\n isArrayLike(value) ? new ArraySeq(value) :\n isIterator(value) ? new IteratorSeq(value) :\n hasIterator(value) ? new IterableSeq(value) :\n undefined\n );\n }\n\n function seqIterate(seq, fn, reverse, useKeys) {\n var cache = seq._cache;\n if (cache) {\n var maxIndex = cache.length - 1;\n for (var ii = 0; ii <= maxIndex; ii++) {\n var entry = cache[reverse ? maxIndex - ii : ii];\n if (fn(entry[1], useKeys ? entry[0] : ii, seq) === false) {\n return ii + 1;\n }\n }\n return ii;\n }\n return seq.__iterateUncached(fn, reverse);\n }\n\n function seqIterator(seq, type, reverse, useKeys) {\n var cache = seq._cache;\n if (cache) {\n var maxIndex = cache.length - 1;\n var ii = 0;\n return new Iterator(function() {\n var entry = cache[reverse ? maxIndex - ii : ii];\n return ii++ > maxIndex ?\n iteratorDone() :\n iteratorValue(type, useKeys ? entry[0] : ii - 1, entry[1]);\n });\n }\n return seq.__iteratorUncached(type, reverse);\n }\n\n function fromJS(json, converter) {\n return converter ?\n fromJSWith(converter, json, '', {'': json}) :\n fromJSDefault(json);\n }\n\n function fromJSWith(converter, json, key, parentJSON) {\n if (Array.isArray(json)) {\n return converter.call(parentJSON, key, IndexedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)}));\n }\n if (isPlainObj(json)) {\n return converter.call(parentJSON, key, KeyedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)}));\n }\n return json;\n }\n\n function fromJSDefault(json) {\n if (Array.isArray(json)) {\n return IndexedSeq(json).map(fromJSDefault).toList();\n }\n if (isPlainObj(json)) {\n return KeyedSeq(json).map(fromJSDefault).toMap();\n }\n return json;\n }\n\n function isPlainObj(value) {\n return value && (value.constructor === Object || value.constructor === undefined);\n }\n\n /**\n * An extension of the \"same-value\" algorithm as [described for use by ES6 Map\n * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality)\n *\n * NaN is considered the same as NaN, however -0 and 0 are considered the same\n * value, which is different from the algorithm described by\n * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).\n *\n * This is extended further to allow Objects to describe the values they\n * represent, by way of `valueOf` or `equals` (and `hashCode`).\n *\n * Note: because of this extension, the key equality of Immutable.Map and the\n * value equality of Immutable.Set will differ from ES6 Map and Set.\n *\n * ### Defining custom values\n *\n * The easiest way to describe the value an object represents is by implementing\n * `valueOf`. For example, `Date` represents a value by returning a unix\n * timestamp for `valueOf`:\n *\n * var date1 = new Date(1234567890000); // Fri Feb 13 2009 ...\n * var date2 = new Date(1234567890000);\n * date1.valueOf(); // 1234567890000\n * assert( date1 !== date2 );\n * assert( Immutable.is( date1, date2 ) );\n *\n * Note: overriding `valueOf` may have other implications if you use this object\n * where JavaScript expects a primitive, such as implicit string coercion.\n *\n * For more complex types, especially collections, implementing `valueOf` may\n * not be performant. An alternative is to implement `equals` and `hashCode`.\n *\n * `equals` takes another object, presumably of similar type, and returns true\n * if the it is equal. Equality is symmetrical, so the same result should be\n * returned if this and the argument are flipped.\n *\n * assert( a.equals(b) === b.equals(a) );\n *\n * `hashCode` returns a 32bit integer number representing the object which will\n * be used to determine how to store the value object in a Map or Set. You must\n * provide both or neither methods, one must not exist without the other.\n *\n * Also, an important relationship between these methods must be upheld: if two\n * values are equal, they *must* return the same hashCode. If the values are not\n * equal, they might have the same hashCode; this is called a hash collision,\n * and while undesirable for performance reasons, it is acceptable.\n *\n * if (a.equals(b)) {\n * assert( a.hashCode() === b.hashCode() );\n * }\n *\n * All Immutable collections implement `equals` and `hashCode`.\n *\n */\n function is(valueA, valueB) {\n if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {\n return true;\n }\n if (!valueA || !valueB) {\n return false;\n }\n if (typeof valueA.valueOf === 'function' &&\n typeof valueB.valueOf === 'function') {\n valueA = valueA.valueOf();\n valueB = valueB.valueOf();\n if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {\n return true;\n }\n if (!valueA || !valueB) {\n return false;\n }\n }\n if (typeof valueA.equals === 'function' &&\n typeof valueB.equals === 'function' &&\n valueA.equals(valueB)) {\n return true;\n }\n return false;\n }\n\n function deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n if (\n !isIterable(b) ||\n a.size !== undefined && b.size !== undefined && a.size !== b.size ||\n a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash ||\n isKeyed(a) !== isKeyed(b) ||\n isIndexed(a) !== isIndexed(b) ||\n isOrdered(a) !== isOrdered(b)\n ) {\n return false;\n }\n\n if (a.size === 0 && b.size === 0) {\n return true;\n }\n\n var notAssociative = !isAssociative(a);\n\n if (isOrdered(a)) {\n var entries = a.entries();\n return b.every(function(v, k) {\n var entry = entries.next().value;\n return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));\n }) && entries.next().done;\n }\n\n var flipped = false;\n\n if (a.size === undefined) {\n if (b.size === undefined) {\n if (typeof a.cacheResult === 'function') {\n a.cacheResult();\n }\n } else {\n flipped = true;\n var _ = a;\n a = b;\n b = _;\n }\n }\n\n var allEqual = true;\n var bSize = b.__iterate(function(v, k) {\n if (notAssociative ? !a.has(v) :\n flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) {\n allEqual = false;\n return false;\n }\n });\n\n return allEqual && a.size === bSize;\n }\n\n createClass(Repeat, IndexedSeq);\n\n function Repeat(value, times) {\n if (!(this instanceof Repeat)) {\n return new Repeat(value, times);\n }\n this._value = value;\n this.size = times === undefined ? Infinity : Math.max(0, times);\n if (this.size === 0) {\n if (EMPTY_REPEAT) {\n return EMPTY_REPEAT;\n }\n EMPTY_REPEAT = this;\n }\n }\n\n Repeat.prototype.toString = function() {\n if (this.size === 0) {\n return 'Repeat []';\n }\n return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]';\n };\n\n Repeat.prototype.get = function(index, notSetValue) {\n return this.has(index) ? this._value : notSetValue;\n };\n\n Repeat.prototype.includes = function(searchValue) {\n return is(this._value, searchValue);\n };\n\n Repeat.prototype.slice = function(begin, end) {\n var size = this.size;\n return wholeSlice(begin, end, size) ? this :\n new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size));\n };\n\n Repeat.prototype.reverse = function() {\n return this;\n };\n\n Repeat.prototype.indexOf = function(searchValue) {\n if (is(this._value, searchValue)) {\n return 0;\n }\n return -1;\n };\n\n Repeat.prototype.lastIndexOf = function(searchValue) {\n if (is(this._value, searchValue)) {\n return this.size;\n }\n return -1;\n };\n\n Repeat.prototype.__iterate = function(fn, reverse) {\n for (var ii = 0; ii < this.size; ii++) {\n if (fn(this._value, ii, this) === false) {\n return ii + 1;\n }\n }\n return ii;\n };\n\n Repeat.prototype.__iterator = function(type, reverse) {var this$0 = this;\n var ii = 0;\n return new Iterator(function() \n {return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone()}\n );\n };\n\n Repeat.prototype.equals = function(other) {\n return other instanceof Repeat ?\n is(this._value, other._value) :\n deepEqual(other);\n };\n\n\n var EMPTY_REPEAT;\n\n function invariant(condition, error) {\n if (!condition) throw new Error(error);\n }\n\n createClass(Range, IndexedSeq);\n\n function Range(start, end, step) {\n if (!(this instanceof Range)) {\n return new Range(start, end, step);\n }\n invariant(step !== 0, 'Cannot step a Range by 0');\n start = start || 0;\n if (end === undefined) {\n end = Infinity;\n }\n step = step === undefined ? 1 : Math.abs(step);\n if (end < start) {\n step = -step;\n }\n this._start = start;\n this._end = end;\n this._step = step;\n this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);\n if (this.size === 0) {\n if (EMPTY_RANGE) {\n return EMPTY_RANGE;\n }\n EMPTY_RANGE = this;\n }\n }\n\n Range.prototype.toString = function() {\n if (this.size === 0) {\n return 'Range []';\n }\n return 'Range [ ' +\n this._start + '...' + this._end +\n (this._step !== 1 ? ' by ' + this._step : '') +\n ' ]';\n };\n\n Range.prototype.get = function(index, notSetValue) {\n return this.has(index) ?\n this._start + wrapIndex(this, index) * this._step :\n notSetValue;\n };\n\n Range.prototype.includes = function(searchValue) {\n var possibleIndex = (searchValue - this._start) / this._step;\n return possibleIndex >= 0 &&\n possibleIndex < this.size &&\n possibleIndex === Math.floor(possibleIndex);\n };\n\n Range.prototype.slice = function(begin, end) {\n if (wholeSlice(begin, end, this.size)) {\n return this;\n }\n begin = resolveBegin(begin, this.size);\n end = resolveEnd(end, this.size);\n if (end <= begin) {\n return new Range(0, 0);\n }\n return new Range(this.get(begin, this._end), this.get(end, this._end), this._step);\n };\n\n Range.prototype.indexOf = function(searchValue) {\n var offsetValue = searchValue - this._start;\n if (offsetValue % this._step === 0) {\n var index = offsetValue / this._step;\n if (index >= 0 && index < this.size) {\n return index\n }\n }\n return -1;\n };\n\n Range.prototype.lastIndexOf = function(searchValue) {\n return this.indexOf(searchValue);\n };\n\n Range.prototype.__iterate = function(fn, reverse) {\n var maxIndex = this.size - 1;\n var step = this._step;\n var value = reverse ? this._start + maxIndex * step : this._start;\n for (var ii = 0; ii <= maxIndex; ii++) {\n if (fn(value, ii, this) === false) {\n return ii + 1;\n }\n value += reverse ? -step : step;\n }\n return ii;\n };\n\n Range.prototype.__iterator = function(type, reverse) {\n var maxIndex = this.size - 1;\n var step = this._step;\n var value = reverse ? this._start + maxIndex * step : this._start;\n var ii = 0;\n return new Iterator(function() {\n var v = value;\n value += reverse ? -step : step;\n return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii++, v);\n });\n };\n\n Range.prototype.equals = function(other) {\n return other instanceof Range ?\n this._start === other._start &&\n this._end === other._end &&\n this._step === other._step :\n deepEqual(this, other);\n };\n\n\n var EMPTY_RANGE;\n\n createClass(Collection, Iterable);\n function Collection() {\n throw TypeError('Abstract');\n }\n\n\n createClass(KeyedCollection, Collection);function KeyedCollection() {}\n\n createClass(IndexedCollection, Collection);function IndexedCollection() {}\n\n createClass(SetCollection, Collection);function SetCollection() {}\n\n\n Collection.Keyed = KeyedCollection;\n Collection.Indexed = IndexedCollection;\n Collection.Set = SetCollection;\n\n var imul =\n typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ?\n Math.imul :\n function imul(a, b) {\n a = a | 0; // int\n b = b | 0; // int\n var c = a & 0xffff;\n var d = b & 0xffff;\n // Shift by 0 fixes the sign on the high part.\n return (c * d) + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0) | 0; // int\n };\n\n // v8 has an optimization for storing 31-bit signed numbers.\n // Values which have either 00 or 11 as the high order bits qualify.\n // This function drops the highest order bit in a signed number, maintaining\n // the sign bit.\n function smi(i32) {\n return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF);\n }\n\n function hash(o) {\n if (o === false || o === null || o === undefined) {\n return 0;\n }\n if (typeof o.valueOf === 'function') {\n o = o.valueOf();\n if (o === false || o === null || o === undefined) {\n return 0;\n }\n }\n if (o === true) {\n return 1;\n }\n var type = typeof o;\n if (type === 'number') {\n if (o !== o || o === Infinity) {\n return 0;\n }\n var h = o | 0;\n if (h !== o) {\n h ^= o * 0xFFFFFFFF;\n }\n while (o > 0xFFFFFFFF) {\n o /= 0xFFFFFFFF;\n h ^= o;\n }\n return smi(h);\n }\n if (type === 'string') {\n return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o);\n }\n if (typeof o.hashCode === 'function') {\n return o.hashCode();\n }\n if (type === 'object') {\n return hashJSObj(o);\n }\n if (typeof o.toString === 'function') {\n return hashString(o.toString());\n }\n throw new Error('Value type ' + type + ' cannot be hashed.');\n }\n\n function cachedHashString(string) {\n var hash = stringHashCache[string];\n if (hash === undefined) {\n hash = hashString(string);\n if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {\n STRING_HASH_CACHE_SIZE = 0;\n stringHashCache = {};\n }\n STRING_HASH_CACHE_SIZE++;\n stringHashCache[string] = hash;\n }\n return hash;\n }\n\n // http://jsperf.com/hashing-strings\n function hashString(string) {\n // This is the hash from JVM\n // The hash code for a string is computed as\n // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],\n // where s[i] is the ith character of the string and n is the length of\n // the string. We \"mod\" the result to make it between 0 (inclusive) and 2^31\n // (exclusive) by dropping high bits.\n var hash = 0;\n for (var ii = 0; ii < string.length; ii++) {\n hash = 31 * hash + string.charCodeAt(ii) | 0;\n }\n return smi(hash);\n }\n\n function hashJSObj(obj) {\n var hash;\n if (usingWeakMap) {\n hash = weakMap.get(obj);\n if (hash !== undefined) {\n return hash;\n }\n }\n\n hash = obj[UID_HASH_KEY];\n if (hash !== undefined) {\n return hash;\n }\n\n if (!canDefineProperty) {\n hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY];\n if (hash !== undefined) {\n return hash;\n }\n\n hash = getIENodeHash(obj);\n if (hash !== undefined) {\n return hash;\n }\n }\n\n hash = ++objHashUID;\n if (objHashUID & 0x40000000) {\n objHashUID = 0;\n }\n\n if (usingWeakMap) {\n weakMap.set(obj, hash);\n } else if (isExtensible !== undefined && isExtensible(obj) === false) {\n throw new Error('Non-extensible objects are not allowed as keys.');\n } else if (canDefineProperty) {\n Object.defineProperty(obj, UID_HASH_KEY, {\n 'enumerable': false,\n 'configurable': false,\n 'writable': false,\n 'value': hash\n });\n } else if (obj.propertyIsEnumerable !== undefined &&\n obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) {\n // Since we can't define a non-enumerable property on the object\n // we'll hijack one of the less-used non-enumerable properties to\n // save our hash on it. Since this is a function it will not show up in\n // `JSON.stringify` which is what we want.\n obj.propertyIsEnumerable = function() {\n return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments);\n };\n obj.propertyIsEnumerable[UID_HASH_KEY] = hash;\n } else if (obj.nodeType !== undefined) {\n // At this point we couldn't get the IE `uniqueID` to use as a hash\n // and we couldn't use a non-enumerable property to exploit the\n // dontEnum bug so we simply add the `UID_HASH_KEY` on the node\n // itself.\n obj[UID_HASH_KEY] = hash;\n } else {\n throw new Error('Unable to set a non-enumerable property on object.');\n }\n\n return hash;\n }\n\n // Get references to ES5 object methods.\n var isExtensible = Object.isExtensible;\n\n // True if Object.defineProperty works as expected. IE8 fails this test.\n var canDefineProperty = (function() {\n try {\n Object.defineProperty({}, '@', {});\n return true;\n } catch (e) {\n return false;\n }\n }());\n\n // IE has a `uniqueID` property on DOM nodes. We can construct the hash from it\n // and avoid memory leaks from the IE cloneNode bug.\n function getIENodeHash(node) {\n if (node && node.nodeType > 0) {\n switch (node.nodeType) {\n case 1: // Element\n return node.uniqueID;\n case 9: // Document\n return node.documentElement && node.documentElement.uniqueID;\n }\n }\n }\n\n // If possible, use a WeakMap.\n var usingWeakMap = typeof WeakMap === 'function';\n var weakMap;\n if (usingWeakMap) {\n weakMap = new WeakMap();\n }\n\n var objHashUID = 0;\n\n var UID_HASH_KEY = '__immutablehash__';\n if (typeof Symbol === 'function') {\n UID_HASH_KEY = Symbol(UID_HASH_KEY);\n }\n\n var STRING_HASH_CACHE_MIN_STRLEN = 16;\n var STRING_HASH_CACHE_MAX_SIZE = 255;\n var STRING_HASH_CACHE_SIZE = 0;\n var stringHashCache = {};\n\n function assertNotInfinite(size) {\n invariant(\n size !== Infinity,\n 'Cannot perform this action with an infinite size.'\n );\n }\n\n createClass(Map, KeyedCollection);\n\n // @pragma Construction\n\n function Map(value) {\n return value === null || value === undefined ? emptyMap() :\n isMap(value) && !isOrdered(value) ? value :\n emptyMap().withMutations(function(map ) {\n var iter = KeyedIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v, k) {return map.set(k, v)});\n });\n }\n\n Map.of = function() {var keyValues = SLICE$0.call(arguments, 0);\n return emptyMap().withMutations(function(map ) {\n for (var i = 0; i < keyValues.length; i += 2) {\n if (i + 1 >= keyValues.length) {\n throw new Error('Missing value for key: ' + keyValues[i]);\n }\n map.set(keyValues[i], keyValues[i + 1]);\n }\n });\n };\n\n Map.prototype.toString = function() {\n return this.__toString('Map {', '}');\n };\n\n // @pragma Access\n\n Map.prototype.get = function(k, notSetValue) {\n return this._root ?\n this._root.get(0, undefined, k, notSetValue) :\n notSetValue;\n };\n\n // @pragma Modification\n\n Map.prototype.set = function(k, v) {\n return updateMap(this, k, v);\n };\n\n Map.prototype.setIn = function(keyPath, v) {\n return this.updateIn(keyPath, NOT_SET, function() {return v});\n };\n\n Map.prototype.remove = function(k) {\n return updateMap(this, k, NOT_SET);\n };\n\n Map.prototype.deleteIn = function(keyPath) {\n return this.updateIn(keyPath, function() {return NOT_SET});\n };\n\n Map.prototype.update = function(k, notSetValue, updater) {\n return arguments.length === 1 ?\n k(this) :\n this.updateIn([k], notSetValue, updater);\n };\n\n Map.prototype.updateIn = function(keyPath, notSetValue, updater) {\n if (!updater) {\n updater = notSetValue;\n notSetValue = undefined;\n }\n var updatedValue = updateInDeepMap(\n this,\n forceIterator(keyPath),\n notSetValue,\n updater\n );\n return updatedValue === NOT_SET ? undefined : updatedValue;\n };\n\n Map.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = 0;\n this._root = null;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return emptyMap();\n };\n\n // @pragma Composition\n\n Map.prototype.merge = function(/*...iters*/) {\n return mergeIntoMapWith(this, undefined, arguments);\n };\n\n Map.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoMapWith(this, merger, iters);\n };\n\n Map.prototype.mergeIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1);\n return this.updateIn(\n keyPath,\n emptyMap(),\n function(m ) {return typeof m.merge === 'function' ?\n m.merge.apply(m, iters) :\n iters[iters.length - 1]}\n );\n };\n\n Map.prototype.mergeDeep = function(/*...iters*/) {\n return mergeIntoMapWith(this, deepMerger, arguments);\n };\n\n Map.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoMapWith(this, deepMergerWith(merger), iters);\n };\n\n Map.prototype.mergeDeepIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1);\n return this.updateIn(\n keyPath,\n emptyMap(),\n function(m ) {return typeof m.mergeDeep === 'function' ?\n m.mergeDeep.apply(m, iters) :\n iters[iters.length - 1]}\n );\n };\n\n Map.prototype.sort = function(comparator) {\n // Late binding\n return OrderedMap(sortFactory(this, comparator));\n };\n\n Map.prototype.sortBy = function(mapper, comparator) {\n // Late binding\n return OrderedMap(sortFactory(this, comparator, mapper));\n };\n\n // @pragma Mutability\n\n Map.prototype.withMutations = function(fn) {\n var mutable = this.asMutable();\n fn(mutable);\n return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this;\n };\n\n Map.prototype.asMutable = function() {\n return this.__ownerID ? this : this.__ensureOwner(new OwnerID());\n };\n\n Map.prototype.asImmutable = function() {\n return this.__ensureOwner();\n };\n\n Map.prototype.wasAltered = function() {\n return this.__altered;\n };\n\n Map.prototype.__iterator = function(type, reverse) {\n return new MapIterator(this, type, reverse);\n };\n\n Map.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n var iterations = 0;\n this._root && this._root.iterate(function(entry ) {\n iterations++;\n return fn(entry[1], entry[0], this$0);\n }, reverse);\n return iterations;\n };\n\n Map.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n if (!ownerID) {\n this.__ownerID = ownerID;\n this.__altered = false;\n return this;\n }\n return makeMap(this.size, this._root, ownerID, this.__hash);\n };\n\n\n function isMap(maybeMap) {\n return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]);\n }\n\n Map.isMap = isMap;\n\n var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';\n\n var MapPrototype = Map.prototype;\n MapPrototype[IS_MAP_SENTINEL] = true;\n MapPrototype[DELETE] = MapPrototype.remove;\n MapPrototype.removeIn = MapPrototype.deleteIn;\n\n\n // #pragma Trie Nodes\n\n\n\n function ArrayMapNode(ownerID, entries) {\n this.ownerID = ownerID;\n this.entries = entries;\n }\n\n ArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n var entries = this.entries;\n for (var ii = 0, len = entries.length; ii < len; ii++) {\n if (is(key, entries[ii][0])) {\n return entries[ii][1];\n }\n }\n return notSetValue;\n };\n\n ArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n var removed = value === NOT_SET;\n\n var entries = this.entries;\n var idx = 0;\n for (var len = entries.length; idx < len; idx++) {\n if (is(key, entries[idx][0])) {\n break;\n }\n }\n var exists = idx < len;\n\n if (exists ? entries[idx][1] === value : removed) {\n return this;\n }\n\n SetRef(didAlter);\n (removed || !exists) && SetRef(didChangeSize);\n\n if (removed && entries.length === 1) {\n return; // undefined\n }\n\n if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {\n return createNodes(ownerID, entries, key, value);\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newEntries = isEditable ? entries : arrCopy(entries);\n\n if (exists) {\n if (removed) {\n idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());\n } else {\n newEntries[idx] = [key, value];\n }\n } else {\n newEntries.push([key, value]);\n }\n\n if (isEditable) {\n this.entries = newEntries;\n return this;\n }\n\n return new ArrayMapNode(ownerID, newEntries);\n };\n\n\n\n\n function BitmapIndexedNode(ownerID, bitmap, nodes) {\n this.ownerID = ownerID;\n this.bitmap = bitmap;\n this.nodes = nodes;\n }\n\n BitmapIndexedNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var bit = (1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK));\n var bitmap = this.bitmap;\n return (bitmap & bit) === 0 ? notSetValue :\n this.nodes[popCount(bitmap & (bit - 1))].get(shift + SHIFT, keyHash, key, notSetValue);\n };\n\n BitmapIndexedNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var bit = 1 << keyHashFrag;\n var bitmap = this.bitmap;\n var exists = (bitmap & bit) !== 0;\n\n if (!exists && value === NOT_SET) {\n return this;\n }\n\n var idx = popCount(bitmap & (bit - 1));\n var nodes = this.nodes;\n var node = exists ? nodes[idx] : undefined;\n var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n\n if (newNode === node) {\n return this;\n }\n\n if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {\n return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);\n }\n\n if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) {\n return nodes[idx ^ 1];\n }\n\n if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {\n return newNode;\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit;\n var newNodes = exists ? newNode ?\n setIn(nodes, idx, newNode, isEditable) :\n spliceOut(nodes, idx, isEditable) :\n spliceIn(nodes, idx, newNode, isEditable);\n\n if (isEditable) {\n this.bitmap = newBitmap;\n this.nodes = newNodes;\n return this;\n }\n\n return new BitmapIndexedNode(ownerID, newBitmap, newNodes);\n };\n\n\n\n\n function HashArrayMapNode(ownerID, count, nodes) {\n this.ownerID = ownerID;\n this.count = count;\n this.nodes = nodes;\n }\n\n HashArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var node = this.nodes[idx];\n return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue;\n };\n\n HashArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var removed = value === NOT_SET;\n var nodes = this.nodes;\n var node = nodes[idx];\n\n if (removed && !node) {\n return this;\n }\n\n var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n if (newNode === node) {\n return this;\n }\n\n var newCount = this.count;\n if (!node) {\n newCount++;\n } else if (!newNode) {\n newCount--;\n if (newCount < MIN_HASH_ARRAY_MAP_SIZE) {\n return packNodes(ownerID, nodes, newCount, idx);\n }\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newNodes = setIn(nodes, idx, newNode, isEditable);\n\n if (isEditable) {\n this.count = newCount;\n this.nodes = newNodes;\n return this;\n }\n\n return new HashArrayMapNode(ownerID, newCount, newNodes);\n };\n\n\n\n\n function HashCollisionNode(ownerID, keyHash, entries) {\n this.ownerID = ownerID;\n this.keyHash = keyHash;\n this.entries = entries;\n }\n\n HashCollisionNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n var entries = this.entries;\n for (var ii = 0, len = entries.length; ii < len; ii++) {\n if (is(key, entries[ii][0])) {\n return entries[ii][1];\n }\n }\n return notSetValue;\n };\n\n HashCollisionNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n\n var removed = value === NOT_SET;\n\n if (keyHash !== this.keyHash) {\n if (removed) {\n return this;\n }\n SetRef(didAlter);\n SetRef(didChangeSize);\n return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]);\n }\n\n var entries = this.entries;\n var idx = 0;\n for (var len = entries.length; idx < len; idx++) {\n if (is(key, entries[idx][0])) {\n break;\n }\n }\n var exists = idx < len;\n\n if (exists ? entries[idx][1] === value : removed) {\n return this;\n }\n\n SetRef(didAlter);\n (removed || !exists) && SetRef(didChangeSize);\n\n if (removed && len === 2) {\n return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]);\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newEntries = isEditable ? entries : arrCopy(entries);\n\n if (exists) {\n if (removed) {\n idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());\n } else {\n newEntries[idx] = [key, value];\n }\n } else {\n newEntries.push([key, value]);\n }\n\n if (isEditable) {\n this.entries = newEntries;\n return this;\n }\n\n return new HashCollisionNode(ownerID, this.keyHash, newEntries);\n };\n\n\n\n\n function ValueNode(ownerID, keyHash, entry) {\n this.ownerID = ownerID;\n this.keyHash = keyHash;\n this.entry = entry;\n }\n\n ValueNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n return is(key, this.entry[0]) ? this.entry[1] : notSetValue;\n };\n\n ValueNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n var removed = value === NOT_SET;\n var keyMatch = is(key, this.entry[0]);\n if (keyMatch ? value === this.entry[1] : removed) {\n return this;\n }\n\n SetRef(didAlter);\n\n if (removed) {\n SetRef(didChangeSize);\n return; // undefined\n }\n\n if (keyMatch) {\n if (ownerID && ownerID === this.ownerID) {\n this.entry[1] = value;\n return this;\n }\n return new ValueNode(ownerID, this.keyHash, [key, value]);\n }\n\n SetRef(didChangeSize);\n return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]);\n };\n\n\n\n // #pragma Iterators\n\n ArrayMapNode.prototype.iterate =\n HashCollisionNode.prototype.iterate = function (fn, reverse) {\n var entries = this.entries;\n for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {\n if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {\n return false;\n }\n }\n }\n\n BitmapIndexedNode.prototype.iterate =\n HashArrayMapNode.prototype.iterate = function (fn, reverse) {\n var nodes = this.nodes;\n for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {\n var node = nodes[reverse ? maxIndex - ii : ii];\n if (node && node.iterate(fn, reverse) === false) {\n return false;\n }\n }\n }\n\n ValueNode.prototype.iterate = function (fn, reverse) {\n return fn(this.entry);\n }\n\n createClass(MapIterator, Iterator);\n\n function MapIterator(map, type, reverse) {\n this._type = type;\n this._reverse = reverse;\n this._stack = map._root && mapIteratorFrame(map._root);\n }\n\n MapIterator.prototype.next = function() {\n var type = this._type;\n var stack = this._stack;\n while (stack) {\n var node = stack.node;\n var index = stack.index++;\n var maxIndex;\n if (node.entry) {\n if (index === 0) {\n return mapIteratorValue(type, node.entry);\n }\n } else if (node.entries) {\n maxIndex = node.entries.length - 1;\n if (index <= maxIndex) {\n return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]);\n }\n } else {\n maxIndex = node.nodes.length - 1;\n if (index <= maxIndex) {\n var subNode = node.nodes[this._reverse ? maxIndex - index : index];\n if (subNode) {\n if (subNode.entry) {\n return mapIteratorValue(type, subNode.entry);\n }\n stack = this._stack = mapIteratorFrame(subNode, stack);\n }\n continue;\n }\n }\n stack = this._stack = this._stack.__prev;\n }\n return iteratorDone();\n };\n\n\n function mapIteratorValue(type, entry) {\n return iteratorValue(type, entry[0], entry[1]);\n }\n\n function mapIteratorFrame(node, prev) {\n return {\n node: node,\n index: 0,\n __prev: prev\n };\n }\n\n function makeMap(size, root, ownerID, hash) {\n var map = Object.create(MapPrototype);\n map.size = size;\n map._root = root;\n map.__ownerID = ownerID;\n map.__hash = hash;\n map.__altered = false;\n return map;\n }\n\n var EMPTY_MAP;\n function emptyMap() {\n return EMPTY_MAP || (EMPTY_MAP = makeMap(0));\n }\n\n function updateMap(map, k, v) {\n var newRoot;\n var newSize;\n if (!map._root) {\n if (v === NOT_SET) {\n return map;\n }\n newSize = 1;\n newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]);\n } else {\n var didChangeSize = MakeRef(CHANGE_LENGTH);\n var didAlter = MakeRef(DID_ALTER);\n newRoot = updateNode(map._root, map.__ownerID, 0, undefined, k, v, didChangeSize, didAlter);\n if (!didAlter.value) {\n return map;\n }\n newSize = map.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0);\n }\n if (map.__ownerID) {\n map.size = newSize;\n map._root = newRoot;\n map.__hash = undefined;\n map.__altered = true;\n return map;\n }\n return newRoot ? makeMap(newSize, newRoot) : emptyMap();\n }\n\n function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (!node) {\n if (value === NOT_SET) {\n return node;\n }\n SetRef(didAlter);\n SetRef(didChangeSize);\n return new ValueNode(ownerID, keyHash, [key, value]);\n }\n return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter);\n }\n\n function isLeafNode(node) {\n return node.constructor === ValueNode || node.constructor === HashCollisionNode;\n }\n\n function mergeIntoNode(node, ownerID, shift, keyHash, entry) {\n if (node.keyHash === keyHash) {\n return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]);\n }\n\n var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK;\n var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n\n var newNode;\n var nodes = idx1 === idx2 ?\n [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] :\n ((newNode = new ValueNode(ownerID, keyHash, entry)), idx1 < idx2 ? [node, newNode] : [newNode, node]);\n\n return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes);\n }\n\n function createNodes(ownerID, entries, key, value) {\n if (!ownerID) {\n ownerID = new OwnerID();\n }\n var node = new ValueNode(ownerID, hash(key), [key, value]);\n for (var ii = 0; ii < entries.length; ii++) {\n var entry = entries[ii];\n node = node.update(ownerID, 0, undefined, entry[0], entry[1]);\n }\n return node;\n }\n\n function packNodes(ownerID, nodes, count, excluding) {\n var bitmap = 0;\n var packedII = 0;\n var packedNodes = new Array(count);\n for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) {\n var node = nodes[ii];\n if (node !== undefined && ii !== excluding) {\n bitmap |= bit;\n packedNodes[packedII++] = node;\n }\n }\n return new BitmapIndexedNode(ownerID, bitmap, packedNodes);\n }\n\n function expandNodes(ownerID, nodes, bitmap, including, node) {\n var count = 0;\n var expandedNodes = new Array(SIZE);\n for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) {\n expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined;\n }\n expandedNodes[including] = node;\n return new HashArrayMapNode(ownerID, count + 1, expandedNodes);\n }\n\n function mergeIntoMapWith(map, merger, iterables) {\n var iters = [];\n for (var ii = 0; ii < iterables.length; ii++) {\n var value = iterables[ii];\n var iter = KeyedIterable(value);\n if (!isIterable(value)) {\n iter = iter.map(function(v ) {return fromJS(v)});\n }\n iters.push(iter);\n }\n return mergeIntoCollectionWith(map, merger, iters);\n }\n\n function deepMerger(existing, value, key) {\n return existing && existing.mergeDeep && isIterable(value) ?\n existing.mergeDeep(value) :\n is(existing, value) ? existing : value;\n }\n\n function deepMergerWith(merger) {\n return function(existing, value, key) {\n if (existing && existing.mergeDeepWith && isIterable(value)) {\n return existing.mergeDeepWith(merger, value);\n }\n var nextValue = merger(existing, value, key);\n return is(existing, nextValue) ? existing : nextValue;\n };\n }\n\n function mergeIntoCollectionWith(collection, merger, iters) {\n iters = iters.filter(function(x ) {return x.size !== 0});\n if (iters.length === 0) {\n return collection;\n }\n if (collection.size === 0 && !collection.__ownerID && iters.length === 1) {\n return collection.constructor(iters[0]);\n }\n return collection.withMutations(function(collection ) {\n var mergeIntoMap = merger ?\n function(value, key) {\n collection.update(key, NOT_SET, function(existing )\n {return existing === NOT_SET ? value : merger(existing, value, key)}\n );\n } :\n function(value, key) {\n collection.set(key, value);\n }\n for (var ii = 0; ii < iters.length; ii++) {\n iters[ii].forEach(mergeIntoMap);\n }\n });\n }\n\n function updateInDeepMap(existing, keyPathIter, notSetValue, updater) {\n var isNotSet = existing === NOT_SET;\n var step = keyPathIter.next();\n if (step.done) {\n var existingValue = isNotSet ? notSetValue : existing;\n var newValue = updater(existingValue);\n return newValue === existingValue ? existing : newValue;\n }\n invariant(\n isNotSet || (existing && existing.set),\n 'invalid keyPath'\n );\n var key = step.value;\n var nextExisting = isNotSet ? NOT_SET : existing.get(key, NOT_SET);\n var nextUpdated = updateInDeepMap(\n nextExisting,\n keyPathIter,\n notSetValue,\n updater\n );\n return nextUpdated === nextExisting ? existing :\n nextUpdated === NOT_SET ? existing.remove(key) :\n (isNotSet ? emptyMap() : existing).set(key, nextUpdated);\n }\n\n function popCount(x) {\n x = x - ((x >> 1) & 0x55555555);\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333);\n x = (x + (x >> 4)) & 0x0f0f0f0f;\n x = x + (x >> 8);\n x = x + (x >> 16);\n return x & 0x7f;\n }\n\n function setIn(array, idx, val, canEdit) {\n var newArray = canEdit ? array : arrCopy(array);\n newArray[idx] = val;\n return newArray;\n }\n\n function spliceIn(array, idx, val, canEdit) {\n var newLen = array.length + 1;\n if (canEdit && idx + 1 === newLen) {\n array[idx] = val;\n return array;\n }\n var newArray = new Array(newLen);\n var after = 0;\n for (var ii = 0; ii < newLen; ii++) {\n if (ii === idx) {\n newArray[ii] = val;\n after = -1;\n } else {\n newArray[ii] = array[ii + after];\n }\n }\n return newArray;\n }\n\n function spliceOut(array, idx, canEdit) {\n var newLen = array.length - 1;\n if (canEdit && idx === newLen) {\n array.pop();\n return array;\n }\n var newArray = new Array(newLen);\n var after = 0;\n for (var ii = 0; ii < newLen; ii++) {\n if (ii === idx) {\n after = 1;\n }\n newArray[ii] = array[ii + after];\n }\n return newArray;\n }\n\n var MAX_ARRAY_MAP_SIZE = SIZE / 4;\n var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;\n var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;\n\n createClass(List, IndexedCollection);\n\n // @pragma Construction\n\n function List(value) {\n var empty = emptyList();\n if (value === null || value === undefined) {\n return empty;\n }\n if (isList(value)) {\n return value;\n }\n var iter = IndexedIterable(value);\n var size = iter.size;\n if (size === 0) {\n return empty;\n }\n assertNotInfinite(size);\n if (size > 0 && size < SIZE) {\n return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));\n }\n return empty.withMutations(function(list ) {\n list.setSize(size);\n iter.forEach(function(v, i) {return list.set(i, v)});\n });\n }\n\n List.of = function(/*...values*/) {\n return this(arguments);\n };\n\n List.prototype.toString = function() {\n return this.__toString('List [', ']');\n };\n\n // @pragma Access\n\n List.prototype.get = function(index, notSetValue) {\n index = wrapIndex(this, index);\n if (index >= 0 && index < this.size) {\n index += this._origin;\n var node = listNodeFor(this, index);\n return node && node.array[index & MASK];\n }\n return notSetValue;\n };\n\n // @pragma Modification\n\n List.prototype.set = function(index, value) {\n return updateList(this, index, value);\n };\n\n List.prototype.remove = function(index) {\n return !this.has(index) ? this :\n index === 0 ? this.shift() :\n index === this.size - 1 ? this.pop() :\n this.splice(index, 1);\n };\n\n List.prototype.insert = function(index, value) {\n return this.splice(index, 0, value);\n };\n\n List.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = this._origin = this._capacity = 0;\n this._level = SHIFT;\n this._root = this._tail = null;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return emptyList();\n };\n\n List.prototype.push = function(/*...values*/) {\n var values = arguments;\n var oldSize = this.size;\n return this.withMutations(function(list ) {\n setListBounds(list, 0, oldSize + values.length);\n for (var ii = 0; ii < values.length; ii++) {\n list.set(oldSize + ii, values[ii]);\n }\n });\n };\n\n List.prototype.pop = function() {\n return setListBounds(this, 0, -1);\n };\n\n List.prototype.unshift = function(/*...values*/) {\n var values = arguments;\n return this.withMutations(function(list ) {\n setListBounds(list, -values.length);\n for (var ii = 0; ii < values.length; ii++) {\n list.set(ii, values[ii]);\n }\n });\n };\n\n List.prototype.shift = function() {\n return setListBounds(this, 1);\n };\n\n // @pragma Composition\n\n List.prototype.merge = function(/*...iters*/) {\n return mergeIntoListWith(this, undefined, arguments);\n };\n\n List.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoListWith(this, merger, iters);\n };\n\n List.prototype.mergeDeep = function(/*...iters*/) {\n return mergeIntoListWith(this, deepMerger, arguments);\n };\n\n List.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoListWith(this, deepMergerWith(merger), iters);\n };\n\n List.prototype.setSize = function(size) {\n return setListBounds(this, 0, size);\n };\n\n // @pragma Iteration\n\n List.prototype.slice = function(begin, end) {\n var size = this.size;\n if (wholeSlice(begin, end, size)) {\n return this;\n }\n return setListBounds(\n this,\n resolveBegin(begin, size),\n resolveEnd(end, size)\n );\n };\n\n List.prototype.__iterator = function(type, reverse) {\n var index = 0;\n var values = iterateList(this, reverse);\n return new Iterator(function() {\n var value = values();\n return value === DONE ?\n iteratorDone() :\n iteratorValue(type, index++, value);\n });\n };\n\n List.prototype.__iterate = function(fn, reverse) {\n var index = 0;\n var values = iterateList(this, reverse);\n var value;\n while ((value = values()) !== DONE) {\n if (fn(value, index++, this) === false) {\n break;\n }\n }\n return index;\n };\n\n List.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n if (!ownerID) {\n this.__ownerID = ownerID;\n return this;\n }\n return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash);\n };\n\n\n function isList(maybeList) {\n return !!(maybeList && maybeList[IS_LIST_SENTINEL]);\n }\n\n List.isList = isList;\n\n var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';\n\n var ListPrototype = List.prototype;\n ListPrototype[IS_LIST_SENTINEL] = true;\n ListPrototype[DELETE] = ListPrototype.remove;\n ListPrototype.setIn = MapPrototype.setIn;\n ListPrototype.deleteIn =\n ListPrototype.removeIn = MapPrototype.removeIn;\n ListPrototype.update = MapPrototype.update;\n ListPrototype.updateIn = MapPrototype.updateIn;\n ListPrototype.mergeIn = MapPrototype.mergeIn;\n ListPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n ListPrototype.withMutations = MapPrototype.withMutations;\n ListPrototype.asMutable = MapPrototype.asMutable;\n ListPrototype.asImmutable = MapPrototype.asImmutable;\n ListPrototype.wasAltered = MapPrototype.wasAltered;\n\n\n\n function VNode(array, ownerID) {\n this.array = array;\n this.ownerID = ownerID;\n }\n\n // TODO: seems like these methods are very similar\n\n VNode.prototype.removeBefore = function(ownerID, level, index) {\n if (index === level ? 1 << level : 0 || this.array.length === 0) {\n return this;\n }\n var originIndex = (index >>> level) & MASK;\n if (originIndex >= this.array.length) {\n return new VNode([], ownerID);\n }\n var removingFirst = originIndex === 0;\n var newChild;\n if (level > 0) {\n var oldChild = this.array[originIndex];\n newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index);\n if (newChild === oldChild && removingFirst) {\n return this;\n }\n }\n if (removingFirst && !newChild) {\n return this;\n }\n var editable = editableVNode(this, ownerID);\n if (!removingFirst) {\n for (var ii = 0; ii < originIndex; ii++) {\n editable.array[ii] = undefined;\n }\n }\n if (newChild) {\n editable.array[originIndex] = newChild;\n }\n return editable;\n };\n\n VNode.prototype.removeAfter = function(ownerID, level, index) {\n if (index === (level ? 1 << level : 0) || this.array.length === 0) {\n return this;\n }\n var sizeIndex = ((index - 1) >>> level) & MASK;\n if (sizeIndex >= this.array.length) {\n return this;\n }\n\n var newChild;\n if (level > 0) {\n var oldChild = this.array[sizeIndex];\n newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);\n if (newChild === oldChild && sizeIndex === this.array.length - 1) {\n return this;\n }\n }\n\n var editable = editableVNode(this, ownerID);\n editable.array.splice(sizeIndex + 1);\n if (newChild) {\n editable.array[sizeIndex] = newChild;\n }\n return editable;\n };\n\n\n\n var DONE = {};\n\n function iterateList(list, reverse) {\n var left = list._origin;\n var right = list._capacity;\n var tailPos = getTailOffset(right);\n var tail = list._tail;\n\n return iterateNodeOrLeaf(list._root, list._level, 0);\n\n function iterateNodeOrLeaf(node, level, offset) {\n return level === 0 ?\n iterateLeaf(node, offset) :\n iterateNode(node, level, offset);\n }\n\n function iterateLeaf(node, offset) {\n var array = offset === tailPos ? tail && tail.array : node && node.array;\n var from = offset > left ? 0 : left - offset;\n var to = right - offset;\n if (to > SIZE) {\n to = SIZE;\n }\n return function() {\n if (from === to) {\n return DONE;\n }\n var idx = reverse ? --to : from++;\n return array && array[idx];\n };\n }\n\n function iterateNode(node, level, offset) {\n var values;\n var array = node && node.array;\n var from = offset > left ? 0 : (left - offset) >> level;\n var to = ((right - offset) >> level) + 1;\n if (to > SIZE) {\n to = SIZE;\n }\n return function() {\n do {\n if (values) {\n var value = values();\n if (value !== DONE) {\n return value;\n }\n values = null;\n }\n if (from === to) {\n return DONE;\n }\n var idx = reverse ? --to : from++;\n values = iterateNodeOrLeaf(\n array && array[idx], level - SHIFT, offset + (idx << level)\n );\n } while (true);\n };\n }\n }\n\n function makeList(origin, capacity, level, root, tail, ownerID, hash) {\n var list = Object.create(ListPrototype);\n list.size = capacity - origin;\n list._origin = origin;\n list._capacity = capacity;\n list._level = level;\n list._root = root;\n list._tail = tail;\n list.__ownerID = ownerID;\n list.__hash = hash;\n list.__altered = false;\n return list;\n }\n\n var EMPTY_LIST;\n function emptyList() {\n return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT));\n }\n\n function updateList(list, index, value) {\n index = wrapIndex(list, index);\n\n if (index !== index) {\n return list;\n }\n\n if (index >= list.size || index < 0) {\n return list.withMutations(function(list ) {\n index < 0 ?\n setListBounds(list, index).set(0, value) :\n setListBounds(list, 0, index + 1).set(index, value)\n });\n }\n\n index += list._origin;\n\n var newTail = list._tail;\n var newRoot = list._root;\n var didAlter = MakeRef(DID_ALTER);\n if (index >= getTailOffset(list._capacity)) {\n newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);\n } else {\n newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter);\n }\n\n if (!didAlter.value) {\n return list;\n }\n\n if (list.__ownerID) {\n list._root = newRoot;\n list._tail = newTail;\n list.__hash = undefined;\n list.__altered = true;\n return list;\n }\n return makeList(list._origin, list._capacity, list._level, newRoot, newTail);\n }\n\n function updateVNode(node, ownerID, level, index, value, didAlter) {\n var idx = (index >>> level) & MASK;\n var nodeHas = node && idx < node.array.length;\n if (!nodeHas && value === undefined) {\n return node;\n }\n\n var newNode;\n\n if (level > 0) {\n var lowerNode = node && node.array[idx];\n var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter);\n if (newLowerNode === lowerNode) {\n return node;\n }\n newNode = editableVNode(node, ownerID);\n newNode.array[idx] = newLowerNode;\n return newNode;\n }\n\n if (nodeHas && node.array[idx] === value) {\n return node;\n }\n\n SetRef(didAlter);\n\n newNode = editableVNode(node, ownerID);\n if (value === undefined && idx === newNode.array.length - 1) {\n newNode.array.pop();\n } else {\n newNode.array[idx] = value;\n }\n return newNode;\n }\n\n function editableVNode(node, ownerID) {\n if (ownerID && node && ownerID === node.ownerID) {\n return node;\n }\n return new VNode(node ? node.array.slice() : [], ownerID);\n }\n\n function listNodeFor(list, rawIndex) {\n if (rawIndex >= getTailOffset(list._capacity)) {\n return list._tail;\n }\n if (rawIndex < 1 << (list._level + SHIFT)) {\n var node = list._root;\n var level = list._level;\n while (node && level > 0) {\n node = node.array[(rawIndex >>> level) & MASK];\n level -= SHIFT;\n }\n return node;\n }\n }\n\n function setListBounds(list, begin, end) {\n // Sanitize begin & end using this shorthand for ToInt32(argument)\n // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n if (begin !== undefined) {\n begin = begin | 0;\n }\n if (end !== undefined) {\n end = end | 0;\n }\n var owner = list.__ownerID || new OwnerID();\n var oldOrigin = list._origin;\n var oldCapacity = list._capacity;\n var newOrigin = oldOrigin + begin;\n var newCapacity = end === undefined ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end;\n if (newOrigin === oldOrigin && newCapacity === oldCapacity) {\n return list;\n }\n\n // If it's going to end after it starts, it's empty.\n if (newOrigin >= newCapacity) {\n return list.clear();\n }\n\n var newLevel = list._level;\n var newRoot = list._root;\n\n // New origin might need creating a higher root.\n var offsetShift = 0;\n while (newOrigin + offsetShift < 0) {\n newRoot = new VNode(newRoot && newRoot.array.length ? [undefined, newRoot] : [], owner);\n newLevel += SHIFT;\n offsetShift += 1 << newLevel;\n }\n if (offsetShift) {\n newOrigin += offsetShift;\n oldOrigin += offsetShift;\n newCapacity += offsetShift;\n oldCapacity += offsetShift;\n }\n\n var oldTailOffset = getTailOffset(oldCapacity);\n var newTailOffset = getTailOffset(newCapacity);\n\n // New size might need creating a higher root.\n while (newTailOffset >= 1 << (newLevel + SHIFT)) {\n newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner);\n newLevel += SHIFT;\n }\n\n // Locate or create the new tail.\n var oldTail = list._tail;\n var newTail = newTailOffset < oldTailOffset ?\n listNodeFor(list, newCapacity - 1) :\n newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail;\n\n // Merge Tail into tree.\n if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) {\n newRoot = editableVNode(newRoot, owner);\n var node = newRoot;\n for (var level = newLevel; level > SHIFT; level -= SHIFT) {\n var idx = (oldTailOffset >>> level) & MASK;\n node = node.array[idx] = editableVNode(node.array[idx], owner);\n }\n node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail;\n }\n\n // If the size has been reduced, there's a chance the tail needs to be trimmed.\n if (newCapacity < oldCapacity) {\n newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);\n }\n\n // If the new origin is within the tail, then we do not need a root.\n if (newOrigin >= newTailOffset) {\n newOrigin -= newTailOffset;\n newCapacity -= newTailOffset;\n newLevel = SHIFT;\n newRoot = null;\n newTail = newTail && newTail.removeBefore(owner, 0, newOrigin);\n\n // Otherwise, if the root has been trimmed, garbage collect.\n } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {\n offsetShift = 0;\n\n // Identify the new top root node of the subtree of the old root.\n while (newRoot) {\n var beginIndex = (newOrigin >>> newLevel) & MASK;\n if (beginIndex !== (newTailOffset >>> newLevel) & MASK) {\n break;\n }\n if (beginIndex) {\n offsetShift += (1 << newLevel) * beginIndex;\n }\n newLevel -= SHIFT;\n newRoot = newRoot.array[beginIndex];\n }\n\n // Trim the new sides of the new root.\n if (newRoot && newOrigin > oldOrigin) {\n newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift);\n }\n if (newRoot && newTailOffset < oldTailOffset) {\n newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift);\n }\n if (offsetShift) {\n newOrigin -= offsetShift;\n newCapacity -= offsetShift;\n }\n }\n\n if (list.__ownerID) {\n list.size = newCapacity - newOrigin;\n list._origin = newOrigin;\n list._capacity = newCapacity;\n list._level = newLevel;\n list._root = newRoot;\n list._tail = newTail;\n list.__hash = undefined;\n list.__altered = true;\n return list;\n }\n return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail);\n }\n\n function mergeIntoListWith(list, merger, iterables) {\n var iters = [];\n var maxSize = 0;\n for (var ii = 0; ii < iterables.length; ii++) {\n var value = iterables[ii];\n var iter = IndexedIterable(value);\n if (iter.size > maxSize) {\n maxSize = iter.size;\n }\n if (!isIterable(value)) {\n iter = iter.map(function(v ) {return fromJS(v)});\n }\n iters.push(iter);\n }\n if (maxSize > list.size) {\n list = list.setSize(maxSize);\n }\n return mergeIntoCollectionWith(list, merger, iters);\n }\n\n function getTailOffset(size) {\n return size < SIZE ? 0 : (((size - 1) >>> SHIFT) << SHIFT);\n }\n\n createClass(OrderedMap, Map);\n\n // @pragma Construction\n\n function OrderedMap(value) {\n return value === null || value === undefined ? emptyOrderedMap() :\n isOrderedMap(value) ? value :\n emptyOrderedMap().withMutations(function(map ) {\n var iter = KeyedIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v, k) {return map.set(k, v)});\n });\n }\n\n OrderedMap.of = function(/*...values*/) {\n return this(arguments);\n };\n\n OrderedMap.prototype.toString = function() {\n return this.__toString('OrderedMap {', '}');\n };\n\n // @pragma Access\n\n OrderedMap.prototype.get = function(k, notSetValue) {\n var index = this._map.get(k);\n return index !== undefined ? this._list.get(index)[1] : notSetValue;\n };\n\n // @pragma Modification\n\n OrderedMap.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = 0;\n this._map.clear();\n this._list.clear();\n return this;\n }\n return emptyOrderedMap();\n };\n\n OrderedMap.prototype.set = function(k, v) {\n return updateOrderedMap(this, k, v);\n };\n\n OrderedMap.prototype.remove = function(k) {\n return updateOrderedMap(this, k, NOT_SET);\n };\n\n OrderedMap.prototype.wasAltered = function() {\n return this._map.wasAltered() || this._list.wasAltered();\n };\n\n OrderedMap.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._list.__iterate(\n function(entry ) {return entry && fn(entry[1], entry[0], this$0)},\n reverse\n );\n };\n\n OrderedMap.prototype.__iterator = function(type, reverse) {\n return this._list.fromEntrySeq().__iterator(type, reverse);\n };\n\n OrderedMap.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n var newMap = this._map.__ensureOwner(ownerID);\n var newList = this._list.__ensureOwner(ownerID);\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n this._list = newList;\n return this;\n }\n return makeOrderedMap(newMap, newList, ownerID, this.__hash);\n };\n\n\n function isOrderedMap(maybeOrderedMap) {\n return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);\n }\n\n OrderedMap.isOrderedMap = isOrderedMap;\n\n OrderedMap.prototype[IS_ORDERED_SENTINEL] = true;\n OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;\n\n\n\n function makeOrderedMap(map, list, ownerID, hash) {\n var omap = Object.create(OrderedMap.prototype);\n omap.size = map ? map.size : 0;\n omap._map = map;\n omap._list = list;\n omap.__ownerID = ownerID;\n omap.__hash = hash;\n return omap;\n }\n\n var EMPTY_ORDERED_MAP;\n function emptyOrderedMap() {\n return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList()));\n }\n\n function updateOrderedMap(omap, k, v) {\n var map = omap._map;\n var list = omap._list;\n var i = map.get(k);\n var has = i !== undefined;\n var newMap;\n var newList;\n if (v === NOT_SET) { // removed\n if (!has) {\n return omap;\n }\n if (list.size >= SIZE && list.size >= map.size * 2) {\n newList = list.filter(function(entry, idx) {return entry !== undefined && i !== idx});\n newMap = newList.toKeyedSeq().map(function(entry ) {return entry[0]}).flip().toMap();\n if (omap.__ownerID) {\n newMap.__ownerID = newList.__ownerID = omap.__ownerID;\n }\n } else {\n newMap = map.remove(k);\n newList = i === list.size - 1 ? list.pop() : list.set(i, undefined);\n }\n } else {\n if (has) {\n if (v === list.get(i)[1]) {\n return omap;\n }\n newMap = map;\n newList = list.set(i, [k, v]);\n } else {\n newMap = map.set(k, list.size);\n newList = list.set(list.size, [k, v]);\n }\n }\n if (omap.__ownerID) {\n omap.size = newMap.size;\n omap._map = newMap;\n omap._list = newList;\n omap.__hash = undefined;\n return omap;\n }\n return makeOrderedMap(newMap, newList);\n }\n\n createClass(ToKeyedSequence, KeyedSeq);\n function ToKeyedSequence(indexed, useKeys) {\n this._iter = indexed;\n this._useKeys = useKeys;\n this.size = indexed.size;\n }\n\n ToKeyedSequence.prototype.get = function(key, notSetValue) {\n return this._iter.get(key, notSetValue);\n };\n\n ToKeyedSequence.prototype.has = function(key) {\n return this._iter.has(key);\n };\n\n ToKeyedSequence.prototype.valueSeq = function() {\n return this._iter.valueSeq();\n };\n\n ToKeyedSequence.prototype.reverse = function() {var this$0 = this;\n var reversedSequence = reverseFactory(this, true);\n if (!this._useKeys) {\n reversedSequence.valueSeq = function() {return this$0._iter.toSeq().reverse()};\n }\n return reversedSequence;\n };\n\n ToKeyedSequence.prototype.map = function(mapper, context) {var this$0 = this;\n var mappedSequence = mapFactory(this, mapper, context);\n if (!this._useKeys) {\n mappedSequence.valueSeq = function() {return this$0._iter.toSeq().map(mapper, context)};\n }\n return mappedSequence;\n };\n\n ToKeyedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n var ii;\n return this._iter.__iterate(\n this._useKeys ?\n function(v, k) {return fn(v, k, this$0)} :\n ((ii = reverse ? resolveSize(this) : 0),\n function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}),\n reverse\n );\n };\n\n ToKeyedSequence.prototype.__iterator = function(type, reverse) {\n if (this._useKeys) {\n return this._iter.__iterator(type, reverse);\n }\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n var ii = reverse ? resolveSize(this) : 0;\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step :\n iteratorValue(type, reverse ? --ii : ii++, step.value, step);\n });\n };\n\n ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n createClass(ToIndexedSequence, IndexedSeq);\n function ToIndexedSequence(iter) {\n this._iter = iter;\n this.size = iter.size;\n }\n\n ToIndexedSequence.prototype.includes = function(value) {\n return this._iter.includes(value);\n };\n\n ToIndexedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n var iterations = 0;\n return this._iter.__iterate(function(v ) {return fn(v, iterations++, this$0)}, reverse);\n };\n\n ToIndexedSequence.prototype.__iterator = function(type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n var iterations = 0;\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step :\n iteratorValue(type, iterations++, step.value, step)\n });\n };\n\n\n\n createClass(ToSetSequence, SetSeq);\n function ToSetSequence(iter) {\n this._iter = iter;\n this.size = iter.size;\n }\n\n ToSetSequence.prototype.has = function(key) {\n return this._iter.includes(key);\n };\n\n ToSetSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._iter.__iterate(function(v ) {return fn(v, v, this$0)}, reverse);\n };\n\n ToSetSequence.prototype.__iterator = function(type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step :\n iteratorValue(type, step.value, step.value, step);\n });\n };\n\n\n\n createClass(FromEntriesSequence, KeyedSeq);\n function FromEntriesSequence(entries) {\n this._iter = entries;\n this.size = entries.size;\n }\n\n FromEntriesSequence.prototype.entrySeq = function() {\n return this._iter.toSeq();\n };\n\n FromEntriesSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._iter.__iterate(function(entry ) {\n // Check if entry exists first so array access doesn't throw for holes\n // in the parent iteration.\n if (entry) {\n validateEntry(entry);\n var indexedIterable = isIterable(entry);\n return fn(\n indexedIterable ? entry.get(1) : entry[1],\n indexedIterable ? entry.get(0) : entry[0],\n this$0\n );\n }\n }, reverse);\n };\n\n FromEntriesSequence.prototype.__iterator = function(type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n return new Iterator(function() {\n while (true) {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n // Check if entry exists first so array access doesn't throw for holes\n // in the parent iteration.\n if (entry) {\n validateEntry(entry);\n var indexedIterable = isIterable(entry);\n return iteratorValue(\n type,\n indexedIterable ? entry.get(0) : entry[0],\n indexedIterable ? entry.get(1) : entry[1],\n step\n );\n }\n }\n });\n };\n\n\n ToIndexedSequence.prototype.cacheResult =\n ToKeyedSequence.prototype.cacheResult =\n ToSetSequence.prototype.cacheResult =\n FromEntriesSequence.prototype.cacheResult =\n cacheResultThrough;\n\n\n function flipFactory(iterable) {\n var flipSequence = makeSequence(iterable);\n flipSequence._iter = iterable;\n flipSequence.size = iterable.size;\n flipSequence.flip = function() {return iterable};\n flipSequence.reverse = function () {\n var reversedSequence = iterable.reverse.apply(this); // super.reverse()\n reversedSequence.flip = function() {return iterable.reverse()};\n return reversedSequence;\n };\n flipSequence.has = function(key ) {return iterable.includes(key)};\n flipSequence.includes = function(key ) {return iterable.has(key)};\n flipSequence.cacheResult = cacheResultThrough;\n flipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n return iterable.__iterate(function(v, k) {return fn(k, v, this$0) !== false}, reverse);\n }\n flipSequence.__iteratorUncached = function(type, reverse) {\n if (type === ITERATE_ENTRIES) {\n var iterator = iterable.__iterator(type, reverse);\n return new Iterator(function() {\n var step = iterator.next();\n if (!step.done) {\n var k = step.value[0];\n step.value[0] = step.value[1];\n step.value[1] = k;\n }\n return step;\n });\n }\n return iterable.__iterator(\n type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES,\n reverse\n );\n }\n return flipSequence;\n }\n\n\n function mapFactory(iterable, mapper, context) {\n var mappedSequence = makeSequence(iterable);\n mappedSequence.size = iterable.size;\n mappedSequence.has = function(key ) {return iterable.has(key)};\n mappedSequence.get = function(key, notSetValue) {\n var v = iterable.get(key, NOT_SET);\n return v === NOT_SET ?\n notSetValue :\n mapper.call(context, v, key, iterable);\n };\n mappedSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n return iterable.__iterate(\n function(v, k, c) {return fn(mapper.call(context, v, k, c), k, this$0) !== false},\n reverse\n );\n }\n mappedSequence.__iteratorUncached = function (type, reverse) {\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n return new Iterator(function() {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n var key = entry[0];\n return iteratorValue(\n type,\n key,\n mapper.call(context, entry[1], key, iterable),\n step\n );\n });\n }\n return mappedSequence;\n }\n\n\n function reverseFactory(iterable, useKeys) {\n var reversedSequence = makeSequence(iterable);\n reversedSequence._iter = iterable;\n reversedSequence.size = iterable.size;\n reversedSequence.reverse = function() {return iterable};\n if (iterable.flip) {\n reversedSequence.flip = function () {\n var flipSequence = flipFactory(iterable);\n flipSequence.reverse = function() {return iterable.flip()};\n return flipSequence;\n };\n }\n reversedSequence.get = function(key, notSetValue) \n {return iterable.get(useKeys ? key : -1 - key, notSetValue)};\n reversedSequence.has = function(key )\n {return iterable.has(useKeys ? key : -1 - key)};\n reversedSequence.includes = function(value ) {return iterable.includes(value)};\n reversedSequence.cacheResult = cacheResultThrough;\n reversedSequence.__iterate = function (fn, reverse) {var this$0 = this;\n return iterable.__iterate(function(v, k) {return fn(v, k, this$0)}, !reverse);\n };\n reversedSequence.__iterator =\n function(type, reverse) {return iterable.__iterator(type, !reverse)};\n return reversedSequence;\n }\n\n\n function filterFactory(iterable, predicate, context, useKeys) {\n var filterSequence = makeSequence(iterable);\n if (useKeys) {\n filterSequence.has = function(key ) {\n var v = iterable.get(key, NOT_SET);\n return v !== NOT_SET && !!predicate.call(context, v, key, iterable);\n };\n filterSequence.get = function(key, notSetValue) {\n var v = iterable.get(key, NOT_SET);\n return v !== NOT_SET && predicate.call(context, v, key, iterable) ?\n v : notSetValue;\n };\n }\n filterSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n var iterations = 0;\n iterable.__iterate(function(v, k, c) {\n if (predicate.call(context, v, k, c)) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0);\n }\n }, reverse);\n return iterations;\n };\n filterSequence.__iteratorUncached = function (type, reverse) {\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n var iterations = 0;\n return new Iterator(function() {\n while (true) {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n var key = entry[0];\n var value = entry[1];\n if (predicate.call(context, value, key, iterable)) {\n return iteratorValue(type, useKeys ? key : iterations++, value, step);\n }\n }\n });\n }\n return filterSequence;\n }\n\n\n function countByFactory(iterable, grouper, context) {\n var groups = Map().asMutable();\n iterable.__iterate(function(v, k) {\n groups.update(\n grouper.call(context, v, k, iterable),\n 0,\n function(a ) {return a + 1}\n );\n });\n return groups.asImmutable();\n }\n\n\n function groupByFactory(iterable, grouper, context) {\n var isKeyedIter = isKeyed(iterable);\n var groups = (isOrdered(iterable) ? OrderedMap() : Map()).asMutable();\n iterable.__iterate(function(v, k) {\n groups.update(\n grouper.call(context, v, k, iterable),\n function(a ) {return (a = a || [], a.push(isKeyedIter ? [k, v] : v), a)}\n );\n });\n var coerce = iterableClass(iterable);\n return groups.map(function(arr ) {return reify(iterable, coerce(arr))});\n }\n\n\n function sliceFactory(iterable, begin, end, useKeys) {\n var originalSize = iterable.size;\n\n // Sanitize begin & end using this shorthand for ToInt32(argument)\n // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n if (begin !== undefined) {\n begin = begin | 0;\n }\n if (end !== undefined) {\n if (end === Infinity) {\n end = originalSize;\n } else {\n end = end | 0;\n }\n }\n\n if (wholeSlice(begin, end, originalSize)) {\n return iterable;\n }\n\n var resolvedBegin = resolveBegin(begin, originalSize);\n var resolvedEnd = resolveEnd(end, originalSize);\n\n // begin or end will be NaN if they were provided as negative numbers and\n // this iterable's size is unknown. In that case, cache first so there is\n // a known size and these do not resolve to NaN.\n if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) {\n return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys);\n }\n\n // Note: resolvedEnd is undefined when the original sequence's length is\n // unknown and this slice did not supply an end and should contain all\n // elements after resolvedBegin.\n // In that case, resolvedSize will be NaN and sliceSize will remain undefined.\n var resolvedSize = resolvedEnd - resolvedBegin;\n var sliceSize;\n if (resolvedSize === resolvedSize) {\n sliceSize = resolvedSize < 0 ? 0 : resolvedSize;\n }\n\n var sliceSeq = makeSequence(iterable);\n\n // If iterable.size is undefined, the size of the realized sliceSeq is\n // unknown at this point unless the number of items to slice is 0\n sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined;\n\n if (!useKeys && isSeq(iterable) && sliceSize >= 0) {\n sliceSeq.get = function (index, notSetValue) {\n index = wrapIndex(this, index);\n return index >= 0 && index < sliceSize ?\n iterable.get(index + resolvedBegin, notSetValue) :\n notSetValue;\n }\n }\n\n sliceSeq.__iterateUncached = function(fn, reverse) {var this$0 = this;\n if (sliceSize === 0) {\n return 0;\n }\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var skipped = 0;\n var isSkipping = true;\n var iterations = 0;\n iterable.__iterate(function(v, k) {\n if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0) !== false &&\n iterations !== sliceSize;\n }\n });\n return iterations;\n };\n\n sliceSeq.__iteratorUncached = function(type, reverse) {\n if (sliceSize !== 0 && reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n // Don't bother instantiating parent iterator if taking 0.\n var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse);\n var skipped = 0;\n var iterations = 0;\n return new Iterator(function() {\n while (skipped++ < resolvedBegin) {\n iterator.next();\n }\n if (++iterations > sliceSize) {\n return iteratorDone();\n }\n var step = iterator.next();\n if (useKeys || type === ITERATE_VALUES) {\n return step;\n } else if (type === ITERATE_KEYS) {\n return iteratorValue(type, iterations - 1, undefined, step);\n } else {\n return iteratorValue(type, iterations - 1, step.value[1], step);\n }\n });\n }\n\n return sliceSeq;\n }\n\n\n function takeWhileFactory(iterable, predicate, context) {\n var takeSequence = makeSequence(iterable);\n takeSequence.__iterateUncached = function(fn, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var iterations = 0;\n iterable.__iterate(function(v, k, c) \n {return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0)}\n );\n return iterations;\n };\n takeSequence.__iteratorUncached = function(type, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n var iterating = true;\n return new Iterator(function() {\n if (!iterating) {\n return iteratorDone();\n }\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n var k = entry[0];\n var v = entry[1];\n if (!predicate.call(context, v, k, this$0)) {\n iterating = false;\n return iteratorDone();\n }\n return type === ITERATE_ENTRIES ? step :\n iteratorValue(type, k, v, step);\n });\n };\n return takeSequence;\n }\n\n\n function skipWhileFactory(iterable, predicate, context, useKeys) {\n var skipSequence = makeSequence(iterable);\n skipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var isSkipping = true;\n var iterations = 0;\n iterable.__iterate(function(v, k, c) {\n if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0);\n }\n });\n return iterations;\n };\n skipSequence.__iteratorUncached = function(type, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n var skipping = true;\n var iterations = 0;\n return new Iterator(function() {\n var step, k, v;\n do {\n step = iterator.next();\n if (step.done) {\n if (useKeys || type === ITERATE_VALUES) {\n return step;\n } else if (type === ITERATE_KEYS) {\n return iteratorValue(type, iterations++, undefined, step);\n } else {\n return iteratorValue(type, iterations++, step.value[1], step);\n }\n }\n var entry = step.value;\n k = entry[0];\n v = entry[1];\n skipping && (skipping = predicate.call(context, v, k, this$0));\n } while (skipping);\n return type === ITERATE_ENTRIES ? step :\n iteratorValue(type, k, v, step);\n });\n };\n return skipSequence;\n }\n\n\n function concatFactory(iterable, values) {\n var isKeyedIterable = isKeyed(iterable);\n var iters = [iterable].concat(values).map(function(v ) {\n if (!isIterable(v)) {\n v = isKeyedIterable ?\n keyedSeqFromValue(v) :\n indexedSeqFromValue(Array.isArray(v) ? v : [v]);\n } else if (isKeyedIterable) {\n v = KeyedIterable(v);\n }\n return v;\n }).filter(function(v ) {return v.size !== 0});\n\n if (iters.length === 0) {\n return iterable;\n }\n\n if (iters.length === 1) {\n var singleton = iters[0];\n if (singleton === iterable ||\n isKeyedIterable && isKeyed(singleton) ||\n isIndexed(iterable) && isIndexed(singleton)) {\n return singleton;\n }\n }\n\n var concatSeq = new ArraySeq(iters);\n if (isKeyedIterable) {\n concatSeq = concatSeq.toKeyedSeq();\n } else if (!isIndexed(iterable)) {\n concatSeq = concatSeq.toSetSeq();\n }\n concatSeq = concatSeq.flatten(true);\n concatSeq.size = iters.reduce(\n function(sum, seq) {\n if (sum !== undefined) {\n var size = seq.size;\n if (size !== undefined) {\n return sum + size;\n }\n }\n },\n 0\n );\n return concatSeq;\n }\n\n\n function flattenFactory(iterable, depth, useKeys) {\n var flatSequence = makeSequence(iterable);\n flatSequence.__iterateUncached = function(fn, reverse) {\n var iterations = 0;\n var stopped = false;\n function flatDeep(iter, currentDepth) {var this$0 = this;\n iter.__iterate(function(v, k) {\n if ((!depth || currentDepth < depth) && isIterable(v)) {\n flatDeep(v, currentDepth + 1);\n } else if (fn(v, useKeys ? k : iterations++, this$0) === false) {\n stopped = true;\n }\n return !stopped;\n }, reverse);\n }\n flatDeep(iterable, 0);\n return iterations;\n }\n flatSequence.__iteratorUncached = function(type, reverse) {\n var iterator = iterable.__iterator(type, reverse);\n var stack = [];\n var iterations = 0;\n return new Iterator(function() {\n while (iterator) {\n var step = iterator.next();\n if (step.done !== false) {\n iterator = stack.pop();\n continue;\n }\n var v = step.value;\n if (type === ITERATE_ENTRIES) {\n v = v[1];\n }\n if ((!depth || stack.length < depth) && isIterable(v)) {\n stack.push(iterator);\n iterator = v.__iterator(type, reverse);\n } else {\n return useKeys ? step : iteratorValue(type, iterations++, v, step);\n }\n }\n return iteratorDone();\n });\n }\n return flatSequence;\n }\n\n\n function flatMapFactory(iterable, mapper, context) {\n var coerce = iterableClass(iterable);\n return iterable.toSeq().map(\n function(v, k) {return coerce(mapper.call(context, v, k, iterable))}\n ).flatten(true);\n }\n\n\n function interposeFactory(iterable, separator) {\n var interposedSequence = makeSequence(iterable);\n interposedSequence.size = iterable.size && iterable.size * 2 -1;\n interposedSequence.__iterateUncached = function(fn, reverse) {var this$0 = this;\n var iterations = 0;\n iterable.__iterate(function(v, k) \n {return (!iterations || fn(separator, iterations++, this$0) !== false) &&\n fn(v, iterations++, this$0) !== false},\n reverse\n );\n return iterations;\n };\n interposedSequence.__iteratorUncached = function(type, reverse) {\n var iterator = iterable.__iterator(ITERATE_VALUES, reverse);\n var iterations = 0;\n var step;\n return new Iterator(function() {\n if (!step || iterations % 2) {\n step = iterator.next();\n if (step.done) {\n return step;\n }\n }\n return iterations % 2 ?\n iteratorValue(type, iterations++, separator) :\n iteratorValue(type, iterations++, step.value, step);\n });\n };\n return interposedSequence;\n }\n\n\n function sortFactory(iterable, comparator, mapper) {\n if (!comparator) {\n comparator = defaultComparator;\n }\n var isKeyedIterable = isKeyed(iterable);\n var index = 0;\n var entries = iterable.toSeq().map(\n function(v, k) {return [k, v, index++, mapper ? mapper(v, k, iterable) : v]}\n ).toArray();\n entries.sort(function(a, b) {return comparator(a[3], b[3]) || a[2] - b[2]}).forEach(\n isKeyedIterable ?\n function(v, i) { entries[i].length = 2; } :\n function(v, i) { entries[i] = v[1]; }\n );\n return isKeyedIterable ? KeyedSeq(entries) :\n isIndexed(iterable) ? IndexedSeq(entries) :\n SetSeq(entries);\n }\n\n\n function maxFactory(iterable, comparator, mapper) {\n if (!comparator) {\n comparator = defaultComparator;\n }\n if (mapper) {\n var entry = iterable.toSeq()\n .map(function(v, k) {return [v, mapper(v, k, iterable)]})\n .reduce(function(a, b) {return maxCompare(comparator, a[1], b[1]) ? b : a});\n return entry && entry[0];\n } else {\n return iterable.reduce(function(a, b) {return maxCompare(comparator, a, b) ? b : a});\n }\n }\n\n function maxCompare(comparator, a, b) {\n var comp = comparator(b, a);\n // b is considered the new max if the comparator declares them equal, but\n // they are not equal and b is in fact a nullish value.\n return (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || comp > 0;\n }\n\n\n function zipWithFactory(keyIter, zipper, iters) {\n var zipSequence = makeSequence(keyIter);\n zipSequence.size = new ArraySeq(iters).map(function(i ) {return i.size}).min();\n // Note: this a generic base implementation of __iterate in terms of\n // __iterator which may be more generically useful in the future.\n zipSequence.__iterate = function(fn, reverse) {\n /* generic:\n var iterator = this.__iterator(ITERATE_ENTRIES, reverse);\n var step;\n var iterations = 0;\n while (!(step = iterator.next()).done) {\n iterations++;\n if (fn(step.value[1], step.value[0], this) === false) {\n break;\n }\n }\n return iterations;\n */\n // indexed:\n var iterator = this.__iterator(ITERATE_VALUES, reverse);\n var step;\n var iterations = 0;\n while (!(step = iterator.next()).done) {\n if (fn(step.value, iterations++, this) === false) {\n break;\n }\n }\n return iterations;\n };\n zipSequence.__iteratorUncached = function(type, reverse) {\n var iterators = iters.map(function(i )\n {return (i = Iterable(i), getIterator(reverse ? i.reverse() : i))}\n );\n var iterations = 0;\n var isDone = false;\n return new Iterator(function() {\n var steps;\n if (!isDone) {\n steps = iterators.map(function(i ) {return i.next()});\n isDone = steps.some(function(s ) {return s.done});\n }\n if (isDone) {\n return iteratorDone();\n }\n return iteratorValue(\n type,\n iterations++,\n zipper.apply(null, steps.map(function(s ) {return s.value}))\n );\n });\n };\n return zipSequence\n }\n\n\n // #pragma Helper Functions\n\n function reify(iter, seq) {\n return isSeq(iter) ? seq : iter.constructor(seq);\n }\n\n function validateEntry(entry) {\n if (entry !== Object(entry)) {\n throw new TypeError('Expected [K, V] tuple: ' + entry);\n }\n }\n\n function resolveSize(iter) {\n assertNotInfinite(iter.size);\n return ensureSize(iter);\n }\n\n function iterableClass(iterable) {\n return isKeyed(iterable) ? KeyedIterable :\n isIndexed(iterable) ? IndexedIterable :\n SetIterable;\n }\n\n function makeSequence(iterable) {\n return Object.create(\n (\n isKeyed(iterable) ? KeyedSeq :\n isIndexed(iterable) ? IndexedSeq :\n SetSeq\n ).prototype\n );\n }\n\n function cacheResultThrough() {\n if (this._iter.cacheResult) {\n this._iter.cacheResult();\n this.size = this._iter.size;\n return this;\n } else {\n return Seq.prototype.cacheResult.call(this);\n }\n }\n\n function defaultComparator(a, b) {\n return a > b ? 1 : a < b ? -1 : 0;\n }\n\n function forceIterator(keyPath) {\n var iter = getIterator(keyPath);\n if (!iter) {\n // Array might not be iterable in this environment, so we need a fallback\n // to our wrapped type.\n if (!isArrayLike(keyPath)) {\n throw new TypeError('Expected iterable or array-like: ' + keyPath);\n }\n iter = getIterator(Iterable(keyPath));\n }\n return iter;\n }\n\n createClass(Record, KeyedCollection);\n\n function Record(defaultValues, name) {\n var hasInitialized;\n\n var RecordType = function Record(values) {\n if (values instanceof RecordType) {\n return values;\n }\n if (!(this instanceof RecordType)) {\n return new RecordType(values);\n }\n if (!hasInitialized) {\n hasInitialized = true;\n var keys = Object.keys(defaultValues);\n setProps(RecordTypePrototype, keys);\n RecordTypePrototype.size = keys.length;\n RecordTypePrototype._name = name;\n RecordTypePrototype._keys = keys;\n RecordTypePrototype._defaultValues = defaultValues;\n }\n this._map = Map(values);\n };\n\n var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype);\n RecordTypePrototype.constructor = RecordType;\n\n return RecordType;\n }\n\n Record.prototype.toString = function() {\n return this.__toString(recordName(this) + ' {', '}');\n };\n\n // @pragma Access\n\n Record.prototype.has = function(k) {\n return this._defaultValues.hasOwnProperty(k);\n };\n\n Record.prototype.get = function(k, notSetValue) {\n if (!this.has(k)) {\n return notSetValue;\n }\n var defaultVal = this._defaultValues[k];\n return this._map ? this._map.get(k, defaultVal) : defaultVal;\n };\n\n // @pragma Modification\n\n Record.prototype.clear = function() {\n if (this.__ownerID) {\n this._map && this._map.clear();\n return this;\n }\n var RecordType = this.constructor;\n return RecordType._empty || (RecordType._empty = makeRecord(this, emptyMap()));\n };\n\n Record.prototype.set = function(k, v) {\n if (!this.has(k)) {\n throw new Error('Cannot set unknown key \"' + k + '\" on ' + recordName(this));\n }\n if (this._map && !this._map.has(k)) {\n var defaultVal = this._defaultValues[k];\n if (v === defaultVal) {\n return this;\n }\n }\n var newMap = this._map && this._map.set(k, v);\n if (this.__ownerID || newMap === this._map) {\n return this;\n }\n return makeRecord(this, newMap);\n };\n\n Record.prototype.remove = function(k) {\n if (!this.has(k)) {\n return this;\n }\n var newMap = this._map && this._map.remove(k);\n if (this.__ownerID || newMap === this._map) {\n return this;\n }\n return makeRecord(this, newMap);\n };\n\n Record.prototype.wasAltered = function() {\n return this._map.wasAltered();\n };\n\n Record.prototype.__iterator = function(type, reverse) {var this$0 = this;\n return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterator(type, reverse);\n };\n\n Record.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterate(fn, reverse);\n };\n\n Record.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n var newMap = this._map && this._map.__ensureOwner(ownerID);\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n return this;\n }\n return makeRecord(this, newMap, ownerID);\n };\n\n\n var RecordPrototype = Record.prototype;\n RecordPrototype[DELETE] = RecordPrototype.remove;\n RecordPrototype.deleteIn =\n RecordPrototype.removeIn = MapPrototype.removeIn;\n RecordPrototype.merge = MapPrototype.merge;\n RecordPrototype.mergeWith = MapPrototype.mergeWith;\n RecordPrototype.mergeIn = MapPrototype.mergeIn;\n RecordPrototype.mergeDeep = MapPrototype.mergeDeep;\n RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith;\n RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n RecordPrototype.setIn = MapPrototype.setIn;\n RecordPrototype.update = MapPrototype.update;\n RecordPrototype.updateIn = MapPrototype.updateIn;\n RecordPrototype.withMutations = MapPrototype.withMutations;\n RecordPrototype.asMutable = MapPrototype.asMutable;\n RecordPrototype.asImmutable = MapPrototype.asImmutable;\n\n\n function makeRecord(likeRecord, map, ownerID) {\n var record = Object.create(Object.getPrototypeOf(likeRecord));\n record._map = map;\n record.__ownerID = ownerID;\n return record;\n }\n\n function recordName(record) {\n return record._name || record.constructor.name || 'Record';\n }\n\n function setProps(prototype, names) {\n try {\n names.forEach(setProp.bind(undefined, prototype));\n } catch (error) {\n // Object.defineProperty failed. Probably IE8.\n }\n }\n\n function setProp(prototype, name) {\n Object.defineProperty(prototype, name, {\n get: function() {\n return this.get(name);\n },\n set: function(value) {\n invariant(this.__ownerID, 'Cannot set on an immutable record.');\n this.set(name, value);\n }\n });\n }\n\n createClass(Set, SetCollection);\n\n // @pragma Construction\n\n function Set(value) {\n return value === null || value === undefined ? emptySet() :\n isSet(value) && !isOrdered(value) ? value :\n emptySet().withMutations(function(set ) {\n var iter = SetIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v ) {return set.add(v)});\n });\n }\n\n Set.of = function(/*...values*/) {\n return this(arguments);\n };\n\n Set.fromKeys = function(value) {\n return this(KeyedIterable(value).keySeq());\n };\n\n Set.prototype.toString = function() {\n return this.__toString('Set {', '}');\n };\n\n // @pragma Access\n\n Set.prototype.has = function(value) {\n return this._map.has(value);\n };\n\n // @pragma Modification\n\n Set.prototype.add = function(value) {\n return updateSet(this, this._map.set(value, true));\n };\n\n Set.prototype.remove = function(value) {\n return updateSet(this, this._map.remove(value));\n };\n\n Set.prototype.clear = function() {\n return updateSet(this, this._map.clear());\n };\n\n // @pragma Composition\n\n Set.prototype.union = function() {var iters = SLICE$0.call(arguments, 0);\n iters = iters.filter(function(x ) {return x.size !== 0});\n if (iters.length === 0) {\n return this;\n }\n if (this.size === 0 && !this.__ownerID && iters.length === 1) {\n return this.constructor(iters[0]);\n }\n return this.withMutations(function(set ) {\n for (var ii = 0; ii < iters.length; ii++) {\n SetIterable(iters[ii]).forEach(function(value ) {return set.add(value)});\n }\n });\n };\n\n Set.prototype.intersect = function() {var iters = SLICE$0.call(arguments, 0);\n if (iters.length === 0) {\n return this;\n }\n iters = iters.map(function(iter ) {return SetIterable(iter)});\n var originalSet = this;\n return this.withMutations(function(set ) {\n originalSet.forEach(function(value ) {\n if (!iters.every(function(iter ) {return iter.includes(value)})) {\n set.remove(value);\n }\n });\n });\n };\n\n Set.prototype.subtract = function() {var iters = SLICE$0.call(arguments, 0);\n if (iters.length === 0) {\n return this;\n }\n iters = iters.map(function(iter ) {return SetIterable(iter)});\n var originalSet = this;\n return this.withMutations(function(set ) {\n originalSet.forEach(function(value ) {\n if (iters.some(function(iter ) {return iter.includes(value)})) {\n set.remove(value);\n }\n });\n });\n };\n\n Set.prototype.merge = function() {\n return this.union.apply(this, arguments);\n };\n\n Set.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return this.union.apply(this, iters);\n };\n\n Set.prototype.sort = function(comparator) {\n // Late binding\n return OrderedSet(sortFactory(this, comparator));\n };\n\n Set.prototype.sortBy = function(mapper, comparator) {\n // Late binding\n return OrderedSet(sortFactory(this, comparator, mapper));\n };\n\n Set.prototype.wasAltered = function() {\n return this._map.wasAltered();\n };\n\n Set.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._map.__iterate(function(_, k) {return fn(k, k, this$0)}, reverse);\n };\n\n Set.prototype.__iterator = function(type, reverse) {\n return this._map.map(function(_, k) {return k}).__iterator(type, reverse);\n };\n\n Set.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n var newMap = this._map.__ensureOwner(ownerID);\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n return this;\n }\n return this.__make(newMap, ownerID);\n };\n\n\n function isSet(maybeSet) {\n return !!(maybeSet && maybeSet[IS_SET_SENTINEL]);\n }\n\n Set.isSet = isSet;\n\n var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';\n\n var SetPrototype = Set.prototype;\n SetPrototype[IS_SET_SENTINEL] = true;\n SetPrototype[DELETE] = SetPrototype.remove;\n SetPrototype.mergeDeep = SetPrototype.merge;\n SetPrototype.mergeDeepWith = SetPrototype.mergeWith;\n SetPrototype.withMutations = MapPrototype.withMutations;\n SetPrototype.asMutable = MapPrototype.asMutable;\n SetPrototype.asImmutable = MapPrototype.asImmutable;\n\n SetPrototype.__empty = emptySet;\n SetPrototype.__make = makeSet;\n\n function updateSet(set, newMap) {\n if (set.__ownerID) {\n set.size = newMap.size;\n set._map = newMap;\n return set;\n }\n return newMap === set._map ? set :\n newMap.size === 0 ? set.__empty() :\n set.__make(newMap);\n }\n\n function makeSet(map, ownerID) {\n var set = Object.create(SetPrototype);\n set.size = map ? map.size : 0;\n set._map = map;\n set.__ownerID = ownerID;\n return set;\n }\n\n var EMPTY_SET;\n function emptySet() {\n return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));\n }\n\n createClass(OrderedSet, Set);\n\n // @pragma Construction\n\n function OrderedSet(value) {\n return value === null || value === undefined ? emptyOrderedSet() :\n isOrderedSet(value) ? value :\n emptyOrderedSet().withMutations(function(set ) {\n var iter = SetIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v ) {return set.add(v)});\n });\n }\n\n OrderedSet.of = function(/*...values*/) {\n return this(arguments);\n };\n\n OrderedSet.fromKeys = function(value) {\n return this(KeyedIterable(value).keySeq());\n };\n\n OrderedSet.prototype.toString = function() {\n return this.__toString('OrderedSet {', '}');\n };\n\n\n function isOrderedSet(maybeOrderedSet) {\n return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);\n }\n\n OrderedSet.isOrderedSet = isOrderedSet;\n\n var OrderedSetPrototype = OrderedSet.prototype;\n OrderedSetPrototype[IS_ORDERED_SENTINEL] = true;\n\n OrderedSetPrototype.__empty = emptyOrderedSet;\n OrderedSetPrototype.__make = makeOrderedSet;\n\n function makeOrderedSet(map, ownerID) {\n var set = Object.create(OrderedSetPrototype);\n set.size = map ? map.size : 0;\n set._map = map;\n set.__ownerID = ownerID;\n return set;\n }\n\n var EMPTY_ORDERED_SET;\n function emptyOrderedSet() {\n return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap()));\n }\n\n createClass(Stack, IndexedCollection);\n\n // @pragma Construction\n\n function Stack(value) {\n return value === null || value === undefined ? emptyStack() :\n isStack(value) ? value :\n emptyStack().unshiftAll(value);\n }\n\n Stack.of = function(/*...values*/) {\n return this(arguments);\n };\n\n Stack.prototype.toString = function() {\n return this.__toString('Stack [', ']');\n };\n\n // @pragma Access\n\n Stack.prototype.get = function(index, notSetValue) {\n var head = this._head;\n index = wrapIndex(this, index);\n while (head && index--) {\n head = head.next;\n }\n return head ? head.value : notSetValue;\n };\n\n Stack.prototype.peek = function() {\n return this._head && this._head.value;\n };\n\n // @pragma Modification\n\n Stack.prototype.push = function(/*...values*/) {\n if (arguments.length === 0) {\n return this;\n }\n var newSize = this.size + arguments.length;\n var head = this._head;\n for (var ii = arguments.length - 1; ii >= 0; ii--) {\n head = {\n value: arguments[ii],\n next: head\n };\n }\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return makeStack(newSize, head);\n };\n\n Stack.prototype.pushAll = function(iter) {\n iter = IndexedIterable(iter);\n if (iter.size === 0) {\n return this;\n }\n assertNotInfinite(iter.size);\n var newSize = this.size;\n var head = this._head;\n iter.reverse().forEach(function(value ) {\n newSize++;\n head = {\n value: value,\n next: head\n };\n });\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return makeStack(newSize, head);\n };\n\n Stack.prototype.pop = function() {\n return this.slice(1);\n };\n\n Stack.prototype.unshift = function(/*...values*/) {\n return this.push.apply(this, arguments);\n };\n\n Stack.prototype.unshiftAll = function(iter) {\n return this.pushAll(iter);\n };\n\n Stack.prototype.shift = function() {\n return this.pop.apply(this, arguments);\n };\n\n Stack.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = 0;\n this._head = undefined;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return emptyStack();\n };\n\n Stack.prototype.slice = function(begin, end) {\n if (wholeSlice(begin, end, this.size)) {\n return this;\n }\n var resolvedBegin = resolveBegin(begin, this.size);\n var resolvedEnd = resolveEnd(end, this.size);\n if (resolvedEnd !== this.size) {\n // super.slice(begin, end);\n return IndexedCollection.prototype.slice.call(this, begin, end);\n }\n var newSize = this.size - resolvedBegin;\n var head = this._head;\n while (resolvedBegin--) {\n head = head.next;\n }\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return makeStack(newSize, head);\n };\n\n // @pragma Mutability\n\n Stack.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n if (!ownerID) {\n this.__ownerID = ownerID;\n this.__altered = false;\n return this;\n }\n return makeStack(this.size, this._head, ownerID, this.__hash);\n };\n\n // @pragma Iteration\n\n Stack.prototype.__iterate = function(fn, reverse) {\n if (reverse) {\n return this.reverse().__iterate(fn);\n }\n var iterations = 0;\n var node = this._head;\n while (node) {\n if (fn(node.value, iterations++, this) === false) {\n break;\n }\n node = node.next;\n }\n return iterations;\n };\n\n Stack.prototype.__iterator = function(type, reverse) {\n if (reverse) {\n return this.reverse().__iterator(type);\n }\n var iterations = 0;\n var node = this._head;\n return new Iterator(function() {\n if (node) {\n var value = node.value;\n node = node.next;\n return iteratorValue(type, iterations++, value);\n }\n return iteratorDone();\n });\n };\n\n\n function isStack(maybeStack) {\n return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]);\n }\n\n Stack.isStack = isStack;\n\n var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';\n\n var StackPrototype = Stack.prototype;\n StackPrototype[IS_STACK_SENTINEL] = true;\n StackPrototype.withMutations = MapPrototype.withMutations;\n StackPrototype.asMutable = MapPrototype.asMutable;\n StackPrototype.asImmutable = MapPrototype.asImmutable;\n StackPrototype.wasAltered = MapPrototype.wasAltered;\n\n\n function makeStack(size, head, ownerID, hash) {\n var map = Object.create(StackPrototype);\n map.size = size;\n map._head = head;\n map.__ownerID = ownerID;\n map.__hash = hash;\n map.__altered = false;\n return map;\n }\n\n var EMPTY_STACK;\n function emptyStack() {\n return EMPTY_STACK || (EMPTY_STACK = makeStack(0));\n }\n\n /**\n * Contributes additional methods to a constructor\n */\n function mixin(ctor, methods) {\n var keyCopier = function(key ) { ctor.prototype[key] = methods[key]; };\n Object.keys(methods).forEach(keyCopier);\n Object.getOwnPropertySymbols &&\n Object.getOwnPropertySymbols(methods).forEach(keyCopier);\n return ctor;\n }\n\n Iterable.Iterator = Iterator;\n\n mixin(Iterable, {\n\n // ### Conversion to other types\n\n toArray: function() {\n assertNotInfinite(this.size);\n var array = new Array(this.size || 0);\n this.valueSeq().__iterate(function(v, i) { array[i] = v; });\n return array;\n },\n\n toIndexedSeq: function() {\n return new ToIndexedSequence(this);\n },\n\n toJS: function() {\n return this.toSeq().map(\n function(value ) {return value && typeof value.toJS === 'function' ? value.toJS() : value}\n ).__toJS();\n },\n\n toJSON: function() {\n return this.toSeq().map(\n function(value ) {return value && typeof value.toJSON === 'function' ? value.toJSON() : value}\n ).__toJS();\n },\n\n toKeyedSeq: function() {\n return new ToKeyedSequence(this, true);\n },\n\n toMap: function() {\n // Use Late Binding here to solve the circular dependency.\n return Map(this.toKeyedSeq());\n },\n\n toObject: function() {\n assertNotInfinite(this.size);\n var object = {};\n this.__iterate(function(v, k) { object[k] = v; });\n return object;\n },\n\n toOrderedMap: function() {\n // Use Late Binding here to solve the circular dependency.\n return OrderedMap(this.toKeyedSeq());\n },\n\n toOrderedSet: function() {\n // Use Late Binding here to solve the circular dependency.\n return OrderedSet(isKeyed(this) ? this.valueSeq() : this);\n },\n\n toSet: function() {\n // Use Late Binding here to solve the circular dependency.\n return Set(isKeyed(this) ? this.valueSeq() : this);\n },\n\n toSetSeq: function() {\n return new ToSetSequence(this);\n },\n\n toSeq: function() {\n return isIndexed(this) ? this.toIndexedSeq() :\n isKeyed(this) ? this.toKeyedSeq() :\n this.toSetSeq();\n },\n\n toStack: function() {\n // Use Late Binding here to solve the circular dependency.\n return Stack(isKeyed(this) ? this.valueSeq() : this);\n },\n\n toList: function() {\n // Use Late Binding here to solve the circular dependency.\n return List(isKeyed(this) ? this.valueSeq() : this);\n },\n\n\n // ### Common JavaScript methods and properties\n\n toString: function() {\n return '[Iterable]';\n },\n\n __toString: function(head, tail) {\n if (this.size === 0) {\n return head + tail;\n }\n return head + ' ' + this.toSeq().map(this.__toStringMapper).join(', ') + ' ' + tail;\n },\n\n\n // ### ES6 Collection methods (ES6 Array and Map)\n\n concat: function() {var values = SLICE$0.call(arguments, 0);\n return reify(this, concatFactory(this, values));\n },\n\n includes: function(searchValue) {\n return this.some(function(value ) {return is(value, searchValue)});\n },\n\n entries: function() {\n return this.__iterator(ITERATE_ENTRIES);\n },\n\n every: function(predicate, context) {\n assertNotInfinite(this.size);\n var returnValue = true;\n this.__iterate(function(v, k, c) {\n if (!predicate.call(context, v, k, c)) {\n returnValue = false;\n return false;\n }\n });\n return returnValue;\n },\n\n filter: function(predicate, context) {\n return reify(this, filterFactory(this, predicate, context, true));\n },\n\n find: function(predicate, context, notSetValue) {\n var entry = this.findEntry(predicate, context);\n return entry ? entry[1] : notSetValue;\n },\n\n forEach: function(sideEffect, context) {\n assertNotInfinite(this.size);\n return this.__iterate(context ? sideEffect.bind(context) : sideEffect);\n },\n\n join: function(separator) {\n assertNotInfinite(this.size);\n separator = separator !== undefined ? '' + separator : ',';\n var joined = '';\n var isFirst = true;\n this.__iterate(function(v ) {\n isFirst ? (isFirst = false) : (joined += separator);\n joined += v !== null && v !== undefined ? v.toString() : '';\n });\n return joined;\n },\n\n keys: function() {\n return this.__iterator(ITERATE_KEYS);\n },\n\n map: function(mapper, context) {\n return reify(this, mapFactory(this, mapper, context));\n },\n\n reduce: function(reducer, initialReduction, context) {\n assertNotInfinite(this.size);\n var reduction;\n var useFirst;\n if (arguments.length < 2) {\n useFirst = true;\n } else {\n reduction = initialReduction;\n }\n this.__iterate(function(v, k, c) {\n if (useFirst) {\n useFirst = false;\n reduction = v;\n } else {\n reduction = reducer.call(context, reduction, v, k, c);\n }\n });\n return reduction;\n },\n\n reduceRight: function(reducer, initialReduction, context) {\n var reversed = this.toKeyedSeq().reverse();\n return reversed.reduce.apply(reversed, arguments);\n },\n\n reverse: function() {\n return reify(this, reverseFactory(this, true));\n },\n\n slice: function(begin, end) {\n return reify(this, sliceFactory(this, begin, end, true));\n },\n\n some: function(predicate, context) {\n return !this.every(not(predicate), context);\n },\n\n sort: function(comparator) {\n return reify(this, sortFactory(this, comparator));\n },\n\n values: function() {\n return this.__iterator(ITERATE_VALUES);\n },\n\n\n // ### More sequential methods\n\n butLast: function() {\n return this.slice(0, -1);\n },\n\n isEmpty: function() {\n return this.size !== undefined ? this.size === 0 : !this.some(function() {return true});\n },\n\n count: function(predicate, context) {\n return ensureSize(\n predicate ? this.toSeq().filter(predicate, context) : this\n );\n },\n\n countBy: function(grouper, context) {\n return countByFactory(this, grouper, context);\n },\n\n equals: function(other) {\n return deepEqual(this, other);\n },\n\n entrySeq: function() {\n var iterable = this;\n if (iterable._cache) {\n // We cache as an entries array, so we can just return the cache!\n return new ArraySeq(iterable._cache);\n }\n var entriesSequence = iterable.toSeq().map(entryMapper).toIndexedSeq();\n entriesSequence.fromEntrySeq = function() {return iterable.toSeq()};\n return entriesSequence;\n },\n\n filterNot: function(predicate, context) {\n return this.filter(not(predicate), context);\n },\n\n findEntry: function(predicate, context, notSetValue) {\n var found = notSetValue;\n this.__iterate(function(v, k, c) {\n if (predicate.call(context, v, k, c)) {\n found = [k, v];\n return false;\n }\n });\n return found;\n },\n\n findKey: function(predicate, context) {\n var entry = this.findEntry(predicate, context);\n return entry && entry[0];\n },\n\n findLast: function(predicate, context, notSetValue) {\n return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);\n },\n\n findLastEntry: function(predicate, context, notSetValue) {\n return this.toKeyedSeq().reverse().findEntry(predicate, context, notSetValue);\n },\n\n findLastKey: function(predicate, context) {\n return this.toKeyedSeq().reverse().findKey(predicate, context);\n },\n\n first: function() {\n return this.find(returnTrue);\n },\n\n flatMap: function(mapper, context) {\n return reify(this, flatMapFactory(this, mapper, context));\n },\n\n flatten: function(depth) {\n return reify(this, flattenFactory(this, depth, true));\n },\n\n fromEntrySeq: function() {\n return new FromEntriesSequence(this);\n },\n\n get: function(searchKey, notSetValue) {\n return this.find(function(_, key) {return is(key, searchKey)}, undefined, notSetValue);\n },\n\n getIn: function(searchKeyPath, notSetValue) {\n var nested = this;\n // Note: in an ES6 environment, we would prefer:\n // for (var key of searchKeyPath) {\n var iter = forceIterator(searchKeyPath);\n var step;\n while (!(step = iter.next()).done) {\n var key = step.value;\n nested = nested && nested.get ? nested.get(key, NOT_SET) : NOT_SET;\n if (nested === NOT_SET) {\n return notSetValue;\n }\n }\n return nested;\n },\n\n groupBy: function(grouper, context) {\n return groupByFactory(this, grouper, context);\n },\n\n has: function(searchKey) {\n return this.get(searchKey, NOT_SET) !== NOT_SET;\n },\n\n hasIn: function(searchKeyPath) {\n return this.getIn(searchKeyPath, NOT_SET) !== NOT_SET;\n },\n\n isSubset: function(iter) {\n iter = typeof iter.includes === 'function' ? iter : Iterable(iter);\n return this.every(function(value ) {return iter.includes(value)});\n },\n\n isSuperset: function(iter) {\n iter = typeof iter.isSubset === 'function' ? iter : Iterable(iter);\n return iter.isSubset(this);\n },\n\n keyOf: function(searchValue) {\n return this.findKey(function(value ) {return is(value, searchValue)});\n },\n\n keySeq: function() {\n return this.toSeq().map(keyMapper).toIndexedSeq();\n },\n\n last: function() {\n return this.toSeq().reverse().first();\n },\n\n lastKeyOf: function(searchValue) {\n return this.toKeyedSeq().reverse().keyOf(searchValue);\n },\n\n max: function(comparator) {\n return maxFactory(this, comparator);\n },\n\n maxBy: function(mapper, comparator) {\n return maxFactory(this, comparator, mapper);\n },\n\n min: function(comparator) {\n return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator);\n },\n\n minBy: function(mapper, comparator) {\n return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator, mapper);\n },\n\n rest: function() {\n return this.slice(1);\n },\n\n skip: function(amount) {\n return this.slice(Math.max(0, amount));\n },\n\n skipLast: function(amount) {\n return reify(this, this.toSeq().reverse().skip(amount).reverse());\n },\n\n skipWhile: function(predicate, context) {\n return reify(this, skipWhileFactory(this, predicate, context, true));\n },\n\n skipUntil: function(predicate, context) {\n return this.skipWhile(not(predicate), context);\n },\n\n sortBy: function(mapper, comparator) {\n return reify(this, sortFactory(this, comparator, mapper));\n },\n\n take: function(amount) {\n return this.slice(0, Math.max(0, amount));\n },\n\n takeLast: function(amount) {\n return reify(this, this.toSeq().reverse().take(amount).reverse());\n },\n\n takeWhile: function(predicate, context) {\n return reify(this, takeWhileFactory(this, predicate, context));\n },\n\n takeUntil: function(predicate, context) {\n return this.takeWhile(not(predicate), context);\n },\n\n valueSeq: function() {\n return this.toIndexedSeq();\n },\n\n\n // ### Hashable Object\n\n hashCode: function() {\n return this.__hash || (this.__hash = hashIterable(this));\n }\n\n\n // ### Internal\n\n // abstract __iterate(fn, reverse)\n\n // abstract __iterator(type, reverse)\n });\n\n // var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n // var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n // var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n // var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';\n\n var IterablePrototype = Iterable.prototype;\n IterablePrototype[IS_ITERABLE_SENTINEL] = true;\n IterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.values;\n IterablePrototype.__toJS = IterablePrototype.toArray;\n IterablePrototype.__toStringMapper = quoteString;\n IterablePrototype.inspect =\n IterablePrototype.toSource = function() { return this.toString(); };\n IterablePrototype.chain = IterablePrototype.flatMap;\n IterablePrototype.contains = IterablePrototype.includes;\n\n mixin(KeyedIterable, {\n\n // ### More sequential methods\n\n flip: function() {\n return reify(this, flipFactory(this));\n },\n\n mapEntries: function(mapper, context) {var this$0 = this;\n var iterations = 0;\n return reify(this,\n this.toSeq().map(\n function(v, k) {return mapper.call(context, [k, v], iterations++, this$0)}\n ).fromEntrySeq()\n );\n },\n\n mapKeys: function(mapper, context) {var this$0 = this;\n return reify(this,\n this.toSeq().flip().map(\n function(k, v) {return mapper.call(context, k, v, this$0)}\n ).flip()\n );\n }\n\n });\n\n var KeyedIterablePrototype = KeyedIterable.prototype;\n KeyedIterablePrototype[IS_KEYED_SENTINEL] = true;\n KeyedIterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.entries;\n KeyedIterablePrototype.__toJS = IterablePrototype.toObject;\n KeyedIterablePrototype.__toStringMapper = function(v, k) {return JSON.stringify(k) + ': ' + quoteString(v)};\n\n\n\n mixin(IndexedIterable, {\n\n // ### Conversion to other types\n\n toKeyedSeq: function() {\n return new ToKeyedSequence(this, false);\n },\n\n\n // ### ES6 Collection methods (ES6 Array and Map)\n\n filter: function(predicate, context) {\n return reify(this, filterFactory(this, predicate, context, false));\n },\n\n findIndex: function(predicate, context) {\n var entry = this.findEntry(predicate, context);\n return entry ? entry[0] : -1;\n },\n\n indexOf: function(searchValue) {\n var key = this.keyOf(searchValue);\n return key === undefined ? -1 : key;\n },\n\n lastIndexOf: function(searchValue) {\n var key = this.lastKeyOf(searchValue);\n return key === undefined ? -1 : key;\n },\n\n reverse: function() {\n return reify(this, reverseFactory(this, false));\n },\n\n slice: function(begin, end) {\n return reify(this, sliceFactory(this, begin, end, false));\n },\n\n splice: function(index, removeNum /*, ...values*/) {\n var numArgs = arguments.length;\n removeNum = Math.max(removeNum | 0, 0);\n if (numArgs === 0 || (numArgs === 2 && !removeNum)) {\n return this;\n }\n // If index is negative, it should resolve relative to the size of the\n // collection. However size may be expensive to compute if not cached, so\n // only call count() if the number is in fact negative.\n index = resolveBegin(index, index < 0 ? this.count() : this.size);\n var spliced = this.slice(0, index);\n return reify(\n this,\n numArgs === 1 ?\n spliced :\n spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum))\n );\n },\n\n\n // ### More collection methods\n\n findLastIndex: function(predicate, context) {\n var entry = this.findLastEntry(predicate, context);\n return entry ? entry[0] : -1;\n },\n\n first: function() {\n return this.get(0);\n },\n\n flatten: function(depth) {\n return reify(this, flattenFactory(this, depth, false));\n },\n\n get: function(index, notSetValue) {\n index = wrapIndex(this, index);\n return (index < 0 || (this.size === Infinity ||\n (this.size !== undefined && index > this.size))) ?\n notSetValue :\n this.find(function(_, key) {return key === index}, undefined, notSetValue);\n },\n\n has: function(index) {\n index = wrapIndex(this, index);\n return index >= 0 && (this.size !== undefined ?\n this.size === Infinity || index < this.size :\n this.indexOf(index) !== -1\n );\n },\n\n interpose: function(separator) {\n return reify(this, interposeFactory(this, separator));\n },\n\n interleave: function(/*...iterables*/) {\n var iterables = [this].concat(arrCopy(arguments));\n var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, iterables);\n var interleaved = zipped.flatten(true);\n if (zipped.size) {\n interleaved.size = zipped.size * iterables.length;\n }\n return reify(this, interleaved);\n },\n\n keySeq: function() {\n return Range(0, this.size);\n },\n\n last: function() {\n return this.get(-1);\n },\n\n skipWhile: function(predicate, context) {\n return reify(this, skipWhileFactory(this, predicate, context, false));\n },\n\n zip: function(/*, ...iterables */) {\n var iterables = [this].concat(arrCopy(arguments));\n return reify(this, zipWithFactory(this, defaultZipper, iterables));\n },\n\n zipWith: function(zipper/*, ...iterables */) {\n var iterables = arrCopy(arguments);\n iterables[0] = this;\n return reify(this, zipWithFactory(this, zipper, iterables));\n }\n\n });\n\n IndexedIterable.prototype[IS_INDEXED_SENTINEL] = true;\n IndexedIterable.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n\n mixin(SetIterable, {\n\n // ### ES6 Collection methods (ES6 Array and Map)\n\n get: function(value, notSetValue) {\n return this.has(value) ? value : notSetValue;\n },\n\n includes: function(value) {\n return this.has(value);\n },\n\n\n // ### More sequential methods\n\n keySeq: function() {\n return this.valueSeq();\n }\n\n });\n\n SetIterable.prototype.has = IterablePrototype.includes;\n SetIterable.prototype.contains = SetIterable.prototype.includes;\n\n\n // Mixin subclasses\n\n mixin(KeyedSeq, KeyedIterable.prototype);\n mixin(IndexedSeq, IndexedIterable.prototype);\n mixin(SetSeq, SetIterable.prototype);\n\n mixin(KeyedCollection, KeyedIterable.prototype);\n mixin(IndexedCollection, IndexedIterable.prototype);\n mixin(SetCollection, SetIterable.prototype);\n\n\n // #pragma Helper functions\n\n function keyMapper(v, k) {\n return k;\n }\n\n function entryMapper(v, k) {\n return [k, v];\n }\n\n function not(predicate) {\n return function() {\n return !predicate.apply(this, arguments);\n }\n }\n\n function neg(predicate) {\n return function() {\n return -predicate.apply(this, arguments);\n }\n }\n\n function quoteString(value) {\n return typeof value === 'string' ? JSON.stringify(value) : String(value);\n }\n\n function defaultZipper() {\n return arrCopy(arguments);\n }\n\n function defaultNegComparator(a, b) {\n return a < b ? 1 : a > b ? -1 : 0;\n }\n\n function hashIterable(iterable) {\n if (iterable.size === Infinity) {\n return 0;\n }\n var ordered = isOrdered(iterable);\n var keyed = isKeyed(iterable);\n var h = ordered ? 1 : 0;\n var size = iterable.__iterate(\n keyed ?\n ordered ?\n function(v, k) { h = 31 * h + hashMerge(hash(v), hash(k)) | 0; } :\n function(v, k) { h = h + hashMerge(hash(v), hash(k)) | 0; } :\n ordered ?\n function(v ) { h = 31 * h + hash(v) | 0; } :\n function(v ) { h = h + hash(v) | 0; }\n );\n return murmurHashOfSize(size, h);\n }\n\n function murmurHashOfSize(size, h) {\n h = imul(h, 0xCC9E2D51);\n h = imul(h << 15 | h >>> -15, 0x1B873593);\n h = imul(h << 13 | h >>> -13, 5);\n h = (h + 0xE6546B64 | 0) ^ size;\n h = imul(h ^ h >>> 16, 0x85EBCA6B);\n h = imul(h ^ h >>> 13, 0xC2B2AE35);\n h = smi(h ^ h >>> 16);\n return h;\n }\n\n function hashMerge(a, b) {\n return a ^ b + 0x9E3779B9 + (a << 6) + (a >> 2) | 0; // int\n }\n\n var Immutable = {\n\n Iterable: Iterable,\n\n Seq: Seq,\n Collection: Collection,\n Map: Map,\n OrderedMap: OrderedMap,\n List: List,\n Stack: Stack,\n Set: Set,\n OrderedSet: OrderedSet,\n\n Record: Record,\n Range: Range,\n Repeat: Repeat,\n\n is: is,\n fromJS: fromJS\n\n };\n\n return Immutable;\n\n}));","/*!\n * isobject \n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\n'use strict';\n\nmodule.exports = function isObject(val) {\n return val != null && typeof val === 'object' && Array.isArray(val) === false;\n};\n","/*!\n * is-plain-object \n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\n'use strict';\n\nvar isObject = require('isobject');\n\nfunction isObjectObject(o) {\n return isObject(o) === true\n && Object.prototype.toString.call(o) === '[object Object]';\n}\n\nmodule.exports = function isPlainObject(o) {\n var ctor,prot;\n\n if (isObjectObject(o) === false) return false;\n\n // If has modified constructor\n ctor = o.constructor;\n if (typeof ctor !== 'function') return false;\n\n // If has modified prototype\n prot = ctor.prototype;\n if (isObjectObject(prot) === false) return false;\n\n // If constructor does not have an Object-specific method\n if (prot.hasOwnProperty('isPrototypeOf') === false) {\n return false;\n }\n\n // Most likely a plain Object\n return true;\n};\n","var isProduction = process.env.NODE_ENV === 'production';\nvar index = (function (condition, message) {\n if (!isProduction) {\n if (condition) {\n return;\n }\n\n console.warn(message);\n }\n});\n\nexport default index;\n","\"use strict\";\n\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\nfunction setup(env) {\n createDebug.debug = createDebug;\n createDebug.default = createDebug;\n createDebug.coerce = coerce;\n createDebug.disable = disable;\n createDebug.enable = enable;\n createDebug.enabled = enabled;\n createDebug.humanize = require('ms');\n Object.keys(env).forEach(function (key) {\n createDebug[key] = env[key];\n });\n /**\n * Active `debug` instances.\n */\n\n createDebug.instances = [];\n /**\n * The currently active debug mode names, and names to skip.\n */\n\n createDebug.names = [];\n createDebug.skips = [];\n /**\n * Map of special \"%n\" handling functions, for the debug \"format\" argument.\n *\n * Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n */\n\n createDebug.formatters = {};\n /**\n * Selects a color for a debug namespace\n * @param {String} namespace The namespace string for the for the debug instance to be colored\n * @return {Number|String} An ANSI color code for the given namespace\n * @api private\n */\n\n function selectColor(namespace) {\n var hash = 0;\n\n for (var i = 0; i < namespace.length; i++) {\n hash = (hash << 5) - hash + namespace.charCodeAt(i);\n hash |= 0; // Convert to 32bit integer\n }\n\n return createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n }\n\n createDebug.selectColor = selectColor;\n /**\n * Create a debugger with the given `namespace`.\n *\n * @param {String} namespace\n * @return {Function}\n * @api public\n */\n\n function createDebug(namespace) {\n var prevTime;\n\n function debug() {\n // Disabled?\n if (!debug.enabled) {\n return;\n }\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var self = debug; // Set `diff` timestamp\n\n var curr = Number(new Date());\n var ms = curr - (prevTime || curr);\n self.diff = ms;\n self.prev = prevTime;\n self.curr = curr;\n prevTime = curr;\n args[0] = createDebug.coerce(args[0]);\n\n if (typeof args[0] !== 'string') {\n // Anything else let's inspect with %O\n args.unshift('%O');\n } // Apply any `formatters` transformations\n\n\n var index = 0;\n args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {\n // If we encounter an escaped % then don't increase the array index\n if (match === '%%') {\n return match;\n }\n\n index++;\n var formatter = createDebug.formatters[format];\n\n if (typeof formatter === 'function') {\n var val = args[index];\n match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`\n\n args.splice(index, 1);\n index--;\n }\n\n return match;\n }); // Apply env-specific formatting (colors, etc.)\n\n createDebug.formatArgs.call(self, args);\n var logFn = self.log || createDebug.log;\n logFn.apply(self, args);\n }\n\n debug.namespace = namespace;\n debug.enabled = createDebug.enabled(namespace);\n debug.useColors = createDebug.useColors();\n debug.color = selectColor(namespace);\n debug.destroy = destroy;\n debug.extend = extend; // Debug.formatArgs = formatArgs;\n // debug.rawLog = rawLog;\n // env-specific initialization logic for debug instances\n\n if (typeof createDebug.init === 'function') {\n createDebug.init(debug);\n }\n\n createDebug.instances.push(debug);\n return debug;\n }\n\n function destroy() {\n var index = createDebug.instances.indexOf(this);\n\n if (index !== -1) {\n createDebug.instances.splice(index, 1);\n return true;\n }\n\n return false;\n }\n\n function extend(namespace, delimiter) {\n return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n }\n /**\n * Enables a debug mode by namespaces. This can include modes\n * separated by a colon and wildcards.\n *\n * @param {String} namespaces\n * @api public\n */\n\n\n function enable(namespaces) {\n createDebug.save(namespaces);\n createDebug.names = [];\n createDebug.skips = [];\n var i;\n var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n var len = split.length;\n\n for (i = 0; i < len; i++) {\n if (!split[i]) {\n // ignore empty strings\n continue;\n }\n\n namespaces = split[i].replace(/\\*/g, '.*?');\n\n if (namespaces[0] === '-') {\n createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n } else {\n createDebug.names.push(new RegExp('^' + namespaces + '$'));\n }\n }\n\n for (i = 0; i < createDebug.instances.length; i++) {\n var instance = createDebug.instances[i];\n instance.enabled = createDebug.enabled(instance.namespace);\n }\n }\n /**\n * Disable debug output.\n *\n * @api public\n */\n\n\n function disable() {\n createDebug.enable('');\n }\n /**\n * Returns true if the given mode name is enabled, false otherwise.\n *\n * @param {String} name\n * @return {Boolean}\n * @api public\n */\n\n\n function enabled(name) {\n if (name[name.length - 1] === '*') {\n return true;\n }\n\n var i;\n var len;\n\n for (i = 0, len = createDebug.skips.length; i < len; i++) {\n if (createDebug.skips[i].test(name)) {\n return false;\n }\n }\n\n for (i = 0, len = createDebug.names.length; i < len; i++) {\n if (createDebug.names[i].test(name)) {\n return true;\n }\n }\n\n return false;\n }\n /**\n * Coerce `val`.\n *\n * @param {Mixed} val\n * @return {Mixed}\n * @api private\n */\n\n\n function coerce(val) {\n if (val instanceof Error) {\n return val.stack || val.message;\n }\n\n return val;\n }\n\n createDebug.enable(createDebug.load());\n return createDebug;\n}\n\nmodule.exports = setup;\n\n","\"use strict\";\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\n/**\n * Colors.\n */\n\nexports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n// eslint-disable-next-line complexity\n\nfunction useColors() {\n // NB: In an Electron preload script, document will be defined but not fully\n // initialized. Since we know we're in Chrome, we'll just detect this case\n // explicitly\n if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n return true;\n } // Internet Explorer and Edge do not support colors.\n\n\n if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n return false;\n } // Is webkit? http://stackoverflow.com/a/16459606/376773\n // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\n\n return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773\n typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?\n // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker\n typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/);\n}\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\n\nfunction formatArgs(args) {\n args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);\n\n if (!this.useColors) {\n return;\n }\n\n var c = 'color: ' + this.color;\n args.splice(1, 0, c, 'color: inherit'); // The final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n\n var index = 0;\n var lastC = 0;\n args[0].replace(/%[a-zA-Z%]/g, function (match) {\n if (match === '%%') {\n return;\n }\n\n index++;\n\n if (match === '%c') {\n // We only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index;\n }\n });\n args.splice(lastC, 0, c);\n}\n/**\n * Invokes `console.log()` when available.\n * No-op when `console.log` is not a \"function\".\n *\n * @api public\n */\n\n\nfunction log() {\n var _console;\n\n // This hackery is required for IE8/9, where\n // the `console.log` function doesn't have 'apply'\n return (typeof console === \"undefined\" ? \"undefined\" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);\n}\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\n\n\nfunction save(namespaces) {\n try {\n if (namespaces) {\n exports.storage.setItem('debug', namespaces);\n } else {\n exports.storage.removeItem('debug');\n }\n } catch (error) {// Swallow\n // XXX (@Qix-) should we be logging these?\n }\n}\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\n\n\nfunction load() {\n var r;\n\n try {\n r = exports.storage.getItem('debug');\n } catch (error) {} // Swallow\n // XXX (@Qix-) should we be logging these?\n // If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\n\n if (!r && typeof process !== 'undefined' && 'env' in process) {\n r = process.env.DEBUG;\n }\n\n return r;\n}\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\n\nfunction localstorage() {\n try {\n // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n // The Browser also has localStorage in the global context.\n return localStorage;\n } catch (error) {// Swallow\n // XXX (@Qix-) should we be logging these?\n }\n}\n\nmodule.exports = require('./common')(exports);\nvar formatters = module.exports.formatters;\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n try {\n return JSON.stringify(v);\n } catch (error) {\n return '[UnexpectedJSONParseError]: ' + error.message;\n }\n};\n\n","/*! https://mths.be/esrever v0.2.0 by @mathias */\n;(function(root) {\n\n\t// Detect free variables `exports`\n\tvar freeExports = typeof exports == 'object' && exports;\n\n\t// Detect free variable `module`\n\tvar freeModule = typeof module == 'object' && module &&\n\t\tmodule.exports == freeExports && module;\n\n\t// Detect free variable `global`, from Node.js or Browserified code,\n\t// and use it as `root`\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {\n\t\troot = freeGlobal;\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\tvar regexSymbolWithCombiningMarks = /([\\0-\\u02FF\\u0370-\\u1AAF\\u1B00-\\u1DBF\\u1E00-\\u20CF\\u2100-\\uD7FF\\uE000-\\uFE1F\\uFE30-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])([\\u0300-\\u036F\\u1AB0-\\u1AFF\\u1DC0-\\u1DFF\\u20D0-\\u20FF\\uFE20-\\uFE2F]+)/g;\n\tvar regexSurrogatePair = /([\\uD800-\\uDBFF])([\\uDC00-\\uDFFF])/g;\n\n\tvar reverse = function(string) {\n\t\t// Step 1: deal with combining marks and astral symbols (surrogate pairs)\n\t\tstring = string\n\t\t\t// Swap symbols with their combining marks so the combining marks go first\n\t\t\t.replace(regexSymbolWithCombiningMarks, function($0, $1, $2) {\n\t\t\t\t// Reverse the combining marks so they will end up in the same order\n\t\t\t\t// later on (after another round of reversing)\n\t\t\t\treturn reverse($2) + $1;\n\t\t\t})\n\t\t\t// Swap high and low surrogates so the low surrogates go first\n\t\t\t.replace(regexSurrogatePair, '$2$1');\n\t\t// Step 2: reverse the code units in the string\n\t\tvar result = '';\n\t\tvar index = string.length;\n\t\twhile (index--) {\n\t\t\tresult += string.charAt(index);\n\t\t}\n\t\treturn result;\n\t};\n\n\t/*--------------------------------------------------------------------------*/\n\n\tvar esrever = {\n\t\t'version': '0.2.0',\n\t\t'reverse': reverse\n\t};\n\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine(function() {\n\t\t\treturn esrever;\n\t\t});\n\t}\telse if (freeExports && !freeExports.nodeType) {\n\t\tif (freeModule) { // in Node.js, io.js, or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = esrever;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (var key in esrever) {\n\t\t\t\tesrever.hasOwnProperty(key) && (freeExports[key] = esrever[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.esrever = esrever;\n\t}\n\n}(this));\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nmodule.exports = isArray;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n","var isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used to match property names within property paths. */\nvar reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/;\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\nfunction isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n}\n\nmodule.exports = isKey;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","var baseGetTag = require('./_baseGetTag'),\n isObject = require('./isObject');\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nmodule.exports = isFunction;\n","var root = require('./_root');\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nmodule.exports = coreJsData;\n","var coreJsData = require('./_coreJsData');\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nmodule.exports = isMasked;\n","/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nmodule.exports = toSource;\n","var isFunction = require('./isFunction'),\n isMasked = require('./_isMasked'),\n isObject = require('./isObject'),\n toSource = require('./_toSource');\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nmodule.exports = baseIsNative;\n","/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nmodule.exports = getValue;\n","var baseIsNative = require('./_baseIsNative'),\n getValue = require('./_getValue');\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n","var getNative = require('./_getNative');\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nmodule.exports = nativeCreate;\n","var nativeCreate = require('./_nativeCreate');\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nmodule.exports = hashClear;\n","/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = hashDelete;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nmodule.exports = hashGet;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nmodule.exports = hashHas;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nmodule.exports = hashSet;\n","var hashClear = require('./_hashClear'),\n hashDelete = require('./_hashDelete'),\n hashGet = require('./_hashGet'),\n hashHas = require('./_hashHas'),\n hashSet = require('./_hashSet');\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nmodule.exports = Hash;\n","/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nmodule.exports = listCacheClear;\n","/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nmodule.exports = eq;\n","var eq = require('./eq');\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nmodule.exports = assocIndexOf;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nmodule.exports = listCacheDelete;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nmodule.exports = listCacheGet;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nmodule.exports = listCacheHas;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nmodule.exports = listCacheSet;\n","var listCacheClear = require('./_listCacheClear'),\n listCacheDelete = require('./_listCacheDelete'),\n listCacheGet = require('./_listCacheGet'),\n listCacheHas = require('./_listCacheHas'),\n listCacheSet = require('./_listCacheSet');\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nmodule.exports = ListCache;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nmodule.exports = Map;\n","var Hash = require('./_Hash'),\n ListCache = require('./_ListCache'),\n Map = require('./_Map');\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nmodule.exports = mapCacheClear;\n","/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nmodule.exports = isKeyable;\n","var isKeyable = require('./_isKeyable');\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nmodule.exports = getMapData;\n","var getMapData = require('./_getMapData');\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = mapCacheDelete;\n","var getMapData = require('./_getMapData');\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nmodule.exports = mapCacheGet;\n","var getMapData = require('./_getMapData');\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nmodule.exports = mapCacheHas;\n","var getMapData = require('./_getMapData');\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nmodule.exports = mapCacheSet;\n","var mapCacheClear = require('./_mapCacheClear'),\n mapCacheDelete = require('./_mapCacheDelete'),\n mapCacheGet = require('./_mapCacheGet'),\n mapCacheHas = require('./_mapCacheHas'),\n mapCacheSet = require('./_mapCacheSet');\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nmodule.exports = MapCache;\n","var MapCache = require('./_MapCache');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n}\n\n// Expose `MapCache`.\nmemoize.Cache = MapCache;\n\nmodule.exports = memoize;\n","var memoize = require('./memoize');\n\n/** Used as the maximum memoize cache size. */\nvar MAX_MEMOIZE_SIZE = 500;\n\n/**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\nfunction memoizeCapped(func) {\n var result = memoize(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n}\n\nmodule.exports = memoizeCapped;\n","var memoizeCapped = require('./_memoizeCapped');\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nvar stringToPath = memoizeCapped(function(string) {\n var result = [];\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n});\n\nmodule.exports = stringToPath;\n","/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nmodule.exports = arrayMap;\n","var Symbol = require('./_Symbol'),\n arrayMap = require('./_arrayMap'),\n isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = baseToString;\n","var baseToString = require('./_baseToString');\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\nmodule.exports = toString;\n","var isArray = require('./isArray'),\n isKey = require('./_isKey'),\n stringToPath = require('./_stringToPath'),\n toString = require('./toString');\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\nfunction castPath(value, object) {\n if (isArray(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n}\n\nmodule.exports = castPath;\n","var isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\nfunction toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = toKey;\n","var castPath = require('./_castPath'),\n toKey = require('./_toKey');\n\n/**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n}\n\nmodule.exports = baseGet;\n","var getNative = require('./_getNative');\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\nmodule.exports = defineProperty;\n","var defineProperty = require('./_defineProperty');\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\nmodule.exports = baseAssignValue;\n","var baseAssignValue = require('./_baseAssignValue'),\n eq = require('./eq');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\nmodule.exports = assignValue;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nmodule.exports = isIndex;\n","var assignValue = require('./_assignValue'),\n castPath = require('./_castPath'),\n isIndex = require('./_isIndex'),\n isObject = require('./isObject'),\n toKey = require('./_toKey');\n\n/**\n * The base implementation of `_.set`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\nfunction baseSet(object, path, value, customizer) {\n if (!isObject(object)) {\n return object;\n }\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object;\n\n while (nested != null && ++index < length) {\n var key = toKey(path[index]),\n newValue = value;\n\n if (index != lastIndex) {\n var objValue = nested[key];\n newValue = customizer ? customizer(objValue, key, nested) : undefined;\n if (newValue === undefined) {\n newValue = isObject(objValue)\n ? objValue\n : (isIndex(path[index + 1]) ? [] : {});\n }\n }\n assignValue(nested, key, newValue);\n nested = nested[key];\n }\n return object;\n}\n\nmodule.exports = baseSet;\n","var baseGet = require('./_baseGet'),\n baseSet = require('./_baseSet'),\n castPath = require('./_castPath');\n\n/**\n * The base implementation of `_.pickBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @param {Function} predicate The function invoked per property.\n * @returns {Object} Returns the new object.\n */\nfunction basePickBy(object, paths, predicate) {\n var index = -1,\n length = paths.length,\n result = {};\n\n while (++index < length) {\n var path = paths[index],\n value = baseGet(object, path);\n\n if (predicate(value, path)) {\n baseSet(result, castPath(path, object), value);\n }\n }\n return result;\n}\n\nmodule.exports = basePickBy;\n","/**\n * The base implementation of `_.hasIn` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHasIn(object, key) {\n return object != null && key in Object(object);\n}\n\nmodule.exports = baseHasIn;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nmodule.exports = baseIsArguments;\n","var baseIsArguments = require('./_baseIsArguments'),\n isObjectLike = require('./isObjectLike');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nmodule.exports = isArguments;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nmodule.exports = isLength;\n","var castPath = require('./_castPath'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray'),\n isIndex = require('./_isIndex'),\n isLength = require('./isLength'),\n toKey = require('./_toKey');\n\n/**\n * Checks if `path` exists on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @param {Function} hasFunc The function to check properties.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n */\nfunction hasPath(object, path, hasFunc) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n result = false;\n\n while (++index < length) {\n var key = toKey(path[index]);\n if (!(result = object != null && hasFunc(object, key))) {\n break;\n }\n object = object[key];\n }\n if (result || ++index != length) {\n return result;\n }\n length = object == null ? 0 : object.length;\n return !!length && isLength(length) && isIndex(key, length) &&\n (isArray(object) || isArguments(object));\n}\n\nmodule.exports = hasPath;\n","var baseHasIn = require('./_baseHasIn'),\n hasPath = require('./_hasPath');\n\n/**\n * Checks if `path` is a direct or inherited property of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.hasIn(object, 'a');\n * // => true\n *\n * _.hasIn(object, 'a.b');\n * // => true\n *\n * _.hasIn(object, ['a', 'b']);\n * // => true\n *\n * _.hasIn(object, 'b');\n * // => false\n */\nfunction hasIn(object, path) {\n return object != null && hasPath(object, path, baseHasIn);\n}\n\nmodule.exports = hasIn;\n","var basePickBy = require('./_basePickBy'),\n hasIn = require('./hasIn');\n\n/**\n * The base implementation of `_.pick` without support for individual\n * property identifiers.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @returns {Object} Returns the new object.\n */\nfunction basePick(object, paths) {\n return basePickBy(object, paths, function(value, path) {\n return hasIn(object, path);\n });\n}\n\nmodule.exports = basePick;\n","/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nmodule.exports = arrayPush;\n","var Symbol = require('./_Symbol'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray');\n\n/** Built-in value references. */\nvar spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;\n\n/**\n * Checks if `value` is a flattenable `arguments` object or array.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\n */\nfunction isFlattenable(value) {\n return isArray(value) || isArguments(value) ||\n !!(spreadableSymbol && value && value[spreadableSymbol]);\n}\n\nmodule.exports = isFlattenable;\n","var arrayPush = require('./_arrayPush'),\n isFlattenable = require('./_isFlattenable');\n\n/**\n * The base implementation of `_.flatten` with support for restricting flattening.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {number} depth The maximum recursion depth.\n * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.\n * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\nfunction baseFlatten(array, depth, predicate, isStrict, result) {\n var index = -1,\n length = array.length;\n\n predicate || (predicate = isFlattenable);\n result || (result = []);\n\n while (++index < length) {\n var value = array[index];\n if (depth > 0 && predicate(value)) {\n if (depth > 1) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, depth - 1, predicate, isStrict, result);\n } else {\n arrayPush(result, value);\n }\n } else if (!isStrict) {\n result[result.length] = value;\n }\n }\n return result;\n}\n\nmodule.exports = baseFlatten;\n","var baseFlatten = require('./_baseFlatten');\n\n/**\n * Flattens `array` a single level deep.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flatten([1, [2, [3, [4]], 5]]);\n * // => [1, 2, [3, [4]], 5]\n */\nfunction flatten(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseFlatten(array, 1) : [];\n}\n\nmodule.exports = flatten;\n","/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\nmodule.exports = apply;\n","var apply = require('./_apply');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\nmodule.exports = overRest;\n","/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\nmodule.exports = constant;\n","/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nmodule.exports = identity;\n","var constant = require('./constant'),\n defineProperty = require('./_defineProperty'),\n identity = require('./identity');\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\nmodule.exports = baseSetToString;\n","/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeNow = Date.now;\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\nmodule.exports = shortOut;\n","var baseSetToString = require('./_baseSetToString'),\n shortOut = require('./_shortOut');\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\nmodule.exports = setToString;\n","var flatten = require('./flatten'),\n overRest = require('./_overRest'),\n setToString = require('./_setToString');\n\n/**\n * A specialized version of `baseRest` which flattens the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @returns {Function} Returns the new function.\n */\nfunction flatRest(func) {\n return setToString(overRest(func, undefined, flatten), func + '');\n}\n\nmodule.exports = flatRest;\n","var basePick = require('./_basePick'),\n flatRest = require('./_flatRest');\n\n/**\n * Creates an object composed of the picked `object` properties.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pick(object, ['a', 'c']);\n * // => { 'a': 1, 'c': 3 }\n */\nvar pick = flatRest(function(object, paths) {\n return object == null ? {} : basePick(object, paths);\n});\n\nmodule.exports = pick;\n","var ListCache = require('./_ListCache');\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\nmodule.exports = stackClear;\n","/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\nmodule.exports = stackDelete;\n","/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\nmodule.exports = stackGet;\n","/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\nmodule.exports = stackHas;\n","var ListCache = require('./_ListCache'),\n Map = require('./_Map'),\n MapCache = require('./_MapCache');\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\nmodule.exports = stackSet;\n","var ListCache = require('./_ListCache'),\n stackClear = require('./_stackClear'),\n stackDelete = require('./_stackDelete'),\n stackGet = require('./_stackGet'),\n stackHas = require('./_stackHas'),\n stackSet = require('./_stackSet');\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\nmodule.exports = Stack;\n","/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\nmodule.exports = arrayEach;\n","var assignValue = require('./_assignValue'),\n baseAssignValue = require('./_baseAssignValue');\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\nmodule.exports = copyObject;\n","/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nmodule.exports = baseTimes;\n","/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = stubFalse;\n","var root = require('./_root'),\n stubFalse = require('./stubFalse');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nmodule.exports = isBuffer;\n","var baseGetTag = require('./_baseGetTag'),\n isLength = require('./isLength'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nmodule.exports = baseIsTypedArray;\n","/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nmodule.exports = baseUnary;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nmodule.exports = nodeUtil;\n","var baseIsTypedArray = require('./_baseIsTypedArray'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nmodule.exports = isTypedArray;\n","var baseTimes = require('./_baseTimes'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isIndex = require('./_isIndex'),\n isTypedArray = require('./isTypedArray');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = arrayLikeKeys;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nmodule.exports = isPrototype;\n","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nmodule.exports = overArg;\n","var overArg = require('./_overArg');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nmodule.exports = nativeKeys;\n","var isPrototype = require('./_isPrototype'),\n nativeKeys = require('./_nativeKeys');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = baseKeys;\n","var isFunction = require('./isFunction'),\n isLength = require('./isLength');\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nmodule.exports = isArrayLike;\n","var arrayLikeKeys = require('./_arrayLikeKeys'),\n baseKeys = require('./_baseKeys'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nmodule.exports = keys;\n","var copyObject = require('./_copyObject'),\n keys = require('./keys');\n\n/**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n}\n\nmodule.exports = baseAssign;\n","/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = nativeKeysIn;\n","var isObject = require('./isObject'),\n isPrototype = require('./_isPrototype'),\n nativeKeysIn = require('./_nativeKeysIn');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = baseKeysIn;\n","var arrayLikeKeys = require('./_arrayLikeKeys'),\n baseKeysIn = require('./_baseKeysIn'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\nmodule.exports = keysIn;\n","var copyObject = require('./_copyObject'),\n keysIn = require('./keysIn');\n\n/**\n * The base implementation of `_.assignIn` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssignIn(object, source) {\n return object && copyObject(source, keysIn(source), object);\n}\n\nmodule.exports = baseAssignIn;\n","var root = require('./_root');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n}\n\nmodule.exports = cloneBuffer;\n","/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nmodule.exports = copyArray;\n","/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nmodule.exports = arrayFilter;\n","/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\nmodule.exports = stubArray;\n","var arrayFilter = require('./_arrayFilter'),\n stubArray = require('./stubArray');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nmodule.exports = getSymbols;\n","var copyObject = require('./_copyObject'),\n getSymbols = require('./_getSymbols');\n\n/**\n * Copies own symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n}\n\nmodule.exports = copySymbols;\n","var overArg = require('./_overArg');\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nmodule.exports = getPrototype;\n","var arrayPush = require('./_arrayPush'),\n getPrototype = require('./_getPrototype'),\n getSymbols = require('./_getSymbols'),\n stubArray = require('./stubArray');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own and inherited enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {\n var result = [];\n while (object) {\n arrayPush(result, getSymbols(object));\n object = getPrototype(object);\n }\n return result;\n};\n\nmodule.exports = getSymbolsIn;\n","var copyObject = require('./_copyObject'),\n getSymbolsIn = require('./_getSymbolsIn');\n\n/**\n * Copies own and inherited symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbolsIn(source, object) {\n return copyObject(source, getSymbolsIn(source), object);\n}\n\nmodule.exports = copySymbolsIn;\n","var arrayPush = require('./_arrayPush'),\n isArray = require('./isArray');\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\nmodule.exports = baseGetAllKeys;\n","var baseGetAllKeys = require('./_baseGetAllKeys'),\n getSymbols = require('./_getSymbols'),\n keys = require('./keys');\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\nmodule.exports = getAllKeys;\n","var baseGetAllKeys = require('./_baseGetAllKeys'),\n getSymbolsIn = require('./_getSymbolsIn'),\n keysIn = require('./keysIn');\n\n/**\n * Creates an array of own and inherited enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeysIn(object) {\n return baseGetAllKeys(object, keysIn, getSymbolsIn);\n}\n\nmodule.exports = getAllKeysIn;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nmodule.exports = DataView;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nmodule.exports = Promise;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nmodule.exports = Set;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nmodule.exports = WeakMap;\n","var DataView = require('./_DataView'),\n Map = require('./_Map'),\n Promise = require('./_Promise'),\n Set = require('./_Set'),\n WeakMap = require('./_WeakMap'),\n baseGetTag = require('./_baseGetTag'),\n toSource = require('./_toSource');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nmodule.exports = getTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\nfunction initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n}\n\nmodule.exports = initCloneArray;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Uint8Array = root.Uint8Array;\n\nmodule.exports = Uint8Array;\n","var Uint8Array = require('./_Uint8Array');\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\nmodule.exports = cloneArrayBuffer;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer');\n\n/**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\nfunction cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n}\n\nmodule.exports = cloneDataView;\n","/** Used to match `RegExp` flags from their coerced string values. */\nvar reFlags = /\\w*$/;\n\n/**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\nfunction cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n}\n\nmodule.exports = cloneRegExp;\n","var Symbol = require('./_Symbol');\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\nfunction cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n}\n\nmodule.exports = cloneSymbol;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer');\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\nmodule.exports = cloneTypedArray;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer'),\n cloneDataView = require('./_cloneDataView'),\n cloneRegExp = require('./_cloneRegExp'),\n cloneSymbol = require('./_cloneSymbol'),\n cloneTypedArray = require('./_cloneTypedArray');\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return new Ctor;\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return new Ctor;\n\n case symbolTag:\n return cloneSymbol(object);\n }\n}\n\nmodule.exports = initCloneByTag;\n","var isObject = require('./isObject');\n\n/** Built-in value references. */\nvar objectCreate = Object.create;\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n}());\n\nmodule.exports = baseCreate;\n","var baseCreate = require('./_baseCreate'),\n getPrototype = require('./_getPrototype'),\n isPrototype = require('./_isPrototype');\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\nmodule.exports = initCloneObject;\n","var getTag = require('./_getTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]';\n\n/**\n * The base implementation of `_.isMap` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n */\nfunction baseIsMap(value) {\n return isObjectLike(value) && getTag(value) == mapTag;\n}\n\nmodule.exports = baseIsMap;\n","var baseIsMap = require('./_baseIsMap'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\n\n/* Node.js helper references. */\nvar nodeIsMap = nodeUtil && nodeUtil.isMap;\n\n/**\n * Checks if `value` is classified as a `Map` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n * @example\n *\n * _.isMap(new Map);\n * // => true\n *\n * _.isMap(new WeakMap);\n * // => false\n */\nvar isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;\n\nmodule.exports = isMap;\n","var getTag = require('./_getTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar setTag = '[object Set]';\n\n/**\n * The base implementation of `_.isSet` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n */\nfunction baseIsSet(value) {\n return isObjectLike(value) && getTag(value) == setTag;\n}\n\nmodule.exports = baseIsSet;\n","var baseIsSet = require('./_baseIsSet'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\n\n/* Node.js helper references. */\nvar nodeIsSet = nodeUtil && nodeUtil.isSet;\n\n/**\n * Checks if `value` is classified as a `Set` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n * @example\n *\n * _.isSet(new Set);\n * // => true\n *\n * _.isSet(new WeakSet);\n * // => false\n */\nvar isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;\n\nmodule.exports = isSet;\n","var Stack = require('./_Stack'),\n arrayEach = require('./_arrayEach'),\n assignValue = require('./_assignValue'),\n baseAssign = require('./_baseAssign'),\n baseAssignIn = require('./_baseAssignIn'),\n cloneBuffer = require('./_cloneBuffer'),\n copyArray = require('./_copyArray'),\n copySymbols = require('./_copySymbols'),\n copySymbolsIn = require('./_copySymbolsIn'),\n getAllKeys = require('./_getAllKeys'),\n getAllKeysIn = require('./_getAllKeysIn'),\n getTag = require('./_getTag'),\n initCloneArray = require('./_initCloneArray'),\n initCloneByTag = require('./_initCloneByTag'),\n initCloneObject = require('./_initCloneObject'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isMap = require('./isMap'),\n isObject = require('./isObject'),\n isSet = require('./isSet'),\n keys = require('./keys');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG = 4;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values supported by `_.clone`. */\nvar cloneableTags = {};\ncloneableTags[argsTag] = cloneableTags[arrayTag] =\ncloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\ncloneableTags[boolTag] = cloneableTags[dateTag] =\ncloneableTags[float32Tag] = cloneableTags[float64Tag] =\ncloneableTags[int8Tag] = cloneableTags[int16Tag] =\ncloneableTags[int32Tag] = cloneableTags[mapTag] =\ncloneableTags[numberTag] = cloneableTags[objectTag] =\ncloneableTags[regexpTag] = cloneableTags[setTag] =\ncloneableTags[stringTag] = cloneableTags[symbolTag] =\ncloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\ncloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\ncloneableTags[errorTag] = cloneableTags[funcTag] =\ncloneableTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Deep clone\n * 2 - Flatten inherited properties\n * 4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\nfunction baseClone(value, bitmask, customizer, key, object, stack) {\n var result,\n isDeep = bitmask & CLONE_DEEP_FLAG,\n isFlat = bitmask & CLONE_FLAT_FLAG,\n isFull = bitmask & CLONE_SYMBOLS_FLAG;\n\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = (isFlat || isFunc) ? {} : initCloneObject(value);\n if (!isDeep) {\n return isFlat\n ? copySymbolsIn(value, baseAssignIn(result, value))\n : copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (isSet(value)) {\n value.forEach(function(subValue) {\n result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));\n });\n } else if (isMap(value)) {\n value.forEach(function(subValue, key) {\n result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n }\n\n var keysFunc = isFull\n ? (isFlat ? getAllKeysIn : getAllKeys)\n : (isFlat ? keysIn : keys);\n\n var props = isArr ? undefined : keysFunc(value);\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n return result;\n}\n\nmodule.exports = baseClone;\n","/**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\nfunction last(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined;\n}\n\nmodule.exports = last;\n","/**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\nfunction baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = end > length ? length : end;\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n}\n\nmodule.exports = baseSlice;\n","var baseGet = require('./_baseGet'),\n baseSlice = require('./_baseSlice');\n\n/**\n * Gets the parent value at `path` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} path The path to get the parent value of.\n * @returns {*} Returns the parent value.\n */\nfunction parent(object, path) {\n return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));\n}\n\nmodule.exports = parent;\n","var castPath = require('./_castPath'),\n last = require('./last'),\n parent = require('./_parent'),\n toKey = require('./_toKey');\n\n/**\n * The base implementation of `_.unset`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The property path to unset.\n * @returns {boolean} Returns `true` if the property is deleted, else `false`.\n */\nfunction baseUnset(object, path) {\n path = castPath(path, object);\n object = parent(object, path);\n return object == null || delete object[toKey(last(path))];\n}\n\nmodule.exports = baseUnset;\n","var baseGetTag = require('./_baseGetTag'),\n getPrototype = require('./_getPrototype'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nmodule.exports = isPlainObject;\n","var isPlainObject = require('./isPlainObject');\n\n/**\n * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain\n * objects.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {string} key The key of the property to inspect.\n * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.\n */\nfunction customOmitClone(value) {\n return isPlainObject(value) ? undefined : value;\n}\n\nmodule.exports = customOmitClone;\n","var arrayMap = require('./_arrayMap'),\n baseClone = require('./_baseClone'),\n baseUnset = require('./_baseUnset'),\n castPath = require('./_castPath'),\n copyObject = require('./_copyObject'),\n customOmitClone = require('./_customOmitClone'),\n flatRest = require('./_flatRest'),\n getAllKeysIn = require('./_getAllKeysIn');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG = 4;\n\n/**\n * The opposite of `_.pick`; this method creates an object composed of the\n * own and inherited enumerable property paths of `object` that are not omitted.\n *\n * **Note:** This method is considerably slower than `_.pick`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {...(string|string[])} [paths] The property paths to omit.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.omit(object, ['a', 'c']);\n * // => { 'b': '2' }\n */\nvar omit = flatRest(function(object, paths) {\n var result = {};\n if (object == null) {\n return result;\n }\n var isDeep = false;\n paths = arrayMap(paths, function(path) {\n path = castPath(path, object);\n isDeep || (isDeep = path.length > 1);\n return path;\n });\n copyObject(object, getAllKeysIn(object), result);\n if (isDeep) {\n result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);\n }\n var length = paths.length;\n while (length--) {\n baseUnset(result, paths[length]);\n }\n return result;\n});\n\nmodule.exports = omit;\n","'use strict';\n\nvar GROUP_LEFT_TO_RIGHT,\n GROUP_RIGHT_TO_LEFT,\n EXPRESSION_LEFT_TO_RIGHT,\n EXPRESSION_RIGHT_TO_LEFT;\n\n/*\n * Character ranges of left-to-right characters.\n */\n\nGROUP_LEFT_TO_RIGHT = 'A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6' +\n '\\u00F8-\\u02B8\\u0300-\\u0590\\u0800-\\u1FFF\\u200E\\u2C00-\\uFB1C' +\n '\\uFE00-\\uFE6F\\uFEFD-\\uFFFF';\n\n/*\n * Character ranges of right-to-left characters.\n */\n\nGROUP_RIGHT_TO_LEFT = '\\u0591-\\u07FF\\uFB1D-\\uFDFD\\uFE70-\\uFEFC';\n\n/*\n * Expression to match a left-to-right string.\n *\n * Matches the start of a string, followed by zero or\n * more non-right-to-left characters, followed by a\n * left-to-right character.\n */\n\nEXPRESSION_LEFT_TO_RIGHT = new RegExp(\n '^[^' + GROUP_RIGHT_TO_LEFT + ']*[' + GROUP_LEFT_TO_RIGHT + ']'\n);\n\n/*\n * Expression to match a right-to-left string.\n *\n * Matches the start of a string, followed by zero or\n * more non-left-to-right characters, followed by a\n * right-to-left character.\n */\n\nEXPRESSION_RIGHT_TO_LEFT = new RegExp(\n '^[^' + GROUP_LEFT_TO_RIGHT + ']*[' + GROUP_RIGHT_TO_LEFT + ']'\n);\n\n/**\n * Detect the direction of text.\n *\n * @param {string} value - value to stringify and check.\n * @return {string} - One of `\"rtl\"`, `\"ltr\"`, or\n * `\"neutral\"`.\n */\nfunction direction(value) {\n value = value.toString();\n\n if (EXPRESSION_RIGHT_TO_LEFT.test(value)) {\n return 'rtl';\n }\n\n if (EXPRESSION_LEFT_TO_RIGHT.test(value)) {\n return 'ltr';\n }\n\n return 'neutral';\n}\n\n/*\n * Expose `direction`.\n */\n\nmodule.exports = direction;\n","import \"@babel/polyfill\"\nimport React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport * as Sentry from '@sentry/browser'\nimport { bindAllSettledToPromise } from '~/utils/promise'\nimport { version } from '~/../package.json';\n\nimport Application from '~/Application/index';\n\n\nfunction renderApp() {\n\n\tif(process.env.SENTRY_DSN){\n\t\tSentry.init({\n\t\t\tdsn: process.env.SENTRY_DSN,\n\t\t\tenvironment: process.env.ENVIRONMENT,\n\t\t\trelease: version,\n\t\t\tintegrations: [\n\t\t\t\tnew Sentry.Integrations.Breadcrumbs({})\n\t\t\t],\n\t\t})\n\t}\n\n\t// const Application = require(\"~/Application/index\").default\n\tReactDOM.render(, document.getElementById(\"editor\"))\n}\n\n// implement Promise.allSettled if not supported by browser\nbindAllSettledToPromise()\n\nrenderApp()\n\nif (module.hot) {\n\tmodule.hot.accept(renderApp)\n}\n","/**\n * An auto-incrementing index for generating keys.\n *\n * @type {Number}\n */\n\nlet n\n\n/**\n * The global key generating function.\n *\n * @type {Function}\n */\n\nlet generate\n\n/**\n * Create a key, using a provided key if available.\n *\n * @param {String|Void} key\n * @return {String}\n */\n\nfunction create(key) {\n if (key == null) {\n return generate()\n }\n\n if (typeof key === 'string') {\n return key\n }\n\n throw new Error(`Keys must be strings, but you passed: ${key}`)\n}\n\n/**\n * Set a different unique ID generating `function`.\n *\n * @param {Function} func\n */\n\nfunction setGenerator(func) {\n generate = func\n}\n\n/**\n * Reset the key generating function to its initial state.\n */\n\nfunction resetGenerator() {\n n = 0\n generate = () => `${n++}`\n}\n\n/**\n * Set the initial state.\n */\n\nresetGenerator()\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default {\n create,\n setGenerator,\n resetGenerator,\n}\n","import { List } from 'immutable'\n\n/**\n * Compare paths `path` and `target` to see which is before or after.\n *\n * @param {List} path\n * @param {List} target\n * @return {Number|Null}\n */\n\nfunction compare(path, target) {\n const m = min(path, target)\n\n for (let i = 0; i < m; i++) {\n const pv = path.get(i)\n const tv = target.get(i)\n\n // If the path's value is ever less than the target's, it's before.\n if (pv < tv) return -1\n\n // If the target's value is ever less than the path's, it's after.\n if (pv > tv) return 1\n }\n\n // Paths should now be equal, otherwise something is wrong\n return path.size === target.size ? 0 : null\n}\n\n/**\n * Create a path from `attrs`.\n *\n * @param {Array|List} attrs\n * @return {List}\n */\n\nfunction create(attrs) {\n if (attrs == null) {\n return null\n }\n\n if (List.isList(attrs)) {\n return attrs\n }\n\n if (Array.isArray(attrs)) {\n return List(attrs)\n }\n\n throw new Error(\n `Paths can only be created from arrays or lists, but you passed: ${attrs}`\n )\n}\n\n/**\n * Crop paths `a` and `b` to an equal size, defaulting to the shortest.\n *\n * @param {List} a\n * @param {List} b\n */\n\nfunction crop(a, b, size = min(a, b)) {\n const ca = a.slice(0, size)\n const cb = b.slice(0, size)\n return [ca, cb]\n}\n\n/**\n * Decrement a `path` by `n` at `index`, defaulting to the last index.\n *\n * @param {List} path\n * @param {Number} n\n * @param {Number} index\n */\n\nfunction decrement(path, n = 1, index = path.size - 1) {\n return increment(path, 0 - n, index)\n}\n\n/**\n * Get all ancestor paths of th given path.\n *\n * @param {List} path\n * @returns {List}\n */\n\nfunction getAncestors(path) {\n const ancestors = List().withMutations(list => {\n for (let i = 0; i < path.size; i++) {\n list.push(path.slice(0, i))\n }\n })\n\n return ancestors\n}\n\n/**\n * Increment a `path` by `n` at `index`, defaulting to the last index.\n *\n * @param {List} path\n * @param {Number} n\n * @param {Number} index\n */\n\nfunction increment(path, n = 1, index = path.size - 1) {\n const value = path.get(index)\n const newValue = value + n\n const newPath = path.set(index, newValue)\n return newPath\n}\n\n/**\n * Is a `path` above another `target` path?\n *\n * @param {List} path\n * @param {List} target\n * @return {Boolean}\n */\n\nfunction isAbove(path, target) {\n const [p, t] = crop(path, target)\n return path.size < target.size && compare(p, t) === 0\n}\n\n/**\n * Is a `path` after another `target` path in a document?\n *\n * @param {List} path\n * @param {List} target\n * @return {Boolean}\n */\n\nfunction isAfter(path, target) {\n const [p, t] = crop(path, target)\n return compare(p, t) === 1\n}\n\n/**\n * Is a `path` before another `target` path in a document?\n *\n * @param {List} path\n * @param {List} target\n * @return {Boolean}\n */\n\nfunction isBefore(path, target) {\n const [p, t] = crop(path, target)\n return compare(p, t) === -1\n}\n\n/**\n * Is a `path` equal to another `target` path in a document?\n *\n * @param {List} path\n * @param {List} target\n * @return {Boolean}\n */\n\nfunction isEqual(path, target) {\n return path.equals(target)\n}\n\n/**\n * Is a `path` older than a `target` path? Meaning that it ends as an older\n * sibling of one of the indexes in the target.\n *\n * @param {List} path\n * @param {List} target\n * @return {Boolean}\n */\n\nfunction isOlder(path, target) {\n const index = path.size - 1\n const [p, t] = crop(path, target, index)\n const pl = path.get(index)\n const tl = target.get(index)\n return isEqual(p, t) && pl > tl\n}\n\n/**\n * Is an `any` object a path?\n *\n * @param {Mixed} any\n * @return {Boolean}\n */\n\nfunction isPath(any) {\n return (\n (List.isList(any) || Array.isArray(any)) &&\n any.every(n => typeof n === 'number')\n )\n}\n\n/**\n * Is a `path` a sibling of a `target` path?\n *\n * @param {List} path\n * @param {List} target\n * @return {Boolean}\n */\n\nfunction isSibling(path, target) {\n if (path.size !== target.size) return false\n const p = path.butLast()\n const t = target.butLast()\n return p.equals(t)\n}\n\n/**\n * Is a `path` younger than a `target` path? Meaning that it ends as a younger\n * sibling of one of the indexes in the target.\n *\n * @param {List} path\n * @param {List} target\n * @return {Boolean}\n */\n\nfunction isYounger(path, target) {\n const index = path.size - 1\n const [p, t] = crop(path, target, index)\n const pl = path.get(index)\n const tl = target.get(index)\n return isEqual(p, t) && pl < tl\n}\n\n/**\n * Lift a `path` to refer to its `n`th ancestor.\n *\n * @param {List} path\n * @return {List}\n */\n\nfunction lift(path, n = 1) {\n const ancestor = path.slice(0, -1 * n)\n return ancestor\n}\n\n/**\n * Drop a `path`, returning a relative path from a depth of `n`.\n *\n * @param {List} path\n * @param {Number} n\n * @return {List}\n */\n\nfunction drop(path, n = 1) {\n const relative = path.slice(n)\n return relative\n}\n\n/**\n * Get the maximum length of paths `a` and `b`.\n *\n * @param {List} path\n * @param {List} path\n * @return {Number}\n */\n\nfunction max(a, b) {\n const n = Math.max(a.size, b.size)\n return n\n}\n\n/**\n * Get the minimum length of paths `a` and `b`.\n *\n * @param {List} path\n * @param {List} path\n * @return {Number}\n */\n\nfunction min(a, b) {\n const n = Math.min(a.size, b.size)\n return n\n}\n\n/**\n * Get the common ancestor path of path `a` and path `b`.\n *\n * @param {List} a\n * @param {List} b\n * @return {List}\n */\n\nfunction relate(a, b) {\n const array = []\n\n for (let i = 0; i < a.size && i < b.size; i++) {\n const av = a.get(i)\n const bv = b.get(i)\n\n // If the values aren't equal, they've diverged and don't share an ancestor.\n if (av !== bv) break\n\n // Otherwise, the current value is still a common ancestor.\n array.push(av)\n }\n\n const path = create(array)\n return path\n}\n\n/**\n * Transform a `path` by an `operation`, adjusting it to stay current.\n *\n * @param {List} path\n * @param {Operation} operation\n * @return {List}\n */\n\nfunction transform(path, operation) {\n const { type, position, path: p } = operation\n\n if (\n type === 'add_mark' ||\n type === 'insert_text' ||\n type === 'remove_mark' ||\n type === 'remove_text' ||\n type === 'set_mark' ||\n type === 'set_node' ||\n type === 'set_selection' ||\n type === 'set_value' ||\n type === 'add_annotation' ||\n type === 'remove_annotation' ||\n type === 'set_annotation' ||\n path.size === 0\n ) {\n return List([path])\n }\n\n const pIndex = p.size - 1\n const pEqual = isEqual(p, path)\n const pYounger = isYounger(p, path)\n const pAbove = isAbove(p, path)\n\n if (type === 'insert_node') {\n if (pEqual || pYounger || pAbove) {\n path = increment(path, 1, pIndex)\n }\n }\n\n if (type === 'remove_node') {\n if (pYounger) {\n path = decrement(path, 1, pIndex)\n } else if (pEqual || pAbove) {\n path = []\n }\n }\n\n if (type === 'merge_node') {\n if (pEqual || pYounger) {\n path = decrement(path, 1, pIndex)\n } else if (pAbove) {\n path = decrement(path, 1, pIndex)\n path = increment(path, position, pIndex + 1)\n }\n }\n\n if (type === 'split_node') {\n if (pEqual) {\n path = [path, increment(path)]\n } else if (pYounger) {\n path = increment(path, 1, pIndex)\n } else if (pAbove) {\n if (path.get(pIndex + 1) >= position) {\n path = increment(path, 1, pIndex)\n path = decrement(path, position, pIndex + 1)\n }\n }\n }\n\n if (type === 'move_node') {\n const { newPath: np } = operation\n\n if (isEqual(p, np)) {\n return List([path])\n }\n\n if (pAbove || pEqual) {\n // We are comparing something that was moved\n // The new path is unaffected unless the old path was the left-sibling of an ancestor\n if (isYounger(p, np) && p.size < np.size) {\n path = decrement(np, 1, min(np, p) - 1).concat(path.slice(p.size))\n } else {\n path = np.concat(path.slice(p.size))\n }\n } else {\n // This is equivalent logic to remove_node for path\n if (pYounger) {\n path = decrement(path, 1, pIndex)\n }\n\n // This is the equivalent logic to insert_node for newPath\n if (isYounger(np, path) || isEqual(np, path) || isAbove(np, path)) {\n path = increment(path, 1, np.size - 1)\n }\n }\n }\n\n const paths = Array.isArray(path) ? path : [path]\n return List(paths)\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default {\n compare,\n create,\n crop,\n decrement,\n getAncestors,\n increment,\n isAbove,\n isAfter,\n isBefore,\n isEqual,\n isOlder,\n isPath,\n isSibling,\n isYounger,\n lift,\n drop,\n max,\n min,\n relate,\n transform,\n}\n","import isPlainObject from 'is-plain-object'\nimport warning from 'tiny-warning'\nimport { Record } from 'immutable'\n\nimport KeyUtils from '../utils/key-utils'\nimport PathUtils from '../utils/path-utils'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n key: undefined,\n offset: undefined,\n path: undefined,\n}\n\n/**\n * Point.\n *\n * @type {Point}\n */\n\nclass Point extends Record(DEFAULTS) {\n /**\n * Create a new `Point` with `attrs`.\n *\n * @param {Object|Point} attrs\n * @return {Point}\n */\n\n static create(attrs = {}) {\n if (Point.isPoint(attrs)) {\n return attrs\n }\n\n if (isPlainObject(attrs)) {\n return Point.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Point.create\\` only accepts objects or points, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a dictionary of settable point properties from `attrs`.\n *\n * @param {Object|Point} attrs\n * @return {Object}\n */\n\n static createProperties(a = {}) {\n if (Point.isPoint(a)) {\n return {\n key: a.key,\n offset: a.offset,\n path: a.path,\n }\n }\n\n if (isPlainObject(a)) {\n const p = {}\n if ('key' in a) p.key = a.key\n if ('offset' in a) p.offset = a.offset\n if ('path' in a) p.path = PathUtils.create(a.path)\n\n // If only a path is set, or only a key is set, ensure that the other is\n // set to null so that it can be normalized back to the right value.\n // Otherwise we won't realize that the path and key don't match anymore.\n if ('path' in a && !('key' in a)) p.key = null\n if ('key' in a && !('path' in a)) p.path = null\n\n return p\n }\n\n throw new Error(\n `\\`Point.createProperties\\` only accepts objects or points, but you passed it: ${a}`\n )\n }\n\n /**\n * Create a `Point` from a JSON `object`.\n *\n * @param {Object} object\n * @return {Point}\n */\n\n static fromJSON(object) {\n const { key = null, offset = null, path = null } = object\n\n const point = new Point({\n key,\n offset,\n path: PathUtils.create(path),\n })\n\n return point\n }\n\n /**\n * Check whether all properties of the point are set.\n *\n * @return {Boolean}\n */\n\n get isSet() {\n return this.key != null && this.offset != null && this.path != null\n }\n\n /**\n * Check whether any property of the point is not set.\n *\n * @return {Boolean}\n */\n\n get isUnset() {\n return !this.isSet\n }\n\n /**\n * Check whether the point is after another `point`.\n *\n * @return {Boolean}\n */\n\n isAfterPoint(point) {\n if (this.isUnset) return false\n const is =\n (this.key === point.key && this.offset > point.offset) ||\n PathUtils.compare(this.path, point.path) === 1\n return is\n }\n\n /**\n * Check whether the point is after a `range`.\n *\n * @return {Boolean}\n */\n\n isAfterRange(range) {\n if (this.isUnset) return false\n const is = this.isAfterPoint(range.end)\n return is\n }\n\n /**\n * Check whether the point is at the end of a `range`.\n *\n * @return {Boolean}\n */\n\n isAtEndOfRange(range) {\n if (this.isUnset) return false\n const is = this.equals(range.end)\n return is\n }\n\n /**\n * Check whether the point is at the start of a `range`.\n *\n * @return {Boolean}\n */\n\n isAtStartOfRange(range) {\n if (this.isUnset) return false\n const is = this.equals(range.start)\n return is\n }\n\n /**\n * Check whether the point is before another `point`.\n *\n * @return {Boolean}\n */\n\n isBeforePoint(point) {\n if (this.isUnset) return false\n const is =\n (this.key === point.key && this.offset < point.offset) ||\n PathUtils.compare(this.path, point.path) === -1\n return is\n }\n\n /**\n * Check whether the point is before a `range`.\n *\n * @return {Boolean}\n */\n\n isBeforeRange(range) {\n if (this.isUnset) return false\n const is = this.isBeforePoint(range.start)\n return is\n }\n\n /**\n * Check whether the point is inside a `range`.\n *\n * @return {Boolean}\n */\n\n isInRange(range) {\n if (this.isUnset) return false\n const is =\n this.equals(range.start) ||\n this.equals(range.end) ||\n (this.isAfterPoint(range.start) && this.isBeforePoint(range.end))\n return is\n }\n\n /**\n * Check whether the point is at the end of a `node`.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\n isAtEndOfNode(node) {\n if (this.isUnset) return false\n const last = node.getLastText()\n const is = this.key === last.key && this.offset === last.text.length\n return is\n }\n\n /**\n * Check whether the point is at the start of a `node`.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\n isAtStartOfNode(node) {\n if (this.isUnset) return false\n\n // PERF: Do a check for a `0` offset first since it's quickest.\n if (this.offset !== 0) return false\n\n const first = node.getFirstText()\n const is = this.key === first.key\n return is\n }\n\n /**\n * Check whether the point is in a `node`.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\n isInNode(node) {\n if (this.isUnset) return false\n if (node.object === 'text' && node.key === this.key) return true\n if (node.hasNode(this.key)) return true\n return false\n }\n\n /**\n * Move the point's offset backward `n` characters.\n *\n * @param {Number} n (optional)\n * @return {Point}\n */\n\n moveBackward(n = 1) {\n if (n === 0) return this\n if (n < 0) return this.moveForward(-n)\n const point = this.setOffset(this.offset - n)\n return point\n }\n\n /**\n * Move the point's offset forward `n` characters.\n *\n * @param {Number} n (optional)\n * @return {Point}\n */\n\n moveForward(n = 1) {\n if (n === 0) return this\n if (n < 0) return this.moveBackward(-n)\n const point = this.setOffset(this.offset + n)\n return point\n }\n\n /**\n * Move the point's anchor point to a new `path` and `offset`.\n *\n * Optionally, the `path` can be a key string, or omitted entirely in which\n * case it would be the offset number.\n *\n * @param {List|String|Number} path\n * @param {Number} offset\n * @return {Point}\n */\n\n moveTo(path, offset = 0) {\n let key = this.key\n\n if (typeof path === 'number') {\n offset = path\n path = this.path\n } else if (typeof path === 'string') {\n key = path\n path = key === this.key ? this.path : null\n } else {\n key = path.equals(this.path) ? this.key : null\n }\n\n const point = this.merge({ key, path, offset })\n return point\n }\n\n /**\n * Move the point's anchor point to the start of a `node`.\n *\n * @param {Node} node\n * @return {Point}\n */\n\n moveToStartOfNode(node) {\n const first = node.getFirstText()\n const point = this.moveTo(first.key, 0)\n return point\n }\n\n /**\n * Move the point's anchor point to the end of a `node`.\n *\n * @param {Node} node\n * @return {Point}\n */\n\n moveToEndOfNode(node) {\n const last = node.getLastText()\n const point = this.moveTo(last.key, last.text.length)\n return point\n }\n\n /**\n * Normalize the point relative to a `node`, ensuring that its key and path\n * reference a text node, or that it gets unset.\n *\n * @param {Node} node\n * @return {Point}\n */\n\n normalize(node) {\n // If both the key and path are null, there's no reference to a node, so\n // make sure it is entirely unset.\n if (this.key == null && this.path == null) {\n return this.setOffset(null)\n }\n\n const { key, offset, path } = this\n\n // PERF: this function gets called a lot.\n // to avoid creating the key -> path lookup table, we attempt to look up by path first.\n let target = path && node.getNode(path)\n\n if (!target) {\n target = node.getNode(key)\n\n if (target) {\n // There is a misalignment of path and key\n const point = this.merge({\n path: node.getPath(key),\n })\n\n return point\n }\n }\n\n if (!target) {\n warning(false, \"A point's `path` or `key` invalid and was reset!\")\n\n const text = node.getFirstText()\n if (!text) return Point.create()\n\n const point = this.merge({\n key: text.key,\n offset: 0,\n path: node.getPath(text.key),\n })\n\n return point\n }\n\n if (target.object !== 'text') {\n warning(false, 'A point should not reference a non-text node!')\n\n const text = target.getTextAtOffset(offset)\n const before = target.getOffset(text.key)\n const point = this.merge({\n offset: offset - before,\n key: text.key,\n path: node.getPath(text.key),\n })\n\n return point\n }\n\n if (target && path && key && key !== target.key) {\n warning(false, \"A point's `key` did not match its `path`!\")\n\n // TODO: if we look up by path above and it differs by key, do we want to reset it to looking up by key?\n }\n\n let point = this.merge({\n key: target.key,\n path: path == null ? node.getPath(target.key) : path,\n offset: offset == null ? 0 : Math.min(offset, target.text.length),\n })\n\n // COMPAT: There is an ambiguity, since a point can exist at the end of a\n // text node, or at the start of the following one. To eliminate it we\n // enforce that if there is a following text node, we always move it there.\n if (point.offset === target.text.length) {\n const block = node.getClosestBlock(point.path)\n // TODO: this next line is broken because `getNextText` takes a path\n const next = block.getNextText()\n\n if (next) {\n point = point.merge({\n key: next.key,\n path: node.getPath(next.key),\n offset: 0,\n })\n }\n }\n\n return point\n }\n\n /**\n * Set the point's key to a new `key`.\n *\n * @param {String} key\n * @return {Point}\n */\n\n setKey(key) {\n if (key != null) {\n key = KeyUtils.create(key)\n }\n\n const point = this.set('key', key)\n return point\n }\n\n /**\n * Set the point's offset to a new `offset`.\n *\n * @param {Number} offset\n * @return {Point}\n */\n\n setOffset(offset) {\n const point = this.set('offset', offset)\n return point\n }\n\n /**\n * Set the point's path to a new `path`.\n *\n * @param {List|Array} path\n * @return {Point}\n */\n\n setPath(path) {\n if (path != null) {\n path = PathUtils.create(path)\n }\n\n const point = this.set('path', path)\n return point\n }\n\n /**\n * Return a JSON representation of the point.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const object = {\n object: this.object,\n key: this.key,\n offset: this.offset,\n path: this.path && this.path.toArray(),\n }\n\n if (!options.preserveKeys) {\n delete object.key\n }\n\n return object\n }\n\n /**\n * Unset the point.\n *\n * @return {Point}\n */\n\n unset() {\n return this.merge({\n key: null,\n offset: null,\n path: null,\n })\n }\n}\n\n/**\n * Export.\n *\n * @type {Point}\n */\n\nexport default Point\n","import isPlainObject from 'is-plain-object'\nimport { Map } from 'immutable'\n\n/**\n * Data.\n *\n * This isn't an immutable record, it's just a thin wrapper around `Map` so that\n * we can allow for more convenient creation.\n *\n * @type {Object}\n */\n\nclass Data {\n /**\n * Create a new `Data` with `attrs`.\n *\n * @param {Object|Data|Map} attrs\n * @return {Data} data\n */\n\n static create(attrs = {}) {\n if (Map.isMap(attrs)) {\n return attrs\n }\n\n if (isPlainObject(attrs)) {\n return Data.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Data.create\\` only accepts objects or maps, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `Data` from a JSON `object`.\n *\n * @param {Object} object\n * @return {Data}\n */\n\n static fromJSON(object) {\n return new Map(object)\n }\n\n /**\n * Alias `fromJS`.\n */\n\n static fromJS = Data.fromJSON\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default Data\n","import isPlainObject from 'is-plain-object'\nimport { Map, Record, Set } from 'immutable'\n\nimport Data from './data'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n data: undefined,\n type: undefined,\n}\n\n/**\n * Mark.\n *\n * @type {Mark}\n */\n\nclass Mark extends Record(DEFAULTS) {\n /**\n * Create a new `Mark` with `attrs`.\n *\n * @param {Object|Mark} attrs\n * @return {Mark}\n */\n\n static create(attrs = {}) {\n if (Mark.isMark(attrs)) {\n return attrs\n }\n\n if (typeof attrs === 'string') {\n attrs = { type: attrs }\n }\n\n if (isPlainObject(attrs)) {\n return Mark.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Mark.create\\` only accepts objects, strings or marks, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a set of marks.\n *\n * @param {Array} elements\n * @return {Set}\n */\n\n static createSet(elements) {\n if (Set.isSet(elements) || Array.isArray(elements)) {\n const marks = new Set(elements.map(Mark.create))\n return marks\n }\n\n if (elements == null) {\n return Set()\n }\n\n throw new Error(\n `\\`Mark.createSet\\` only accepts sets, arrays or null, but you passed it: ${elements}`\n )\n }\n\n /**\n * Create a dictionary of settable mark properties from `attrs`.\n *\n * @param {Object|String|Mark} attrs\n * @return {Object}\n */\n\n static createProperties(attrs = {}) {\n if (Mark.isMark(attrs)) {\n return {\n data: attrs.data,\n type: attrs.type,\n }\n }\n\n if (typeof attrs === 'string') {\n return { type: attrs }\n }\n\n if (isPlainObject(attrs)) {\n const props = {}\n if ('type' in attrs) props.type = attrs.type\n if ('data' in attrs) props.data = Data.create(attrs.data)\n return props\n }\n\n throw new Error(\n `\\`Mark.createProperties\\` only accepts objects, strings or marks, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `Mark` from a JSON `object`.\n *\n * @param {Object} object\n * @return {Mark}\n */\n\n static fromJSON(object) {\n const { data = {}, type } = object\n\n if (typeof type !== 'string') {\n throw new Error('`Mark.fromJS` requires a `type` string.')\n }\n\n const mark = new Mark({\n type,\n data: new Map(data),\n })\n\n return mark\n }\n\n /**\n * Check if `any` is a set of marks.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isMarkSet(any) {\n return Set.isSet(any) && any.every(item => Mark.isMark(item))\n }\n\n /**\n * Return a JSON representation of the mark.\n *\n * @return {Object}\n */\n\n toJSON() {\n const object = {\n object: this.object,\n type: this.type,\n data: this.data.toJSON(),\n }\n\n return object\n }\n}\n\n/**\n * Export.\n *\n * @type {Mark}\n */\n\nexport default Mark\n","import isPlainObject from 'is-plain-object'\nimport warning from 'tiny-warning'\nimport { List, Record } from 'immutable'\n\nimport Mark from './mark'\nimport Point from './point'\nimport Data from './data'\nimport Range from './range'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n type: undefined,\n data: undefined,\n anchor: undefined,\n focus: undefined,\n}\n\n/**\n * Decoration.\n *\n * @type {Decoration}\n */\n\nclass Decoration extends Record(DEFAULTS) {\n /**\n * Create a new `Decoration` with `attrs`.\n *\n * @param {Object|Decoration} attrs\n * @return {Decoration}\n */\n\n static create(attrs = {}) {\n if (Decoration.isDecoration(attrs)) {\n return attrs\n }\n\n if (Range.isRange(attrs)) {\n return Decoration.fromJSON(Range.createProperties(attrs))\n }\n\n if (isPlainObject(attrs)) {\n return Decoration.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Decoration.create\\` only accepts objects or decorations, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a list of `Ranges` from `elements`.\n *\n * @param {Array|List} elements\n * @return {List}\n */\n\n static createList(elements = []) {\n if (List.isList(elements) || Array.isArray(elements)) {\n const list = new List(elements.map(Decoration.create))\n return list\n }\n\n throw new Error(\n `\\`Decoration.createList\\` only accepts arrays or lists, but you passed it: ${elements}`\n )\n }\n\n /**\n * Create a dictionary of settable decoration properties from `attrs`.\n *\n * @param {Object|String|Decoration} attrs\n * @return {Object}\n */\n\n static createProperties(a = {}) {\n if (Decoration.isDecoration(a)) {\n return {\n type: a.type,\n data: a.data,\n anchor: Point.createProperties(a.anchor),\n focus: Point.createProperties(a.focus),\n mark: Mark.create(a.mark),\n }\n }\n\n if (isPlainObject(a)) {\n const p = {}\n if ('type' in a) p.type = a.type\n if ('data' in a) p.data = Data.create(a.data)\n if ('anchor' in a) p.anchor = Point.create(a.anchor)\n if ('focus' in a) p.focus = Point.create(a.focus)\n return p\n }\n\n throw new Error(\n `\\`Decoration.createProperties\\` only accepts objects or decorations, but you passed it: ${a}`\n )\n }\n\n /**\n * Create a `Decoration` from a JSON `object`.\n *\n * @param {Object} object\n * @return {Decoration}\n */\n\n static fromJSON(object) {\n const { anchor, focus } = object\n let { type, data } = object\n\n if (object.mark && !type) {\n warning(\n false,\n 'As of slate@0.47 the `decoration.mark` property has been changed to `decoration.type` and `decoration.data` directly.'\n )\n\n type = object.mark.type\n data = object.mark.data\n }\n\n if (!type) {\n throw new Error(\n `Decorations must be created with a \\`type\\`, but you passed: ${JSON.stringify(\n object\n )}`\n )\n }\n\n const decoration = new Decoration({\n type,\n data: Data.create(data || {}),\n anchor: Point.fromJSON(anchor || {}),\n focus: Point.fromJSON(focus || {}),\n })\n\n return decoration\n }\n\n /**\n * Set new `properties` on the decoration.\n *\n * @param {Object|Range|Selection} properties\n * @return {Range}\n */\n\n setProperties(properties) {\n properties = Decoration.createProperties(properties)\n const decoration = this.merge(properties)\n return decoration\n }\n\n /**\n * Return a JSON representation of the decoration.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const object = {\n object: this.object,\n type: this.type,\n data: this.data.toJSON(),\n anchor: this.anchor.toJSON(options),\n focus: this.focus.toJSON(options),\n }\n\n return object\n }\n}\n\n/**\n * Export.\n *\n * @type {Decoration}\n */\n\nexport default Decoration\n","import isPlainObject from 'is-plain-object'\nimport { Record, Set } from 'immutable'\n\nimport Mark from './mark'\nimport Point from './point'\nimport Range from './range'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n anchor: undefined,\n focus: undefined,\n isFocused: undefined,\n marks: undefined,\n}\n\n/**\n * Selection.\n *\n * @type {Selection}\n */\n\nclass Selection extends Record(DEFAULTS) {\n /**\n * Create a new `Selection` with `attrs`.\n *\n * @param {Object|Selection} attrs\n * @return {Selection}\n */\n\n static create(attrs = {}) {\n if (Selection.isSelection(attrs)) {\n return attrs\n }\n\n if (Range.isRange(attrs)) {\n return Selection.fromJSON(Range.createProperties(attrs))\n }\n\n if (isPlainObject(attrs)) {\n return Selection.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Selection.create\\` only accepts objects, ranges or selections, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a dictionary of settable selection properties from `attrs`.\n *\n * @param {Object|String|Selection} attrs\n * @return {Object}\n */\n\n static createProperties(a = {}) {\n if (Selection.isSelection(a)) {\n return {\n anchor: Point.createProperties(a.anchor),\n focus: Point.createProperties(a.focus),\n isFocused: a.isFocused,\n marks: a.marks,\n }\n }\n\n if (Range.isRange(a)) {\n return {\n anchor: Point.createProperties(a.anchor),\n focus: Point.createProperties(a.focus),\n }\n }\n\n if (isPlainObject(a)) {\n const p = {}\n if ('anchor' in a) p.anchor = Point.create(a.anchor)\n if ('focus' in a) p.focus = Point.create(a.focus)\n if ('isFocused' in a) p.isFocused = a.isFocused\n if ('marks' in a)\n p.marks = a.marks == null ? null : Mark.createSet(a.marks)\n return p\n }\n\n throw new Error(\n `\\`Selection.createProperties\\` only accepts objects, ranges or selections, but you passed it: ${a}`\n )\n }\n\n /**\n * Create a `Selection` from a JSON `object`.\n *\n * @param {Object} object\n * @return {Selection}\n */\n\n static fromJSON(object) {\n const { anchor, focus, isFocused = false, marks = null } = object\n const selection = new Selection({\n anchor: Point.fromJSON(anchor || {}),\n focus: Point.fromJSON(focus || {}),\n isFocused,\n marks: marks == null ? null : new Set(marks.map(Mark.fromJSON)),\n })\n\n return selection\n }\n\n /**\n * Check whether the selection is blurred.\n *\n * @return {Boolean}\n */\n\n get isBlurred() {\n return !this.isFocused\n }\n\n /**\n * Set the `isFocused` property to a new `value`.\n *\n * @param {Boolean} value\n * @return {Selection}\n */\n\n setIsFocused(value) {\n const selection = this.set('isFocused', value)\n return selection\n }\n\n /**\n * Set the `marks` property to a new set of `marks`.\n *\n * @param {Set} marks\n * @return {Selection}\n */\n\n setMarks(marks) {\n const selection = this.set('marks', marks)\n return selection\n }\n\n /**\n * Set new `properties` on the selection.\n *\n * @param {Object|Range|Selection} properties\n * @return {Range}\n */\n\n setProperties(properties) {\n properties = Selection.createProperties(properties)\n const { anchor, focus, ...props } = properties\n\n if (anchor) {\n props.anchor = Point.create(anchor)\n }\n\n if (focus) {\n props.focus = Point.create(focus)\n }\n\n const selection = this.merge(props)\n return selection\n }\n\n /**\n * Return a JSON representation of the selection.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const object = {\n object: this.object,\n anchor: this.anchor.toJSON(options),\n focus: this.focus.toJSON(options),\n isFocused: this.isFocused,\n marks:\n this.marks == null ? null : this.marks.toArray().map(m => m.toJSON()),\n }\n\n return object\n }\n}\n\n/**\n * Export.\n *\n * @type {Selection}\n */\n\nexport default Selection\n","/**\n * Slate-specific object types.\n *\n * @type {Object}\n */\n\nexport const TYPES = {\n annotation: '@@__SLATE_ANNOTATION__@@',\n block: '@@__SLATE_BLOCK__@@',\n change: '@@__SLATE_CHANGE__@@',\n decoration: '@@__SLATE_DECORATION__@@',\n document: '@@__SLATE_DOCUMENT__@@',\n editor: '@@__SLATE_EDITOR__@@',\n inline: '@@__SLATE_INLINE__@@',\n leaf: '@@__SLATE_LEAF__@@',\n mark: '@@__SLATE_MARK__@@',\n operation: '@@__SLATE_OPERATION__@@',\n point: '@@__SLATE_POINT__@@',\n range: '@@__SLATE_RANGE__@@',\n selection: '@@__SLATE_SELECTION__@@',\n text: '@@__SLATE_TEXT__@@',\n value: '@@__SLATE_VALUE__@@',\n}\n\n/**\n * Determine whether a `value` is of `type`.\n *\n * @param {string} type\n * @param {any} value\n * @return {boolean}\n */\n\nexport default function isObject(type, value) {\n return !!(value && value[TYPES[type]])\n}\n","import isPlainObject from 'is-plain-object'\nimport { List, Record } from 'immutable'\n\nimport Decoration from './decoration'\nimport Point from './point'\nimport Selection from './selection'\nimport isObject from '../utils/is-object'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n anchor: undefined,\n focus: undefined,\n}\n\n/**\n * Range.\n *\n * @type {Range}\n */\n\nclass Range extends Record(DEFAULTS) {\n /**\n * Create a new `Range` with `attrs`.\n *\n * @param {Object|Range} attrs\n * @return {Range}\n */\n\n static create(attrs = {}) {\n if (Range.isRange(attrs)) {\n if (attrs.object === 'range') {\n return attrs\n } else {\n return Range.fromJSON(Range.createProperties(attrs))\n }\n }\n\n if (isPlainObject(attrs)) {\n return Range.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Range.create\\` only accepts objects or ranges, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a list of `Ranges` from `elements`.\n *\n * @param {Array|List} elements\n * @return {List}\n */\n\n static createList(elements = []) {\n if (List.isList(elements) || Array.isArray(elements)) {\n const list = new List(elements.map(Range.create))\n return list\n }\n\n throw new Error(\n `\\`Range.createList\\` only accepts arrays or lists, but you passed it: ${elements}`\n )\n }\n\n /**\n * Create a dictionary of settable range properties from `attrs`.\n *\n * @param {Object|String|Range} attrs\n * @return {Object}\n */\n\n static createProperties(a = {}) {\n if (Range.isRange(a)) {\n return {\n anchor: Point.createProperties(a.anchor),\n focus: Point.createProperties(a.focus),\n }\n }\n\n if (isPlainObject(a)) {\n const p = {}\n if ('anchor' in a) p.anchor = Point.create(a.anchor)\n if ('focus' in a) p.focus = Point.create(a.focus)\n return p\n }\n\n throw new Error(\n `\\`Range.createProperties\\` only accepts objects, annotations, decorations, ranges or selections, but you passed it: ${a}`\n )\n }\n\n /**\n * Create a `Range` from a JSON `object`.\n *\n * @param {Object} object\n * @return {Range}\n */\n\n static fromJSON(object) {\n const { anchor, focus } = object\n const range = new Range({\n anchor: Point.fromJSON(anchor || {}),\n focus: Point.fromJSON(focus || {}),\n })\n\n return range\n }\n\n /**\n * Check if a `value` is a `Range`, or is range-like.\n *\n * @param {Any} value\n * @return {Boolean}\n */\n\n static isRange(value) {\n return (\n isObject('range', value) ||\n Decoration.isDecoration(value) ||\n Selection.isSelection(value)\n )\n }\n\n /**\n * Return a JSON representation of the range.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const object = {\n object: this.object,\n anchor: this.anchor.toJSON(options),\n focus: this.focus.toJSON(options),\n }\n\n return object\n }\n}\n\n/**\n * Export.\n *\n * @type {Range}\n */\n\nexport default Range\n","import isPlainObject from 'is-plain-object'\nimport { Map, Record } from 'immutable'\n\nimport Point from './point'\nimport Range from './range'\nimport Data from './data'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n key: undefined,\n type: undefined,\n data: undefined,\n anchor: undefined,\n focus: undefined,\n}\n\n/**\n * Annotation.\n *\n * @type {Annotation}\n */\n\nclass Annotation extends Record(DEFAULTS) {\n /**\n * Create a new `Annotation` with `attrs`.\n *\n * @param {Object|Annotation} attrs\n * @return {Annotation}\n */\n\n static create(attrs = {}) {\n if (Annotation.isAnnotation(attrs)) {\n return attrs\n }\n\n if (Range.isRange(attrs)) {\n return Annotation.fromJSON(Range.createProperties(attrs))\n }\n\n if (isPlainObject(attrs)) {\n return Annotation.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Annotation.create\\` only accepts objects or annotations, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a map of annotations from `elements`.\n *\n * @param {Object|Map} elements\n * @return {Map}\n */\n\n static createMap(elements = []) {\n if (Map.isMap(elements)) {\n return elements\n }\n\n if (isPlainObject(elements)) {\n const obj = {}\n\n for (const key in elements) {\n const value = elements[key]\n const annotation = Annotation.create(value)\n obj[key] = annotation\n }\n\n return Map(obj)\n }\n\n throw new Error(\n `\\`Annotation.createMap\\` only accepts arrays or lists, but you passed it: ${elements}`\n )\n }\n\n /**\n * Create a dictionary of settable annotation properties from `attrs`.\n *\n * @param {Object|String|Annotation} attrs\n * @return {Object}\n */\n\n static createProperties(a = {}) {\n if (Annotation.isAnnotation(a)) {\n return {\n key: a.key,\n type: a.type,\n data: a.data,\n anchor: Point.createProperties(a.anchor),\n focus: Point.createProperties(a.focus),\n }\n }\n\n if (isPlainObject(a)) {\n const p = {}\n if ('key' in a) p.key = a.key\n if ('type' in a) p.type = a.type\n if ('data' in a) p.data = Data.create(a.data)\n if ('anchor' in a) p.anchor = Point.create(a.anchor)\n if ('focus' in a) p.focus = Point.create(a.focus)\n return p\n }\n\n throw new Error(\n `\\`Annotation.createProperties\\` only accepts objects or annotations, but you passed it: ${a}`\n )\n }\n\n /**\n * Create a `Annotation` from a JSON `object`.\n *\n * @param {Object} object\n * @return {Annotation}\n */\n\n static fromJSON(object) {\n const { key, type, data, anchor, focus } = object\n\n if (!key) {\n throw new Error(\n `Annotations must be created with a \\`key\\`, but you passed: ${JSON.stringify(\n object\n )}`\n )\n }\n\n if (!type) {\n throw new Error(\n `Annotations must be created with a \\`type\\`, but you passed: ${JSON.stringify(\n object\n )}`\n )\n }\n\n const annotation = new Annotation({\n key,\n type,\n data: Data.create(data || {}),\n anchor: Point.fromJSON(anchor || {}),\n focus: Point.fromJSON(focus || {}),\n })\n\n return annotation\n }\n\n /**\n * Set new `properties` on the annotation.\n *\n * @param {Object|Range|Selection} properties\n * @return {Range}\n */\n\n setProperties(properties) {\n properties = Annotation.createProperties(properties)\n const annotation = this.merge(properties)\n return annotation\n }\n\n /**\n * Return a JSON representation of the annotation.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const object = {\n object: this.object,\n key: this.key,\n type: this.type,\n data: this.data.toJSON(),\n anchor: this.anchor.toJSON(options),\n focus: this.focus.toJSON(options),\n }\n\n return object\n }\n}\n\n/**\n * Export.\n *\n * @type {Annotation}\n */\n\nexport default Annotation\n","import isPlainObject from 'is-plain-object'\nimport { List, Map, Record } from 'immutable'\n\nimport KeyUtils from '../utils/key-utils'\nimport Node from './node'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n data: undefined,\n key: undefined,\n nodes: undefined,\n}\n\n/**\n * Document.\n *\n * @type {Document}\n */\n\nclass Document extends Record(DEFAULTS) {\n /**\n * Create a new `Document` with `attrs`.\n *\n * @param {Object|Array|List|Text} attrs\n * @return {Document}\n */\n\n static create(attrs = {}) {\n if (Document.isDocument(attrs)) {\n return attrs\n }\n\n if (List.isList(attrs) || Array.isArray(attrs)) {\n attrs = { nodes: attrs }\n }\n\n if (isPlainObject(attrs)) {\n return Document.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Document.create\\` only accepts objects, arrays, lists or documents, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `Document` from a JSON `object`.\n *\n * @param {Object|Document} object\n * @return {Document}\n */\n\n static fromJSON(object) {\n if (Document.isDocument(object)) {\n return object\n }\n\n const { data = {}, key = KeyUtils.create(), nodes = [] } = object\n\n const document = new Document({\n key,\n data: new Map(data),\n nodes: Node.createList(nodes),\n })\n\n return document\n }\n\n /**\n * Return a JSON representation of the document.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const object = {\n object: this.object,\n data: this.data.toJSON(),\n nodes: this.nodes.toArray().map(n => n.toJSON(options)),\n }\n\n if (options.preserveKeys) {\n object.key = this.key\n }\n\n return object\n }\n}\n\n/**\n * Export.\n *\n * @type {Document}\n */\n\nexport default Document\n","import isPlainObject from 'is-plain-object'\nimport { List, Map, Record } from 'immutable'\n\nimport KeyUtils from '../utils/key-utils'\nimport Node from './node'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n data: undefined,\n key: undefined,\n nodes: undefined,\n type: undefined,\n}\n\n/**\n * Inline.\n *\n * @type {Inline}\n */\n\nclass Inline extends Record(DEFAULTS) {\n /**\n * Create a new `Inline` with `attrs`.\n *\n * @param {Object|String|Inline} attrs\n * @return {Inline}\n */\n\n static create(attrs = {}) {\n if (Inline.isInline(attrs)) {\n return attrs\n }\n\n if (typeof attrs === 'string') {\n attrs = { type: attrs }\n }\n\n if (isPlainObject(attrs)) {\n return Inline.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Inline.create\\` only accepts objects, strings or inlines, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a list of `Inlines` from an array.\n *\n * @param {Array|List} elements\n * @return {List}\n */\n\n static createList(elements = []) {\n if (List.isList(elements) || Array.isArray(elements)) {\n const list = new List(elements.map(Inline.create))\n return list\n }\n\n throw new Error(\n `\\`Inline.createList\\` only accepts arrays or lists, but you passed it: ${elements}`\n )\n }\n\n /**\n * Create a `Inline` from a JSON `object`.\n *\n * @param {Object|Inline} object\n * @return {Inline}\n */\n\n static fromJSON(object) {\n if (Inline.isInline(object)) {\n return object\n }\n\n const { data = {}, key = KeyUtils.create(), nodes = [], type } = object\n\n if (typeof type !== 'string') {\n throw new Error('`Inline.fromJS` requires a `type` string.')\n }\n\n const inline = new Inline({\n key,\n type,\n data: new Map(data),\n nodes: Node.createList(nodes),\n })\n\n return inline\n }\n\n /**\n * Check if `any` is a list of inlines.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isInlineList(any) {\n return List.isList(any) && any.every(item => Inline.isInline(item))\n }\n\n /**\n * Return a JSON representation of the inline.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const object = {\n object: this.object,\n type: this.type,\n data: this.data.toJSON(),\n nodes: this.nodes.toArray().map(n => n.toJSON(options)),\n }\n\n if (options.preserveKeys) {\n object.key = this.key\n }\n\n return object\n }\n}\n\n/**\n * Export.\n *\n * @type {Inline}\n */\n\nexport default Inline\n","import isPlainObject from 'is-plain-object'\nimport invariant from 'tiny-invariant'\nimport { List, Record } from 'immutable'\n\nimport Mark from './mark'\nimport KeyUtils from '../utils/key-utils'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n key: undefined,\n marks: undefined,\n text: undefined,\n}\n\nconst Leaf = Record({\n text: undefined,\n marks: undefined,\n annotations: undefined,\n decorations: undefined,\n})\n\n/**\n * Text.\n *\n * @type {Text}\n */\n\nclass Text extends Record(DEFAULTS) {\n /**\n * Create a new `Text` with `attrs`.\n *\n * @param {Object|Array|List|String|Text} attrs\n * @return {Text}\n */\n\n static create(attrs = '') {\n if (Text.isText(attrs)) {\n return attrs\n }\n\n if (typeof attrs === 'string') {\n attrs = { text: attrs }\n }\n\n if (isPlainObject(attrs)) {\n return Text.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Text.create\\` only accepts objects, arrays, strings or texts, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a list of `Texts` from `elements`.\n *\n * @param {Array|List} elements\n * @return {List}\n */\n\n static createList(elements = []) {\n if (List.isList(elements) || Array.isArray(elements)) {\n const list = new List(elements.map(Text.create))\n return list\n }\n\n throw new Error(\n `\\`Text.createList\\` only accepts arrays or lists, but you passed it: ${elements}`\n )\n }\n\n /**\n * Create a `Text` from a JSON `object`.\n *\n * @param {Object|Text} object\n * @return {Text}\n */\n\n static fromJSON(object) {\n if (Text.isText(object)) {\n return object\n }\n\n invariant(\n object.leaves == null,\n 'As of slate@0.46, the `leaves` property of text nodes has been removed! Each individual leaf should be created as a text node instead.'\n )\n\n const { text = '', marks = [], key = KeyUtils.create() } = object\n const node = new Text({\n key,\n text,\n marks: Mark.createSet(marks),\n })\n\n return node\n }\n\n /**\n * Check if `any` is a list of texts.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isTextList(any) {\n return List.isList(any) && any.every(item => Text.isText(item))\n }\n\n /**\n * Add a `mark`.\n *\n * @param {Mark} mark\n * @return {Text}\n */\n\n addMark(mark) {\n mark = Mark.create(mark)\n const { marks } = this\n const next = marks.add(mark)\n const node = this.set('marks', next)\n return node\n }\n\n /**\n * Add a set of `marks`.\n *\n * @param {Set} marks\n * @return {Text}\n */\n\n addMarks(marks) {\n marks = Mark.createSet(marks)\n const node = this.set('marks', this.marks.union(marks))\n return node\n }\n\n /**\n * Get a list of uniquely-formatted leaves for the text node, given its\n * existing marks, and its current `annotations` and `decorations`.\n *\n * @param {Map} annotations\n * @param {List} decorations\n * @return {List}\n */\n\n getLeaves(annotations, decorations) {\n const { text, marks } = this\n let leaves = [{ text, marks, annotations: [], decorations: [] }]\n\n // Helper to split a leaf into two `at` an offset.\n const split = (leaf, at) => {\n return [\n {\n text: leaf.text.slice(0, at),\n marks: leaf.marks,\n annotations: [...leaf.annotations],\n decorations: [...leaf.decorations],\n },\n {\n text: leaf.text.slice(at),\n marks: leaf.marks,\n annotations: [...leaf.annotations],\n decorations: [...leaf.decorations],\n },\n ]\n }\n\n // Helper to compile the leaves for a `kind` of format.\n const compile = kind => {\n const formats =\n kind === 'annotations' ? annotations.values() : decorations\n\n for (const format of formats) {\n const { start, end } = format\n const next = []\n let o = 0\n\n for (const leaf of leaves) {\n const { length } = leaf.text\n const offset = o\n o += length\n\n // If the range encompases the entire leaf, add the format.\n if (start.offset <= offset && end.offset >= offset + length) {\n leaf[kind].push(format)\n next.push(leaf)\n continue\n }\n\n // If the range starts after the leaf, or ends before it, continue.\n if (\n start.offset > offset + length ||\n end.offset < offset ||\n (end.offset === offset && offset !== 0)\n ) {\n next.push(leaf)\n continue\n }\n\n // Otherwise we need to split the leaf, at the start, end, or both,\n // and add the format to the middle intersecting section. Do the end\n // split first since we don't need to update the offset that way.\n let middle = leaf\n let before\n let after\n\n if (end.offset < offset + length) {\n ;[middle, after] = split(middle, end.offset - offset)\n }\n\n if (start.offset > offset) {\n ;[before, middle] = split(middle, start.offset - offset)\n }\n\n middle[kind].push(format)\n\n if (before) {\n next.push(before)\n }\n\n next.push(middle)\n\n if (after) {\n next.push(after)\n }\n }\n\n leaves = next\n }\n }\n\n compile('annotations')\n compile('decorations')\n\n leaves = leaves.map(leaf => {\n return new Leaf({\n ...leaf,\n annotations: List(leaf.annotations),\n decorations: List(leaf.decorations),\n })\n })\n\n const list = List(leaves)\n return list\n }\n\n /**\n * Insert `text` at `index`.\n *\n * @param {Number} index\n * @param {String} string\n * @return {Text}\n */\n\n insertText(index, string) {\n const { text } = this\n const next = text.slice(0, index) + string + text.slice(index)\n const node = this.set('text', next)\n return node\n }\n\n /**\n * Remove a `mark`.\n *\n * @param {Mark} mark\n * @return {Text}\n */\n\n removeMark(mark) {\n mark = Mark.create(mark)\n const { marks } = this\n const next = marks.remove(mark)\n const node = this.set('marks', next)\n return node\n }\n\n /**\n * Remove text from the text node at `index` for `length`.\n *\n * @param {Number} index\n * @param {Number} length\n * @return {Text}\n */\n\n removeText(index, length) {\n const { text } = this\n const next = text.slice(0, index) + text.slice(index + length)\n const node = this.set('text', next)\n return node\n }\n\n /**\n * Return a JSON representation of the text.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const object = {\n object: this.object,\n text: this.text,\n marks: this.marks.toArray().map(m => m.toJSON()),\n }\n\n if (options.preserveKeys) {\n object.key = this.key\n }\n\n return object\n }\n\n /**\n * Set a `newProperties` on an existing `mark`.\n *\n * @param {Object} mark\n * @param {Object} newProperties\n * @return {Text}\n */\n\n setMark(properties, newProperties) {\n const { marks } = this\n const mark = Mark.create(properties)\n const newMark = mark.merge(newProperties)\n const next = marks.remove(mark).add(newMark)\n const node = this.set('marks', next)\n return node\n }\n\n /**\n * Split the node into two at `index`.\n *\n * @param {Number} index\n * @returns {Array}\n */\n\n splitText(index) {\n const { text } = this\n const one = this.set('text', text.slice(0, index))\n const two = this.set('text', text.slice(index)).regenerateKey()\n return [one, two]\n }\n\n /**\n * Merge the node with an `other` text node.\n *\n * @param {Text} other\n * @returns {Text}\n */\n\n mergeText(other) {\n const next = this.text + other.text\n const node = this.set('text', next)\n return node\n }\n}\n\n/**\n * Export.\n *\n * @type {Text}\n */\n\nexport default Text\n","import isPlainObject from 'is-plain-object'\nimport warning from 'tiny-warning'\nimport { List } from 'immutable'\n\nimport Block from './block'\nimport Data from './data'\nimport Document from './document'\nimport Inline from './inline'\nimport Text from './text'\n\n/**\n * A pseudo-model that is used for its static methods only.\n *\n * @type {Node}\n */\n\nclass Node {\n /**\n * Create a new `Node` with `attrs`.\n *\n * @param {Object|Node} attrs\n * @return {Node}\n */\n\n static create(attrs = {}) {\n if (Node.isNode(attrs)) {\n return attrs\n }\n\n if (isPlainObject(attrs)) {\n let { object } = attrs\n\n if (!object && attrs.kind) {\n warning(\n false,\n 'As of slate@0.32.0, the `kind` property of Slate objects has been renamed to `object`.'\n )\n\n object = attrs.kind\n }\n\n switch (object) {\n case 'block':\n return Block.create(attrs)\n case 'document':\n return Document.create(attrs)\n case 'inline':\n return Inline.create(attrs)\n case 'text':\n return Text.create(attrs)\n\n default: {\n throw new Error('`Node.create` requires a `object` string.')\n }\n }\n }\n\n throw new Error(\n `\\`Node.create\\` only accepts objects or nodes but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a list of `Nodes` from an array.\n *\n * @param {Array} elements\n * @return {List}\n */\n\n static createList(elements = []) {\n if (List.isList(elements) || Array.isArray(elements)) {\n let array = []\n\n elements.forEach(el => {\n if (\n el &&\n el.object === 'text' &&\n el.leaves &&\n Array.isArray(el.leaves)\n ) {\n warning(\n false,\n 'As of slate@0.46, the `leaves` property of Text nodes has been removed. Instead, each text node contains a string of text and a unique set of marks and leaves are unnecessary.'\n )\n\n const texts = Text.createList(el.leaves).toArray()\n array = array.concat(texts)\n return\n }\n\n const node = Node.create(el)\n array.push(node)\n })\n\n const list = List(array)\n return list\n }\n\n throw new Error(\n `\\`Node.createList\\` only accepts lists or arrays, but you passed it: ${elements}`\n )\n }\n\n /**\n * Create a dictionary of settable node properties from `attrs`.\n *\n * @param {Object|String|Node} attrs\n * @return {Object}\n */\n\n static createProperties(attrs = {}) {\n if (Block.isBlock(attrs) || Inline.isInline(attrs)) {\n return {\n data: attrs.data,\n type: attrs.type,\n }\n }\n\n if (typeof attrs === 'string') {\n return { type: attrs }\n }\n\n if (isPlainObject(attrs)) {\n const props = {}\n if ('type' in attrs) props.type = attrs.type\n if ('data' in attrs) props.data = Data.create(attrs.data)\n return props\n }\n\n throw new Error(\n `\\`Node.createProperties\\` only accepts objects, strings, blocks or inlines, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `Node` from a JSON `value`.\n *\n * @param {Object} value\n * @return {Node}\n */\n\n static fromJSON(value) {\n let { object } = value\n\n if (!object && value.kind) {\n warning(\n false,\n 'As of slate@0.32.0, the `kind` property of Slate objects has been renamed to `object`.'\n )\n\n object = value.kind\n }\n\n switch (object) {\n case 'block':\n return Block.fromJSON(value)\n case 'document':\n return Document.fromJSON(value)\n case 'inline':\n return Inline.fromJSON(value)\n case 'text':\n return Text.fromJSON(value)\n\n default: {\n throw new Error(\n `\\`Node.fromJSON\\` requires an \\`object\\` of either 'block', 'document', 'inline' or 'text', but you passed: ${value}`\n )\n }\n }\n }\n\n /**\n * Check if `any` is a `Node`.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isNode(any) {\n return (\n Block.isBlock(any) ||\n Document.isDocument(any) ||\n Inline.isInline(any) ||\n Text.isText(any)\n )\n }\n\n /**\n * Check if `any` is a list of nodes.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isNodeList(any) {\n return List.isList(any) && any.every(item => Node.isNode(item))\n }\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default Node\n","import isPlainObject from 'is-plain-object'\nimport { List, Map, Record } from 'immutable'\n\nimport KeyUtils from '../utils/key-utils'\nimport Node from './node'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n data: undefined,\n key: undefined,\n nodes: undefined,\n type: undefined,\n}\n\n/**\n * Block.\n *\n * @type {Block}\n */\n\nclass Block extends Record(DEFAULTS) {\n /**\n * Create a new `Block` from `attrs`.\n *\n * @param {Object|String|Block} attrs\n * @return {Block}\n */\n\n static create(attrs = {}) {\n if (Block.isBlock(attrs)) {\n return attrs\n }\n\n if (typeof attrs === 'string') {\n attrs = { type: attrs }\n }\n\n if (isPlainObject(attrs)) {\n return Block.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Block.create\\` only accepts objects, strings or blocks, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a list of `Blocks` from `attrs`.\n *\n * @param {Array|List} attrs\n * @return {List}\n */\n\n static createList(attrs = []) {\n if (List.isList(attrs) || Array.isArray(attrs)) {\n const list = new List(attrs.map(Block.create))\n return list\n }\n\n throw new Error(\n `\\`Block.createList\\` only accepts arrays or lists, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `Block` from a JSON `object`.\n *\n * @param {Object|Block} object\n * @return {Block}\n */\n\n static fromJSON(object) {\n if (Block.isBlock(object)) {\n return object\n }\n\n const { data = {}, key = KeyUtils.create(), nodes = [], type } = object\n\n if (typeof type !== 'string') {\n throw new Error('`Block.fromJSON` requires a `type` string.')\n }\n\n const block = new Block({\n key,\n type,\n data: Map(data),\n nodes: Node.createList(nodes),\n })\n\n return block\n }\n\n /**\n * Check if `any` is a block list.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isBlockList(any) {\n return List.isList(any) && any.every(item => Block.isBlock(item))\n }\n\n /**\n * Return a JSON representation of the block.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const object = {\n object: this.object,\n type: this.type,\n data: this.data.toJSON(),\n nodes: this.nodes.toArray().map(n => n.toJSON(options)),\n }\n\n if (options.preserveKeys) {\n object.key = this.key\n }\n\n return object\n }\n}\n\n/**\n * Export.\n *\n * @type {Block}\n */\n\nexport default Block\n","import isPlainObject from 'is-plain-object'\nimport invariant from 'tiny-invariant'\nimport { Record, Set, List } from 'immutable'\n\nimport Annotation from './annotation'\nimport Data from './data'\nimport Document from './document'\nimport Mark from './mark'\nimport PathUtils from '../utils/path-utils'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n annotations: undefined,\n data: undefined,\n document: undefined,\n selection: undefined,\n}\n\n/**\n * Value.\n *\n * @type {Value}\n */\n\nclass Value extends Record(DEFAULTS) {\n /**\n * Create a new `Value` with `attrs`.\n *\n * @param {Object|Value} attrs\n * @param {Object} options\n * @return {Value}\n */\n\n static create(attrs = {}, options = {}) {\n if (Value.isValue(attrs)) {\n return attrs\n }\n\n if (isPlainObject(attrs)) {\n return Value.fromJSON(attrs, options)\n }\n\n throw new Error(\n `\\`Value.create\\` only accepts objects or values, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a dictionary of settable value properties from `attrs`.\n *\n * @param {Object|Value} attrs\n * @return {Object}\n */\n\n static createProperties(a = {}) {\n if (Value.isValue(a)) {\n return {\n annotations: a.annotations,\n data: a.data,\n }\n }\n\n if (isPlainObject(a)) {\n const p = {}\n if ('annotations' in a)\n p.annotations = Annotation.createMap(a.annotations)\n if ('data' in a) p.data = Data.create(a.data)\n return p\n }\n\n throw new Error(\n `\\`Value.createProperties\\` only accepts objects or values, but you passed it: ${a}`\n )\n }\n\n /**\n * Create a `Value` from a JSON `object`.\n *\n * @param {Object} object\n * @param {Object} options\n * @property {Boolean} normalize\n * @property {Array} plugins\n * @return {Value}\n */\n\n static fromJSON(object, options = {}) {\n let { data = {}, annotations = {}, document = {}, selection = {} } = object\n data = Data.fromJSON(data)\n document = Document.fromJSON(document)\n selection = document.createSelection(selection)\n annotations = Annotation.createMap(annotations)\n\n if (selection.isUnset) {\n const text = document.getFirstText()\n if (text) selection = selection.moveToStartOfNode(text)\n selection = document.createSelection(selection)\n }\n\n const value = new Value({\n annotations,\n data,\n document,\n selection,\n })\n\n return value\n }\n\n /**\n * Get the current start text node's closest block parent.\n *\n * @return {Block}\n */\n\n get startBlock() {\n return (\n this.selection.start.key &&\n this.document.getClosestBlock(this.selection.start.key)\n )\n }\n\n /**\n * Get the current end text node's closest block parent.\n *\n * @return {Block}\n */\n\n get endBlock() {\n return (\n this.selection.end.key &&\n this.document.getClosestBlock(this.selection.end.key)\n )\n }\n\n /**\n * Get the current anchor text node's closest block parent.\n *\n * @return {Block}\n */\n\n get anchorBlock() {\n return (\n this.selection.anchor.key &&\n this.document.getClosestBlock(this.selection.anchor.key)\n )\n }\n\n /**\n * Get the current focus text node's closest block parent.\n *\n * @return {Block}\n */\n\n get focusBlock() {\n return (\n this.selection.focus.key &&\n this.document.getClosestBlock(this.selection.focus.key)\n )\n }\n\n /**\n * Get the current start text node's closest inline parent.\n *\n * @return {Inline}\n */\n\n get startInline() {\n return (\n this.selection.start.key &&\n this.document.getClosestInline(this.selection.start.key)\n )\n }\n\n /**\n * Get the current end text node's closest inline parent.\n *\n * @return {Inline}\n */\n\n get endInline() {\n return (\n this.selection.end.key &&\n this.document.getClosestInline(this.selection.end.key)\n )\n }\n\n /**\n * Get the current anchor text node's closest inline parent.\n *\n * @return {Inline}\n */\n\n get anchorInline() {\n return (\n this.selection.anchor.key &&\n this.document.getClosestInline(this.selection.anchor.key)\n )\n }\n\n /**\n * Get the current focus text node's closest inline parent.\n *\n * @return {Inline}\n */\n\n get focusInline() {\n return (\n this.selection.focus.key &&\n this.document.getClosestInline(this.selection.focus.key)\n )\n }\n\n /**\n * Get the current start text node.\n *\n * @return {Text}\n */\n\n get startText() {\n return (\n this.selection.start.key &&\n this.document.getDescendant(this.selection.start.key)\n )\n }\n\n /**\n * Get the current end node.\n *\n * @return {Text}\n */\n\n get endText() {\n return (\n this.selection.end.key &&\n this.document.getDescendant(this.selection.end.key)\n )\n }\n\n /**\n * Get the current anchor node.\n *\n * @return {Text}\n */\n\n get anchorText() {\n return (\n this.selection.anchor.key &&\n this.document.getDescendant(this.selection.anchor.key)\n )\n }\n\n /**\n * Get the current focus node.\n *\n * @return {Text}\n */\n\n get focusText() {\n return (\n this.selection.focus.key &&\n this.document.getDescendant(this.selection.focus.key)\n )\n }\n\n /**\n * Get the next block node.\n *\n * @return {Block}\n */\n\n get nextBlock() {\n return (\n this.selection.end.key &&\n this.document.getNextBlock(this.selection.end.key)\n )\n }\n\n /**\n * Get the previous block node.\n *\n * @return {Block}\n */\n\n get previousBlock() {\n return (\n this.selection.start.key &&\n this.document.getPreviousBlock(this.selection.start.key)\n )\n }\n\n /**\n * Get the next inline node.\n *\n * @return {Inline}\n */\n\n get nextInline() {\n return (\n this.selection.end.key &&\n this.document.getNextInline(this.selection.end.key)\n )\n }\n\n /**\n * Get the previous inline node.\n *\n * @return {Inline}\n */\n\n get previousInline() {\n return (\n this.selection.start.key &&\n this.document.getPreviousInline(this.selection.start.key)\n )\n }\n\n /**\n * Get the next text node.\n *\n * @return {Text}\n */\n\n get nextText() {\n return (\n this.selection.end.key &&\n this.document.getNextText(this.selection.end.key)\n )\n }\n\n /**\n * Get the previous text node.\n *\n * @return {Text}\n */\n\n get previousText() {\n return (\n this.selection.start.key &&\n this.document.getPreviousText(this.selection.start.key)\n )\n }\n\n /**\n * Get the marks of the current selection.\n *\n * @return {Set}\n */\n\n get marks() {\n return this.selection.isUnset\n ? new Set()\n : this.selection.marks || this.document.getMarksAtRange(this.selection)\n }\n\n /**\n * Get the active marks of the current selection.\n *\n * @return {Set}\n */\n\n get activeMarks() {\n return this.selection.isUnset\n ? new Set()\n : this.selection.marks ||\n this.document.getActiveMarksAtRange(this.selection)\n }\n\n /**\n * Get the block nodes in the current selection.\n *\n * @return {List}\n */\n\n get blocks() {\n return this.selection.isUnset\n ? new List()\n : this.document.getLeafBlocksAtRange(this.selection)\n }\n\n /**\n * Get the fragment of the current selection.\n *\n * @return {Document}\n */\n\n get fragment() {\n return this.selection.isUnset\n ? Document.create()\n : this.document.getFragmentAtRange(this.selection)\n }\n\n /**\n * Get the bottom-most inline nodes in the current selection.\n *\n * @return {List}\n */\n\n get inlines() {\n return this.selection.isUnset\n ? new List()\n : this.document.getLeafInlinesAtRange(this.selection)\n }\n\n /**\n * Get the text nodes in the current selection.\n *\n * @return {List}\n */\n\n get texts() {\n return this.selection.isUnset\n ? new List()\n : this.document.getTextsAtRange(this.selection)\n }\n\n /**\n * Add an `annotation` to the value.\n *\n * @param {Annotation} annotation\n * @param {Mark} mark\n * @return {Value}\n */\n\n addAnnotation(annotation) {\n annotation = Annotation.create(annotation)\n let value = this\n let { annotations, document } = value\n const { key } = annotation\n annotation = annotation.updatePoints(point => point.normalize(document))\n annotations = annotations.set(key, annotation)\n value = value.set('annotations', annotations)\n return value\n }\n\n /**\n * Add `mark` to text at `path`.\n *\n * @param {List|String} path\n * @param {Mark} mark\n * @return {Value}\n */\n\n addMark(path, mark) {\n mark = Mark.create(mark)\n let value = this\n let { document } = value\n document = document.addMark(path, mark)\n value = value.set('document', document)\n return value\n }\n\n /**\n * Insert a `node`.\n *\n * @param {List|String} path\n * @param {Node} node\n * @return {Value}\n */\n\n insertNode(path, node) {\n let value = this\n let { document } = value\n document = document.insertNode(path, node)\n value = value.set('document', document)\n\n value = value.mapRanges(range =>\n range.updatePoints(point => point.setPath(null))\n )\n\n return value\n }\n\n /**\n * Insert `text` at `offset` in node by `path`.\n *\n * @param {List|String} path\n * @param {Number} offset\n * @param {String} text\n * @return {Value}\n */\n\n insertText(path, offset, text) {\n let value = this\n let { document } = value\n let node = document.assertNode(path)\n document = document.insertText(path, offset, text)\n node = document.assertNode(path)\n value = value.set('document', document)\n\n value = value.mapPoints(point => {\n if (point.key === node.key && point.offset >= offset) {\n return point.setOffset(point.offset + text.length)\n } else {\n return point\n }\n })\n\n return value\n }\n\n /**\n * Merge a node backwards its previous sibling.\n *\n * @param {List|Key} path\n * @return {Value}\n */\n\n mergeNode(path) {\n let value = this\n const { document } = value\n const newDocument = document.mergeNode(path)\n path = document.resolvePath(path)\n const withPath = PathUtils.decrement(path)\n const one = document.getNode(withPath)\n const two = document.getNode(path)\n value = value.set('document', newDocument)\n\n value = value.mapRanges(range => {\n if (two.object === 'text') {\n const max = one.text.length\n\n if (range.anchor.key === two.key) {\n range = range.moveAnchorTo(one.key, max + range.anchor.offset)\n }\n\n if (range.focus.key === two.key) {\n range = range.moveFocusTo(one.key, max + range.focus.offset)\n }\n }\n\n range = range.updatePoints(point => point.setPath(null))\n\n return range\n })\n\n return value\n }\n\n /**\n * Move a node by `path` to `newPath`.\n *\n * A `newIndex` can be provided when move nodes by `key`, to account for not\n * being able to have a key for a location in the tree that doesn't exist yet.\n *\n * @param {List|Key} path\n * @param {List|Key} newPath\n * @param {Number} newIndex\n * @return {Value}\n */\n\n moveNode(path, newPath, newIndex = 0) {\n let value = this\n let { document } = value\n\n if (PathUtils.isEqual(path, newPath)) {\n return value\n }\n\n document = document.moveNode(path, newPath, newIndex)\n value = value.set('document', document)\n value = value.mapPoints(point => point.setPath(null))\n return value\n }\n\n /**\n * Remove an `annotation` from the value.\n *\n * @param {Annotation} annotation\n * @param {Mark} mark\n * @return {Value}\n */\n\n removeAnnotation(annotation) {\n annotation = Annotation.create(annotation)\n let value = this\n let { annotations } = value\n const { key } = annotation\n annotations = annotations.delete(key)\n value = value.set('annotations', annotations)\n return value\n }\n\n /**\n * Remove `mark` at `path`.\n *\n * @param {List|String} path\n * @param {Mark} mark\n * @return {Value}\n */\n\n removeMark(path, mark) {\n mark = Mark.create(mark)\n let value = this\n let { document } = value\n document = document.removeMark(path, mark)\n value = value.set('document', document)\n return value\n }\n\n /**\n * Remove a node by `path`.\n *\n * @param {List|String} path\n * @return {Value}\n */\n\n removeNode(path) {\n let value = this\n let { document } = value\n const node = document.assertNode(path)\n const first = node.object === 'text' ? node : node.getFirstText() || node\n const last = node.object === 'text' ? node : node.getLastText() || node\n const prev = document.getPreviousText(first.key)\n const next = document.getNextText(last.key)\n\n document = document.removeNode(path)\n value = value.set('document', document)\n\n value = value.mapRanges(range => {\n const { anchor, focus } = range\n\n if (node.hasNode(anchor.key)) {\n range = prev\n ? range.moveAnchorTo(prev.key, prev.text.length)\n : next ? range.moveAnchorTo(next.key, 0) : range.unset()\n }\n\n if (node.hasNode(focus.key)) {\n range = prev\n ? range.moveFocusTo(prev.key, prev.text.length)\n : next ? range.moveFocusTo(next.key, 0) : range.unset()\n }\n\n range = range.updatePoints(point => point.setPath(null))\n\n return range\n })\n\n return value\n }\n\n /**\n * Remove `text` at `offset` in node by `path`.\n *\n * @param {List|Key} path\n * @param {Number} offset\n * @param {String} text\n * @return {Value}\n */\n\n removeText(path, offset, text) {\n let value = this\n let { document } = value\n const node = document.assertNode(path)\n document = document.removeText(path, offset, text)\n value = value.set('document', document)\n\n const { length } = text\n const start = offset\n const end = offset + length\n\n value = value.mapPoints(point => {\n if (point.key !== node.key) {\n return point\n }\n\n if (point.offset >= end) {\n return point.setOffset(point.offset - length)\n }\n\n if (point.offset > start) {\n return point.setOffset(start)\n }\n\n return point\n })\n\n return value\n }\n\n /**\n * Add an `annotation` to the value.\n *\n * @param {Annotation} annotation\n * @param {Mark} mark\n * @return {Value}\n */\n\n setAnnotation(properties, newProperties) {\n newProperties = Annotation.createProperties(newProperties)\n const annotation = Annotation.create(properties)\n const next = annotation.merge(newProperties)\n let value = this\n let { annotations } = value\n const { key } = annotation\n annotations = annotations.set(key, next)\n value = value.set('annotations', annotations)\n return value\n }\n\n /**\n * Set `properties` on a node.\n *\n * @param {List|String} path\n * @param {Object} properties\n * @return {Value}\n */\n\n setNode(path, properties) {\n let value = this\n let { document } = value\n document = document.setNode(path, properties)\n value = value.set('document', document)\n return value\n }\n\n /**\n * Set `properties` on `mark` on text at `offset` and `length` in node.\n *\n * @param {List|String} path\n * @param {Mark} mark\n * @param {Object} properties\n * @return {Value}\n */\n\n setMark(path, mark, properties) {\n let value = this\n let { document } = value\n document = document.setMark(path, mark, properties)\n value = value.set('document', document)\n return value\n }\n\n /**\n * Set `properties` on the value.\n *\n * @param {Object} properties\n * @return {Value}\n */\n\n setProperties(properties) {\n let value = this\n const { document } = value\n const { data, annotations } = properties\n const props = {}\n\n if (data) {\n props.data = data\n }\n\n if (annotations) {\n props.annotations = annotations.map(a => {\n return a.isSet ? a : document.resolveAnnotation(a)\n })\n }\n\n value = value.merge(props)\n return value\n }\n\n /**\n * Set `properties` on the selection.\n *\n * @param {Value} value\n * @param {Operation} operation\n * @return {Value}\n */\n\n setSelection(properties) {\n let value = this\n let { document, selection } = value\n const next = selection.setProperties(properties)\n selection = document.resolveSelection(next)\n value = value.set('selection', selection)\n return value\n }\n\n /**\n * Split a node by `path` at `position` with optional `properties` to apply\n * to the newly split node.\n *\n * @param {List|String} path\n * @param {Number} position\n * @param {Object} properties\n * @return {Value}\n */\n\n splitNode(path, position, properties) {\n let value = this\n const { document } = value\n const newDocument = document.splitNode(path, position, properties)\n const node = document.assertNode(path)\n value = value.set('document', newDocument)\n\n value = value.mapRanges(range => {\n const next = newDocument.getNextText(node.key)\n const { anchor, focus } = range\n\n // If the anchor was after the split, move it to the next node.\n if (node.key === anchor.key && position <= anchor.offset) {\n range = range.moveAnchorTo(next.key, anchor.offset - position)\n }\n\n // If the focus was after the split, move it to the next node.\n if (node.key === focus.key && position <= focus.offset) {\n range = range.moveFocusTo(next.key, focus.offset - position)\n }\n\n range = range.updatePoints(point => point.setPath(null))\n\n return range\n })\n\n return value\n }\n\n /**\n * Map all range objects to apply adjustments with an `iterator`.\n *\n * @param {Function} iterator\n * @return {Value}\n */\n\n mapRanges(iterator) {\n let value = this\n const { document, selection, annotations } = value\n\n let sel = selection.isSet ? iterator(selection) : selection\n if (!sel) sel = selection.unset()\n if (sel !== selection) sel = document.createSelection(sel)\n value = value.set('selection', sel)\n\n let anns = annotations.map(annotation => {\n let n = annotation.isSet ? iterator(annotation) : annotation\n if (n && n !== annotation) n = document.createAnnotation(n)\n return n\n })\n\n anns = anns.filter(annotation => !!annotation)\n value = value.set('annotations', anns)\n return value\n }\n\n mapPoints(iterator) {\n return this.mapRanges(range => range.updatePoints(iterator))\n }\n\n /**\n * Return a JSON representation of the value.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const object = {\n object: this.object,\n document: this.document.toJSON(options),\n }\n\n if (options.preserveData) {\n object.data = this.data.toJSON(options)\n }\n\n if (options.preserveAnnotations) {\n object.annotations = this.annotations\n .map(a => a.toJSON(options))\n .toObject()\n }\n\n if (options.preserveSelection) {\n object.selection = this.selection.toJSON(options)\n }\n\n return object\n }\n\n /**\n * Deprecated.\n */\n\n get history() {\n invariant(\n false,\n 'As of Slate 0.42.0, the `value.history` model no longer exists, and the history is stored in `value.data` instead using plugins.'\n )\n }\n\n change() {\n invariant(\n false,\n 'As of Slate 0.42.0, value object are no longer schema-aware, and the `value.change()` method is no longer available. Use the `editor.change()` method on the new `Editor` controller instead.'\n )\n }\n}\n\n/**\n * Export.\n */\n\nexport default Value\n","import Debug from 'debug'\n\nimport Operation from '../models/operation'\n\n/**\n * Debug.\n *\n * @type {Function}\n */\n\nconst debug = Debug('slate:operation:apply')\n\n/**\n * Apply an `op` to a `value`.\n *\n * @param {Value} value\n * @param {Object|Operation} op\n * @return {Value} value\n */\n\nfunction applyOperation(value, op) {\n op = Operation.create(op)\n const { type } = op\n debug(type, op)\n\n switch (type) {\n case 'add_annotation': {\n const { annotation } = op\n const next = value.addAnnotation(annotation)\n return next\n }\n\n case 'add_mark': {\n const { path, mark } = op\n const next = value.addMark(path, mark)\n return next\n }\n\n case 'insert_node': {\n const { path, node } = op\n const next = value.insertNode(path, node)\n return next\n }\n\n case 'insert_text': {\n const { path, offset, text, marks } = op\n const next = value.insertText(path, offset, text, marks)\n return next\n }\n\n case 'merge_node': {\n const { path } = op\n const next = value.mergeNode(path)\n return next\n }\n\n case 'move_node': {\n const { path, newPath } = op\n const next = value.moveNode(path, newPath)\n return next\n }\n\n case 'remove_annotation': {\n const { annotation } = op\n const next = value.removeAnnotation(annotation)\n return next\n }\n\n case 'remove_mark': {\n const { path, mark } = op\n const next = value.removeMark(path, mark)\n return next\n }\n\n case 'remove_node': {\n const { path } = op\n const next = value.removeNode(path)\n return next\n }\n\n case 'remove_text': {\n const { path, offset, text } = op\n const next = value.removeText(path, offset, text)\n return next\n }\n\n case 'set_annotation': {\n const { properties, newProperties } = op\n const next = value.setAnnotation(properties, newProperties)\n return next\n }\n\n case 'set_mark': {\n const { path, properties, newProperties } = op\n const next = value.setMark(path, properties, newProperties)\n return next\n }\n\n case 'set_node': {\n const { path, newProperties } = op\n const next = value.setNode(path, newProperties)\n return next\n }\n\n case 'set_selection': {\n const { newProperties } = op\n const next = value.setSelection(newProperties)\n return next\n }\n\n case 'set_value': {\n const { newProperties } = op\n const next = value.setProperties(newProperties)\n return next\n }\n\n case 'split_node': {\n const { path, position, properties } = op\n const next = value.splitNode(path, position, properties)\n return next\n }\n\n default: {\n throw new Error(`Unknown operation type: \"${type}\".`)\n }\n }\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default applyOperation\n","import Debug from 'debug'\n\nimport Operation from '../models/operation'\nimport PathUtils from '../utils/path-utils'\n\n/**\n * Debug.\n *\n * @type {Function}\n */\n\nconst debug = Debug('slate:operation:invert')\n\n/**\n * Invert an `op`.\n *\n * @param {Object} op\n * @return {Object}\n */\n\nfunction invertOperation(op) {\n op = Operation.create(op)\n const { type } = op\n debug(type, op)\n\n switch (type) {\n case 'move_node': {\n const { newPath, path } = op\n\n // PERF: this case can exit early.\n if (PathUtils.isEqual(newPath, path)) {\n return op\n }\n\n const inversePath = PathUtils.transform(path, op).first()\n\n // Get the true path we are trying to move back to\n // We transform the right-sibling of the path\n // This will end up at the operation.path most of the time\n // But if the newPath is a left-sibling or left-ancestor-sibling, this will account for it\n const inverseNewPath = PathUtils.transform(\n PathUtils.increment(path),\n op\n ).first()\n\n const inverse = op.set('path', inversePath).set('newPath', inverseNewPath)\n return inverse\n }\n\n case 'merge_node': {\n const { path } = op\n const inversePath = PathUtils.decrement(path)\n const inverse = op.set('type', 'split_node').set('path', inversePath)\n return inverse\n }\n\n case 'split_node': {\n const { path } = op\n const inversePath = PathUtils.increment(path)\n const inverse = op.set('type', 'merge_node').set('path', inversePath)\n return inverse\n }\n\n case 'set_annotation':\n case 'set_node':\n case 'set_value':\n case 'set_selection':\n case 'set_mark': {\n const { properties, newProperties } = op\n const inverse = op\n .set('properties', newProperties)\n .set('newProperties', properties)\n return inverse\n }\n\n case 'insert_node':\n case 'insert_text': {\n const inverse = op.set('type', type.replace('insert_', 'remove_'))\n return inverse\n }\n\n case 'remove_node':\n case 'remove_text': {\n const inverse = op.set('type', type.replace('remove_', 'insert_'))\n return inverse\n }\n\n case 'add_annotation':\n case 'add_mark': {\n const inverse = op.set('type', type.replace('add_', 'remove_'))\n return inverse\n }\n\n case 'remove_annotation':\n case 'remove_mark': {\n const inverse = op.set('type', type.replace('remove_', 'add_'))\n return inverse\n }\n\n default: {\n throw new Error(`Unknown operation type: \"${type}\".`)\n }\n }\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default invertOperation\n","import isPlainObject from 'is-plain-object'\nimport { List, Record, Map } from 'immutable'\n\nimport Annotation from './annotation'\nimport Mark from './mark'\nimport Node from './node'\nimport PathUtils from '../utils/path-utils'\nimport Selection from './selection'\nimport Value from './value'\nimport apply from '../operations/apply'\nimport invert from '../operations/invert'\n\n/**\n * Operation attributes.\n *\n * @type {Array}\n */\n\nconst OPERATION_ATTRIBUTES = {\n add_mark: ['path', 'mark', 'data'],\n add_annotation: ['annotation', 'data'],\n insert_node: ['path', 'node', 'data'],\n insert_text: ['path', 'offset', 'text', 'data'],\n merge_node: ['path', 'position', 'properties', 'target', 'data'],\n move_node: ['path', 'newPath', 'data'],\n remove_annotation: ['annotation', 'data'],\n remove_mark: ['path', 'mark', 'data'],\n remove_node: ['path', 'node', 'data'],\n remove_text: ['path', 'offset', 'text', 'data'],\n set_annotation: ['properties', 'newProperties', 'data'],\n set_mark: ['path', 'properties', 'newProperties', 'data'],\n set_node: ['path', 'properties', 'newProperties', 'data'],\n set_selection: ['properties', 'newProperties', 'data'],\n set_value: ['properties', 'newProperties', 'data'],\n split_node: ['path', 'position', 'properties', 'target', 'data'],\n}\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n annotation: undefined,\n data: undefined,\n length: undefined,\n mark: undefined,\n marks: undefined,\n newPath: undefined,\n newProperties: undefined,\n node: undefined,\n offset: undefined,\n path: undefined,\n position: undefined,\n properties: undefined,\n target: undefined,\n text: undefined,\n type: undefined,\n}\n\n/**\n * Operation.\n *\n * @type {Operation}\n */\n\nclass Operation extends Record(DEFAULTS) {\n /**\n * Create a new `Operation` with `attrs`.\n *\n * @param {Object|Array|List|String|Operation} attrs\n * @return {Operation}\n */\n\n static create(attrs = {}) {\n if (Operation.isOperation(attrs)) {\n return attrs\n }\n\n if (isPlainObject(attrs)) {\n return Operation.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Operation.create\\` only accepts objects or operations, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a list of `Operations` from `elements`.\n *\n * @param {Array|List} elements\n * @return {List}\n */\n\n static createList(elements = []) {\n if (List.isList(elements) || Array.isArray(elements)) {\n const list = new List(elements.map(Operation.create))\n return list\n }\n\n throw new Error(\n `\\`Operation.createList\\` only accepts arrays or lists, but you passed it: ${elements}`\n )\n }\n\n /**\n * Create a `Operation` from a JSON `object`.\n *\n * @param {Object|Operation} object\n * @return {Operation}\n */\n\n static fromJSON(object) {\n if (Operation.isOperation(object)) {\n return object\n }\n\n const { type } = object\n const ATTRIBUTES = OPERATION_ATTRIBUTES[type]\n const attrs = { type }\n\n if (!ATTRIBUTES) {\n throw new Error(\n `\\`Operation.fromJSON\\` was passed an unrecognized operation type: \"${type}\"`\n )\n }\n\n for (const key of ATTRIBUTES) {\n let v = object[key]\n\n // Default `data` to an empty object.\n if (key === 'data' && v === undefined) {\n v = {}\n }\n\n if (v === undefined) {\n throw new Error(\n `\\`Operation.fromJSON\\` was passed a \"${type}\" operation without the required \"${key}\" attribute.`\n )\n }\n\n if (key === 'annotation') {\n v = Annotation.create(v)\n }\n\n if (key === 'path' || key === 'newPath') {\n v = PathUtils.create(v)\n }\n\n if (key === 'mark') {\n v = Mark.create(v)\n }\n\n if (key === 'node') {\n v = Node.create(v)\n }\n\n if (\n (key === 'properties' || key === 'newProperties') &&\n type === 'set_annotation'\n ) {\n v = Annotation.createProperties(v)\n }\n\n if (\n (key === 'properties' || key === 'newProperties') &&\n type === 'set_mark'\n ) {\n v = Mark.createProperties(v)\n }\n\n if (\n (key === 'properties' || key === 'newProperties') &&\n (type === 'set_node' || type === 'merge_node' || type === 'split_node')\n ) {\n v = Node.createProperties(v)\n }\n\n if (\n (key === 'properties' || key === 'newProperties') &&\n type === 'set_selection'\n ) {\n v = Selection.createProperties(v)\n }\n\n if (\n (key === 'properties' || key === 'newProperties') &&\n type === 'set_value'\n ) {\n v = Value.createProperties(v)\n }\n\n if (key === 'data') {\n v = Map(v)\n }\n\n attrs[key] = v\n }\n\n const op = new Operation(attrs)\n return op\n }\n\n /**\n * Check if `any` is a list of operations.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isOperationList(any) {\n return List.isList(any) && any.every(item => Operation.isOperation(item))\n }\n\n /**\n * Apply the operation to a `value`.\n *\n * @param {Value} value\n * @return {Value}\n */\n\n apply(value) {\n const next = apply(value, this)\n return next\n }\n\n /**\n * Invert the operation.\n *\n * @return {Operation}\n */\n\n invert() {\n const inverted = invert(this)\n return inverted\n }\n\n /**\n * Return a JSON representation of the operation.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const { object, type } = this\n const json = { object, type }\n const ATTRIBUTES = OPERATION_ATTRIBUTES[type]\n\n for (const key of ATTRIBUTES) {\n let value = this[key]\n\n if (\n key === 'annotation' ||\n key === 'mark' ||\n key === 'marks' ||\n key === 'node' ||\n key === 'path' ||\n key === 'newPath'\n ) {\n value = value.toJSON()\n }\n\n if (key === 'properties' && type === 'merge_node') {\n const v = {}\n if ('data' in value) v.data = value.data.toJS()\n if ('type' in value) v.type = value.type\n value = v\n }\n\n if (\n (key === 'properties' || key === 'newProperties') &&\n type === 'set_annotation'\n ) {\n const v = {}\n if ('anchor' in value) v.anchor = value.anchor.toJS()\n if ('focus' in value) v.focus = value.focus.toJS()\n if ('key' in value) v.key = value.key\n if ('data' in value) v.data = value.data.toJS()\n if ('type' in value) v.type = value.type\n value = v\n }\n\n if (\n (key === 'properties' || key === 'newProperties') &&\n type === 'set_mark'\n ) {\n const v = {}\n if ('data' in value) v.data = value.data.toJS()\n if ('type' in value) v.type = value.type\n value = v\n }\n\n if (\n (key === 'properties' || key === 'newProperties') &&\n type === 'set_node'\n ) {\n const v = {}\n if ('data' in value) v.data = value.data.toJS()\n if ('type' in value) v.type = value.type\n value = v\n }\n\n if (\n (key === 'properties' || key === 'newProperties') &&\n type === 'set_selection'\n ) {\n const v = {}\n if ('anchor' in value) v.anchor = value.anchor.toJSON()\n if ('focus' in value) v.focus = value.focus.toJSON()\n if ('isFocused' in value) v.isFocused = value.isFocused\n if ('marks' in value) v.marks = value.marks && value.marks.toJSON()\n value = v\n }\n\n if (\n (key === 'properties' || key === 'newProperties') &&\n type === 'set_value'\n ) {\n const v = {}\n if ('data' in value) v.data = value.data.toJS()\n value = v\n }\n\n if (key === 'properties' && type === 'split_node') {\n const v = {}\n if ('data' in value) v.data = value.data.toJS()\n if ('type' in value) v.type = value.type\n value = v\n }\n\n if (key === 'data') {\n value = value.toJSON()\n }\n\n json[key] = value\n }\n\n return json\n }\n}\n\n/**\n * Export.\n *\n * @type {Operation}\n */\n\nexport default Operation\n","import isPlainObject from 'is-plain-object'\nimport { Record } from 'immutable'\n\nimport Operation from './operation'\nimport Value from './value'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n operations: undefined,\n value: undefined,\n}\n\n/**\n * Change.\n *\n * @type {Change}\n */\n\nclass Change extends Record(DEFAULTS) {\n /**\n * Create a new `Change` with `attrs`.\n *\n * @param {Object|Change} attrs\n * @return {Change}\n */\n\n static create(attrs = {}) {\n if (Change.isChange(attrs)) {\n return attrs\n }\n\n if (isPlainObject(attrs)) {\n return Change.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Change.create\\` only accepts objects or changes, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `Change` from a JSON `object`.\n *\n * @param {Object} object\n * @return {Change}\n */\n\n static fromJSON(object) {\n const { value, operations = [] } = object\n\n const change = new Change({\n value: Value.create(value),\n operations: Operation.createList(operations),\n })\n\n return change\n }\n\n /**\n * Return a JSON representation of the change.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const object = {\n object: this.object,\n value: this.value.toJSON(options),\n operations: this.operations.toArray().map(o => o.toJSON(options)),\n }\n\n return object\n }\n}\n\n/**\n * Export.\n *\n * @type {Change}\n */\n\nexport default Change\n","/**\n * A plugin that adds a set of commands to the editor.\n *\n * @param {Object} commands\n * @return {Object}\n */\n\nfunction CommandsPlugin(commands = {}) {\n /**\n * On command, if it exists in our list of commands, call it.\n *\n * @param {Object} command\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onCommand(command, editor, next) {\n const { type, args } = command\n const fn = commands[type]\n if (!fn) return next()\n editor.command(fn, ...args)\n }\n\n /**\n * On construct, register all the commands.\n *\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onConstruct(editor, next) {\n for (const command in commands) {\n editor.registerCommand(command)\n }\n\n return next()\n }\n\n /**\n * Return the plugin.\n *\n * @type {Object}\n */\n\n return {\n onCommand,\n onConstruct,\n }\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default CommandsPlugin\n","import { reverse } from 'esrever'\n\n/**\n * Surrogate pair start and end points.\n *\n * @type {Number}\n */\n\nconst SURROGATE_START = 0xd800\nconst SURROGATE_END = 0xdfff\n\n/**\n * A regex to match space characters.\n *\n * @type {RegExp}\n */\n\nconst SPACE = /\\s/\n\n/**\n * A regex to match chameleon characters, that count as word characters as long\n * as they are inside of a word.\n *\n * @type {RegExp}\n */\n\nconst CHAMELEON = /['\\u2018\\u2019]/\n\n/**\n * A regex that matches punctuation.\n *\n * @type {RegExp}\n */\n\nconst PUNCTUATION = /[\\u0021-\\u0023\\u0025-\\u002A\\u002C-\\u002F\\u003A\\u003B\\u003F\\u0040\\u005B-\\u005D\\u005F\\u007B\\u007D\\u00A1\\u00A7\\u00AB\\u00B6\\u00B7\\u00BB\\u00BF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u0AF0\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E3B\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]/\n\n/**\n * Is a character `code` in a surrogate character.\n *\n * @param {Number} code\n * @return {Boolean}\n */\n\nfunction isSurrogate(code) {\n return SURROGATE_START <= code && code <= SURROGATE_END\n}\n\n/**\n * Does `code` form Modifier with next one.\n *\n * https://emojipedia.org/modifiers/\n *\n * @param {Number} code\n * @param {String} text\n * @param {Number} offset\n * @return {Boolean}\n */\n\nfunction isModifier(code, text, offset) {\n if (code === 0xd83c) {\n const next = text.charCodeAt(offset + 1)\n return next <= 0xdfff && next >= 0xdffb\n }\n return false\n}\n\n/**\n * Is `code` a Variation Selector.\n *\n * https://codepoints.net/variation_selectors\n *\n * @param {Number} code\n * @return {Boolean}\n */\n\nfunction isVariationSelector(code) {\n return code <= 0xfe0f && code >= 0xfe00\n}\n\n/**\n * Is `code` one of the BMP codes used in emoji sequences.\n *\n * https://emojipedia.org/emoji-zwj-sequences/\n *\n * @param {Number} code\n * @return {Boolean}\n */\n\nfunction isBMPEmoji(code) {\n // This requires tiny bit of maintanance, better ideas?\n // Fortunately it only happens if new Unicode Standard\n // is released. Fails gracefully if upkeep lags behind,\n // same way Slate previously behaved with all emojis.\n return (\n code === 0x2764 || // heart (❤)\n code === 0x2642 || // male (♂)\n code === 0x2640 || // female (♀)\n code === 0x2620 || // scull (☠)\n code === 0x2695 || // medical (⚕)\n code === 0x2708 || // plane (✈️)\n code === 0x25ef // large circle (◯)\n )\n}\n\n/**\n * Is a character a word character? Needs the `remaining` characters too.\n *\n * @param {String} char\n * @param {String|Void} remaining\n * @return {Boolean}\n */\n\nfunction isWord(char, remaining) {\n if (SPACE.test(char)) return false\n\n // If it's a chameleon character, recurse to see if the next one is or not.\n if (CHAMELEON.test(char)) {\n let next = remaining.charAt(0)\n const length = getCharLength(next)\n next = remaining.slice(0, length)\n const rest = remaining.slice(length)\n if (isWord(next, rest)) return true\n }\n\n if (PUNCTUATION.test(char)) return false\n return true\n}\n\n/**\n * Get the length of a `character`.\n *\n * @param {String} char\n * @return {Number}\n */\n\nfunction getCharLength(char) {\n return isSurrogate(char.charCodeAt(0)) ? 2 : 1\n}\n\n/**\n * Get the offset to the end of the character(s) in `text`.\n * This function is emoji aware and handles them correctly.\n *\n * @param {String} text\n * @param {Number} chars\n * @param {Boolean} forward\n * @return {Number}\n */\n\nfunction getCharOffset(text, chars, forward) {\n let offset = 0\n\n // Handle end/beginning of node: we have to return 1 in order not to\n // break cursor's jumping to next/previous node. We need to return early\n // because otherwise, ''.charCodeAt(0) returned NaN and, the default\n // handling 'latin characters' at the end of the while loop would\n // would never be reached an we returned '0' as offset.\n if (text === '') return 1\n\n // Calculate offset sum of each character\n for (let i = 0; i < chars; i++) {\n // `prev` types (better ideas?):\n // - SURR: surrogate pair\n // - MOD: modifier (technically also surrogate pair)\n // - ZWJ: zero width joiner\n // - VAR: variation selector\n // - BMP: sequenceable character from Basic Multilingual Plane\n let prev = null\n let charCode = text.charCodeAt(offset)\n\n while (charCode) {\n if (isSurrogate(charCode)) {\n const modifier = isModifier(charCode, text, offset)\n\n // Early returns are the heart of this loop where\n // we decide if previous and current codepoints\n // should form a single character (in other words:\n // how many of them should selection jump over).\n if (forward) {\n if (\n (!modifier && prev && prev !== 'ZWJ') ||\n (modifier && prev && prev !== 'SURR')\n ) {\n break\n }\n } else if (prev === 'SURR' || prev === 'BMP') {\n break\n }\n\n offset += 2\n prev = modifier ? 'MOD' : 'SURR'\n charCode = text.charCodeAt(offset)\n // It's okay to `continue` without checking\n // because if `charCode` is NaN (which is\n // the case when out of `text` range), next\n // `while` loop won't execute and we're done.\n continue\n }\n\n // If zero width joiner\n if (charCode === 0x200d) {\n offset += 1\n prev = 'ZWJ'\n charCode = text.charCodeAt(offset)\n continue\n }\n\n if (isBMPEmoji(charCode)) {\n if (\n (forward && prev === 'VAR') ||\n (prev && prev !== 'ZWJ' && prev !== 'VAR')\n ) {\n break\n }\n\n offset += 1\n prev = 'BMP'\n charCode = text.charCodeAt(offset)\n continue\n }\n\n if (isVariationSelector(charCode)) {\n if (!forward && prev && prev !== 'ZWJ') {\n break\n }\n\n offset += 1\n prev = 'VAR'\n charCode = text.charCodeAt(offset)\n continue\n }\n\n // Modifier \"fuses\" with what ever character is before that\n // (even whitespace), need to look ahead if loop gets here.\n if (forward) {\n const nextCharCode = text.charCodeAt(offset + 1)\n\n if (isModifier(nextCharCode, text, offset + 1)) {\n offset += 3\n prev = 'MOD'\n charCode = text.charCodeAt(offset)\n continue\n }\n } else if (prev === 'MOD') {\n offset += 1\n break\n }\n\n // If while loop ever gets here, we're\n // done (e.g Latin characters, length 1).\n if (prev === null) offset += 1\n break\n }\n }\n\n return offset\n}\n\n/**\n * Get the offset to the end of character(s) before an `offset` in `text`.\n *\n * @param {String} text\n * @param {Number} offset\n * @param {Number} chars\n * @return {Number}\n */\n\nfunction getCharOffsetBackward(text, offset, chars = 1) {\n text = text.slice(0, offset)\n text = reverse(text)\n return getCharOffset(text, chars)\n}\n\n/**\n * Get the offset to the end of character(s) after an `offset` in `text`.\n *\n * @param {String} text\n * @param {Number} offset\n * @param {Number} chars\n * @return {Number}\n */\n\nfunction getCharOffsetForward(text, offset, chars = 1) {\n text = text.slice(offset)\n return getCharOffset(text, chars, true)\n}\n\n/**\n * Get the offset to the end of the first word in `text`.\n *\n * @param {String} text\n * @return {Number}\n */\n\nfunction getWordOffset(text) {\n let length = 0\n let i = 0\n let started = false\n let char\n\n while ((char = text.charAt(i))) {\n const l = getCharLength(char)\n char = text.slice(i, i + l)\n const rest = text.slice(i + l)\n\n if (isWord(char, rest)) {\n started = true\n length += l\n } else if (!started) {\n length += l\n } else {\n break\n }\n\n i += l\n }\n\n return length\n}\n\n/**\n * Get the offset to the end of the word before an `offset` in `text`.\n *\n * @param {String} text\n * @param {Number} offset\n * @return {Number}\n */\n\nfunction getWordOffsetBackward(text, offset) {\n text = text.slice(0, offset)\n text = reverse(text)\n const o = getWordOffset(text)\n return o\n}\n\n/**\n * Get the offset to the end of the word after an `offset` in `text`.\n *\n * @param {String} text\n * @param {Number} offset\n * @return {Number}\n */\n\nfunction getWordOffsetForward(text, offset) {\n text = text.slice(offset)\n const o = getWordOffset(text)\n return o\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default {\n getCharLength,\n getCharOffset,\n getCharOffsetBackward,\n getCharOffsetForward,\n getWordOffset,\n getWordOffsetBackward,\n getWordOffsetForward,\n isSurrogate,\n isWord,\n}\n","import { List } from 'immutable'\nimport Block from '../models/block'\nimport Inline from '../models/inline'\nimport Mark from '../models/mark'\nimport Node from '../models/node'\nimport TextUtils from '../utils/text-utils'\n\n/**\n * Ensure that an expanded selection is deleted first, and return the updated\n * range to account for the deleted part.\n *\n * @param {Editor}\n */\n\nfunction deleteExpandedAtRange(editor, range) {\n if (range.isExpanded) {\n editor.deleteAtRange(range)\n }\n\n const { value } = editor\n const { document } = value\n const { start, end } = range\n\n if (document.hasDescendant(start.path)) {\n range = range.moveToStart()\n } else {\n range = range.moveTo(end.path, 0).normalize(document)\n }\n\n return range\n}\n\n/**\n * Commands.\n *\n * @type {Object}\n */\n\nconst Commands = {}\n\n/**\n * Add a new `mark` to the characters at `range`.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {Mixed} mark\n */\n\nCommands.addMarkAtRange = (editor, range, mark) => {\n if (range.isCollapsed) return\n\n const { value } = editor\n const { document } = value\n const { start, end } = range\n const texts = document.getTextsAtRange(range)\n\n editor.withoutNormalizing(() => {\n texts.forEach(node => {\n const { key } = node\n let index = 0\n let length = node.text.length\n\n if (key === start.key) index = start.offset\n if (key === end.key) length = end.offset\n if (key === start.key && key === end.key)\n length = end.offset - start.offset\n\n editor.addMarkByKey(key, index, length, mark)\n })\n })\n}\n\n/**\n * Add a list of `marks` to the characters at `range`.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {Array} mark\n */\n\nCommands.addMarksAtRange = (editor, range, marks) => {\n marks.forEach(mark => editor.addMarkAtRange(range, mark))\n}\n\n/**\n * Delete everything in a `range`.\n *\n * @param {Editor} editor\n * @param {Range} range\n */\n\nCommands.deleteAtRange = (editor, range) => {\n // Snapshot the selection, which creates an extra undo save point, so that\n // when you undo a delete, the expanded selection will be retained.\n editor.snapshotSelection()\n\n const { value } = editor\n const { start, end } = range\n let startKey = start.key\n let startOffset = start.offset\n let endKey = end.key\n let endOffset = end.offset\n let { document } = value\n let isStartVoid = document.hasVoidParent(startKey, editor)\n let isEndVoid = document.hasVoidParent(endKey, editor)\n let startBlock = document.getClosestBlock(startKey)\n let endBlock = document.getClosestBlock(endKey)\n\n // Check if we have a \"hanging\" selection case where the even though the\n // selection extends into the start of the end node, we actually want to\n // ignore that for UX reasons.\n const isHanging =\n startOffset === 0 &&\n endOffset === 0 &&\n isStartVoid === false &&\n startKey === startBlock.getFirstText().key &&\n endKey === endBlock.getFirstText().key &&\n startKey !== endKey\n\n // If it's a hanging selection, nudge it back to end in the previous text.\n if (isHanging && isEndVoid) {\n const prevText = document.getPreviousText(endKey)\n endKey = prevText.key\n endOffset = prevText.text.length\n isEndVoid = document.hasVoidParent(endKey, editor)\n }\n\n editor.withoutNormalizing(() => {\n // If the start node is inside a void node, remove the void node and update\n // the starting point to be right after it, continuously until the start point\n // is not a void, or until the entire range is handled.\n while (isStartVoid) {\n const startVoid = document.getClosestVoid(startKey, editor)\n const nextText = document.getNextText(startKey)\n editor.removeNodeByKey(startVoid.key)\n\n // If the start and end keys are the same, we're done.\n if (startKey === endKey) return\n\n // If there is no next text node, we're done.\n if (!nextText) return\n\n // Continue...\n document = editor.value.document\n startKey = nextText.key\n startOffset = 0\n isStartVoid = document.hasVoidParent(startKey, editor)\n }\n\n // If the end node is inside a void node, do the same thing but backwards. But\n // we don't need any aborting checks because if we've gotten this far there\n // must be a non-void node that will exit the loop.\n while (isEndVoid) {\n const endVoid = document.getClosestVoid(endKey, editor)\n const prevText = document.getPreviousText(endKey)\n editor.removeNodeByKey(endVoid.key)\n\n // Continue...\n document = editor.value.document\n endKey = prevText.key\n endOffset = prevText.text.length\n isEndVoid = document.hasVoidParent(endKey, editor)\n }\n\n // If the start and end key are the same, and it was a hanging selection, we\n // can just remove the entire block.\n if (startKey === endKey && isHanging) {\n editor.removeNodeByKey(startBlock.key)\n return\n } else if (startKey === endKey) {\n // Otherwise, if it wasn't hanging, we're inside a single text node, so we can\n // simply remove the text in the range.\n const index = startOffset\n const length = endOffset - startOffset\n editor.removeTextByKey(startKey, index, length)\n return\n } else {\n // Otherwise, we need to recursively remove text and nodes inside the start\n // block after the start offset and inside the end block before the end\n // offset. Then remove any blocks that are in between the start and end\n // blocks. Then finally merge the start and end nodes.\n startBlock = document.getClosestBlock(startKey)\n endBlock = document.getClosestBlock(endKey)\n const startText = document.getNode(startKey)\n const endText = document.getNode(endKey)\n const startLength = startText.text.length - startOffset\n const endLength = endOffset\n\n const ancestor = document.getCommonAncestor(startKey, endKey)\n const startChild = ancestor.getFurthestChild(startKey)\n const endChild = ancestor.getFurthestChild(endKey)\n\n const startParent = document.getParent(startBlock.key)\n const startParentIndex = startParent.nodes.indexOf(startBlock)\n const endParentIndex = startParent.nodes.indexOf(endBlock)\n\n let child\n\n // Iterate through all of the nodes in the tree after the start text node\n // but inside the end child, and remove them.\n child = startText\n\n while (child.key !== startChild.key) {\n const parent = document.getParent(child.key)\n const index = parent.nodes.indexOf(child)\n const afters = parent.nodes.slice(index + 1)\n\n afters.reverse().forEach(node => {\n editor.removeNodeByKey(node.key)\n })\n\n child = parent\n }\n\n // Remove all of the middle children.\n const startChildIndex = ancestor.nodes.indexOf(startChild)\n const endChildIndex = ancestor.nodes.indexOf(endChild)\n const middles = ancestor.nodes.slice(startChildIndex + 1, endChildIndex)\n\n middles.reverse().forEach(node => {\n editor.removeNodeByKey(node.key)\n })\n\n // Remove the nodes before the end text node in the tree.\n child = endText\n\n while (child.key !== endChild.key) {\n const parent = document.getParent(child.key)\n const index = parent.nodes.indexOf(child)\n const befores = parent.nodes.slice(0, index)\n\n befores.reverse().forEach(node => {\n editor.removeNodeByKey(node.key)\n })\n\n child = parent\n }\n\n // Remove any overlapping text content from the leaf text nodes.\n if (startLength !== 0) {\n editor.removeTextByKey(startKey, startOffset, startLength)\n }\n\n if (endLength !== 0) {\n editor.removeTextByKey(endKey, 0, endOffset)\n }\n\n // If the start and end blocks aren't the same, move and merge the end block\n // into the start block.\n if (startBlock.key !== endBlock.key) {\n document = editor.value.document\n let onlyChildAncestor\n\n for (const [node] of document.ancestors(endBlock.key)) {\n if (node.nodes.size > 1) {\n break\n } else {\n onlyChildAncestor = node\n }\n }\n\n // Move the end block to be right after the start block.\n if (endParentIndex !== startParentIndex + 1) {\n editor.moveNodeByKey(\n endBlock.key,\n startParent.key,\n startParentIndex + 1\n )\n }\n\n // If the selection is hanging, just remove the start block, otherwise\n // merge the end block into it.\n if (isHanging) {\n editor.removeNodeByKey(startBlock.key)\n } else {\n editor.mergeNodeByKey(endBlock.key)\n }\n\n // If nested empty blocks are left over above the end block, remove them.\n if (onlyChildAncestor) {\n editor.removeNodeByKey(onlyChildAncestor.key)\n }\n }\n }\n })\n}\n\n/**\n * Delete backward `n` characters at a `range`.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {Number} n (optional)\n */\n\nCommands.deleteBackwardAtRange = (editor, range, n = 1) => {\n if (n === 0) return\n const { value } = editor\n const { document } = value\n const { start, focus } = range\n\n // If the range is expanded, perform a regular delete instead.\n if (range.isExpanded) {\n editor.deleteAtRange(range)\n return\n }\n\n const voidParent = document.getClosestVoid(start.path, editor)\n\n // If there is a void parent, delete it.\n if (voidParent) {\n editor.removeNodeByKey(voidParent.key)\n return\n }\n\n // If the range is at the start of the document, abort.\n if (start.isAtStartOfNode(document)) {\n return\n }\n\n const block = document.getClosestBlock(start.path)\n\n // PERF: If the closest block is empty, remove it. This is just a shortcut,\n // since merging it would result in the same outcome.\n if (\n document.nodes.size !== 1 &&\n block &&\n block.text === '' &&\n block.nodes.size === 1\n ) {\n editor.removeNodeByKey(block.key)\n return\n }\n\n // If the range is at the start of the text node, we need to figure out what\n // is behind it to know how to delete...\n const text = document.getDescendant(start.path)\n\n if (start.isAtStartOfNode(text)) {\n let prev = document.getPreviousText(text.key)\n const inline = document.getClosestInline(text.key)\n\n // If the range is at the start of the inline node, and previous text node\n // is empty, take the text node before that, or \"prevBlock\" would be the\n // same node as \"block\"\n if (inline && prev.text === '') {\n prev = document.getPreviousText(prev.key)\n }\n\n const prevBlock = document.getClosestBlock(prev.key)\n const prevVoid = document.getClosestVoid(prev.key, editor)\n\n // If the previous text node has a void parent, remove it.\n if (prevVoid) {\n editor.removeNodeByKey(prevVoid.key)\n return\n }\n\n // If we're deleting by one character and the previous text node is not\n // inside the current block, we need to merge the two blocks together.\n if (n === 1 && prevBlock !== block) {\n range = range.moveAnchorTo(prev.key, prev.text.length)\n editor.deleteAtRange(range)\n return\n }\n }\n\n // If the focus offset is farther than the number of characters to delete,\n // just remove the characters backwards inside the current node.\n if (n <= focus.offset) {\n range = range.moveFocusBackward(n)\n editor.deleteAtRange(range)\n return\n }\n\n // Otherwise, we need to see how many nodes backwards to go.\n let node = text\n let offset = 0\n let traversed = focus.offset\n\n while (n > traversed) {\n node = document.getPreviousText(node.key)\n const next = traversed + node.text.length\n\n if (n <= next) {\n offset = next - n\n break\n } else {\n traversed = next\n }\n }\n\n range = range.moveAnchorTo(node.key, offset)\n editor.deleteAtRange(range)\n}\n\n/**\n * Delete backward until the character boundary at a `range`.\n *\n * @param {Editor} editor\n * @param {Range} range\n */\n\nCommands.deleteCharBackwardAtRange = (editor, range) => {\n if (range.isExpanded) {\n editor.deleteAtRange(range)\n return\n }\n\n const { value } = editor\n const { document } = value\n const { start } = range\n const startBlock = document.getClosestBlock(start.path)\n const offset = startBlock.getOffset(start.key)\n const o = offset + start.offset\n const { text } = startBlock\n const n = TextUtils.getCharOffsetBackward(text, o)\n editor.deleteBackwardAtRange(range, n)\n}\n\n/**\n * Delete forward until the character boundary at a `range`.\n *\n * @param {Editor} editor\n * @param {Range} range\n */\n\nCommands.deleteCharForwardAtRange = (editor, range) => {\n if (range.isExpanded) {\n editor.deleteAtRange(range)\n return\n }\n\n const { value } = editor\n const { document } = value\n const { start } = range\n const startBlock = document.getClosestBlock(start.path)\n const offset = startBlock.getOffset(start.key)\n const o = offset + start.offset\n const { text } = startBlock\n const n = TextUtils.getCharOffsetForward(text, o)\n editor.deleteForwardAtRange(range, n)\n}\n\n/**\n * Delete forward `n` characters at a `range`.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {Number} n (optional)\n */\n\nCommands.deleteForwardAtRange = (editor, range, n = 1) => {\n if (n === 0) return\n const { value } = editor\n const { document } = value\n const { start, focus } = range\n\n // If the range is expanded, perform a regular delete instead.\n if (range.isExpanded) {\n editor.deleteAtRange(range)\n return\n }\n\n const voidParent = document.getClosestVoid(start.path, editor)\n\n // If the node has a void parent, delete it.\n if (voidParent) {\n editor.removeNodeByKey(voidParent.key)\n return\n }\n\n const block = document.getClosestBlock(start.path)\n\n // If the closest is not void, but empty, remove it\n if (\n block &&\n !editor.isVoid(block) &&\n block.text === '' &&\n document.nodes.size !== 1\n ) {\n const nextBlock = document.getNextBlock(block.key)\n editor.removeNodeByKey(block.key)\n\n if (nextBlock && nextBlock.key) {\n editor.moveToStartOfNode(nextBlock)\n }\n\n return\n }\n\n // If the range is at the start of the document, abort.\n if (start.isAtEndOfNode(document)) {\n return\n }\n\n // If the range is at the start of the text node, we need to figure out what\n // is behind it to know how to delete...\n const text = document.getDescendant(start.path)\n\n if (start.isAtEndOfNode(text)) {\n const next = document.getNextText(text.key)\n const nextBlock = document.getClosestBlock(next.key)\n const nextVoid = document.getClosestVoid(next.key, editor)\n\n // If the next text node has a void parent, remove it.\n if (nextVoid) {\n editor.removeNodeByKey(nextVoid.key)\n return\n }\n\n // If we're deleting by one character and the previous text node is not\n // inside the current block, we need to merge the two blocks together.\n if (n === 1 && nextBlock !== block) {\n range = range.moveFocusTo(next.key, 0)\n editor.deleteAtRange(range)\n return\n }\n }\n\n // If the remaining characters to the end of the node is greater than or equal\n // to the number of characters to delete, just remove the characters forwards\n // inside the current node.\n if (n <= text.text.length - focus.offset) {\n range = range.moveFocusForward(n)\n editor.deleteAtRange(range)\n return\n }\n\n // Otherwise, we need to see how many nodes forwards to go.\n let node = text\n let offset = focus.offset\n let traversed = text.text.length - focus.offset\n\n while (n > traversed) {\n node = document.getNextText(node.key)\n const next = traversed + node.text.length\n\n if (n <= next) {\n offset = n - traversed\n break\n } else {\n traversed = next\n }\n }\n\n range = range.moveFocusTo(node.key, offset)\n editor.deleteAtRange(range)\n}\n\n/**\n * Delete backward until the line boundary at a `range`.\n *\n * @param {Editor} editor\n * @param {Range} range\n */\n\nCommands.deleteLineBackwardAtRange = (editor, range) => {\n if (range.isExpanded) {\n editor.deleteAtRange(range)\n return\n }\n\n const { value } = editor\n const { document } = value\n const { start } = range\n const startBlock = document.getClosestBlock(start.path)\n const offset = startBlock.getOffset(start.key)\n const o = offset + start.offset\n editor.deleteBackwardAtRange(range, o)\n}\n\n/**\n * Delete forward until the line boundary at a `range`.\n *\n * @param {Editor} editor\n * @param {Range} range\n */\n\nCommands.deleteLineForwardAtRange = (editor, range) => {\n if (range.isExpanded) {\n editor.deleteAtRange(range)\n return\n }\n\n const { value } = editor\n const { document } = value\n const { start } = range\n const startBlock = document.getClosestBlock(start.path)\n const offset = startBlock.getOffset(start.key)\n const o = offset + start.offset\n editor.deleteForwardAtRange(range, startBlock.text.length - o)\n}\n\n/**\n * Delete backward until the word boundary at a `range`.\n *\n * @param {Editor} editor\n * @param {Range} range\n */\n\nCommands.deleteWordBackwardAtRange = (editor, range) => {\n if (range.isExpanded) {\n editor.deleteAtRange(range)\n return\n }\n\n const { value } = editor\n const { document } = value\n const { start } = range\n const startBlock = document.getClosestBlock(start.path)\n const offset = startBlock.getOffset(start.key)\n const o = offset + start.offset\n const { text } = startBlock\n const n = o === 0 ? 1 : TextUtils.getWordOffsetBackward(text, o)\n editor.deleteBackwardAtRange(range, n)\n}\n\n/**\n * Delete forward until the word boundary at a `range`.\n *\n * @param {Editor} editor\n * @param {Range} range\n */\n\nCommands.deleteWordForwardAtRange = (editor, range) => {\n if (range.isExpanded) {\n editor.deleteAtRange(range)\n return\n }\n\n const { value } = editor\n const { document } = value\n const { start } = range\n const startBlock = document.getClosestBlock(start.path)\n const offset = startBlock.getOffset(start.key)\n const o = offset + start.offset\n const { text } = startBlock\n const wordOffset = TextUtils.getWordOffsetForward(text, o)\n const n = wordOffset === 0 ? 1 : wordOffset\n editor.deleteForwardAtRange(range, n)\n}\n\n/**\n * Insert a `block` node at `range`.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {Block|String|Object} block\n */\n\nCommands.insertBlockAtRange = (editor, range, block) => {\n range = deleteExpandedAtRange(editor, range)\n block = Block.create(block)\n\n const { value } = editor\n const { document } = value\n const { start } = range\n let startKey = start.key\n let startOffset = start.offset\n const startBlock = document.getClosestBlock(startKey)\n const startInline = document.getClosestInline(startKey)\n const parent = document.getParent(startBlock.key)\n const index = parent.nodes.indexOf(startBlock)\n const insertionMode = getInsertionMode(editor, range)\n\n if (insertionMode === 'before') {\n editor.insertNodeByKey(parent.key, index, block)\n } else if (insertionMode === 'behind') {\n editor.insertNodeByKey(parent.key, index + 1, block)\n } else {\n if (startInline && editor.isVoid(startInline)) {\n const atEnd = start.isAtEndOfNode(startInline)\n const siblingText = atEnd\n ? document.getNextText(startKey)\n : document.getPreviousText(startKey)\n\n const splitRange = atEnd\n ? range.moveToStartOfNode(siblingText)\n : range.moveToEndOfNode(siblingText)\n\n startKey = splitRange.start.key\n startOffset = splitRange.start.offset\n }\n\n editor.withoutNormalizing(() => {\n editor.splitDescendantsByKey(startBlock.key, startKey, startOffset)\n editor.insertNodeByKey(parent.key, index + 1, block)\n })\n }\n}\n\n/**\n * Check if current block should be split or new block should be added before or behind it.\n *\n * @param {Editor} editor\n * @param {Range} range\n */\n\nconst getInsertionMode = (editor, range) => {\n const { value } = editor\n const { document } = value\n const { start } = range\n const startKey = start.key\n const startBlock = document.getClosestBlock(startKey)\n const startInline = document.getClosestInline(startKey)\n\n if (editor.isVoid(startBlock)) {\n if (start.isAtEndOfNode(startBlock)) return 'behind'\n else return 'before'\n } else if (!startInline && startBlock.text === '') {\n return 'behind'\n } else if (start.isAtStartOfNode(startBlock)) {\n return 'before'\n } else if (start.isAtEndOfNode(startBlock)) {\n return 'behind'\n }\n return 'split'\n}\n\n/**\n * Insert a `fragment` at a `range`.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {Document} fragment\n */\n\nCommands.insertFragmentAtRange = (editor, range, fragment) => {\n editor.withoutNormalizing(() => {\n range = deleteExpandedAtRange(editor, range)\n\n // If the fragment is empty, there's nothing to do after deleting.\n if (!fragment.nodes.size) return\n\n // Regenerate the keys for all of the fragments nodes, so that they're\n // guaranteed not to collide with the existing keys in the document. Otherwise\n // they will be regenerated automatically and we won't have an easy way to\n // reference them.\n fragment = fragment.mapDescendants(child => child.regenerateKey())\n\n // Calculate a few things...\n const { start } = range\n const { value } = editor\n let { document } = value\n let startText = document.getDescendant(start.path)\n let startBlock = document.getClosestBlock(startText.key)\n let startChild = startBlock.getFurthestChild(startText.key)\n const isAtStart = start.isAtStartOfNode(startBlock)\n const parent = document.getParent(startBlock.key)\n const index = parent.nodes.indexOf(startBlock)\n const blocks = fragment.getBlocks()\n const firstChild = fragment.nodes.first()\n const lastChild = fragment.nodes.last()\n const firstBlock = blocks.first()\n const lastBlock = blocks.last()\n const insertionNode = findInsertionNode(fragment, document, startBlock.key)\n\n // If the fragment only contains a void block, use `insertBlock` instead.\n if (firstBlock === lastBlock && editor.isVoid(firstBlock)) {\n editor.insertBlockAtRange(range, firstBlock)\n return\n }\n\n // If inserting the entire fragment and it starts or ends with a single\n // nested block, e.g. a table, we do not merge it with existing blocks.\n if (\n insertionNode === fragment &&\n (firstChild.hasBlockChildren() || lastChild.hasBlockChildren())\n ) {\n // check if reversal is necessary or not\n const insertionMode = getInsertionMode(editor, range)\n const nodes =\n insertionMode === 'before' ? fragment.nodes : fragment.nodes.reverse()\n\n nodes.forEach(node => {\n editor.insertBlockAtRange(range, node)\n })\n return\n }\n\n // If the first and last block aren't the same, we need to insert all of the\n // nodes after the insertion node's first block at the index.\n if (firstBlock !== lastBlock) {\n const lonelyParent = insertionNode.getFurthest(\n firstBlock.key,\n p => p.nodes.size === 1\n )\n const lonelyChild = lonelyParent || firstBlock\n\n const startIndex = parent.nodes.indexOf(startBlock)\n const excludingLonelyChild = insertionNode.removeNode(lonelyChild.key)\n\n excludingLonelyChild.nodes.forEach((node, i) => {\n const newIndex = startIndex + i + 1\n editor.insertNodeByKey(parent.key, newIndex, node)\n })\n }\n\n // Check if we need to split the node.\n if (start.offset !== 0) {\n editor.splitDescendantsByKey(startChild.key, start.key, start.offset)\n }\n\n // Update our variables with the new value.\n document = editor.value.document\n startText = document.getDescendant(start.key)\n startBlock = document.getClosestBlock(start.key)\n startChild = startBlock.getFurthestChild(startText.key)\n\n // If the first and last block aren't the same, we need to move any of the\n // starting block's children after the split into the last block of the\n // fragment, which has already been inserted.\n if (firstBlock !== lastBlock) {\n const nextChild = isAtStart\n ? startChild\n : startBlock.getNextSibling(startChild.key)\n const nextNodes = nextChild\n ? startBlock.nodes.skipUntil(n => n.key === nextChild.key)\n : List()\n const lastIndex = lastBlock.nodes.size\n\n nextNodes.forEach((node, i) => {\n const newIndex = lastIndex + i\n editor.moveNodeByKey(node.key, lastBlock.key, newIndex)\n })\n }\n\n // If the starting block is empty, we replace it entirely with the first block\n // of the fragment, since this leads to a more expected behavior for the user.\n if (\n !editor.isVoid(startBlock) &&\n startBlock.text === '' &&\n !startBlock.findDescendant(n => editor.isVoid(n))\n ) {\n editor.removeNodeByKey(startBlock.key)\n editor.insertNodeByKey(parent.key, index, firstBlock)\n } else {\n // Otherwise, we maintain the starting block, and insert all of the first\n // block's inline nodes into it at the split point.\n const inlineChild = startBlock.getFurthestChild(startText.key)\n const inlineIndex = startBlock.nodes.indexOf(inlineChild)\n\n firstBlock.nodes.forEach((inline, i) => {\n const o = start.offset === 0 ? 0 : 1\n const newIndex = inlineIndex + i + o\n editor.insertNodeByKey(startBlock.key, newIndex, inline)\n })\n }\n })\n}\n\n/**\n * Get the deepest single child block inside `fragment` whose reversed block\n * ancestors match the reversed block ancestors of the `document` starting at\n * the `documentKey`.\n *\n * @param {Document} document\n * @param {string} documentKey\n * @param {Document} fragment\n * @return {Node}\n */\n\nconst findInsertionNode = (fragment, document, documentKey) => {\n // Find the deepest block in a doc with no siblings.\n const deepestSingleBlock = doc => {\n let result = doc\n\n while (result.nodes.size === 1 && result.nodes.first().object === 'block') {\n result = result.nodes.first()\n }\n\n return result === doc ? null : result\n }\n\n // Return whether every block in the `fragmentAncestors` list has the\n // same type as the block in `documentAncestors` with the same index.\n const ancestorTypesMatch = (fragmentAncestors, documentAncestors) => {\n return (\n documentAncestors.size >= fragmentAncestors.size &&\n fragmentAncestors.every((fragmentNode, i) => {\n return documentAncestors.get(i).type === fragmentNode.type\n })\n )\n }\n\n // Given two reverse lists of ancestors, check if all fragment ancestor types\n // match the doc ancestors at some position.\n const matchingFragmentAncestor = (documentAncestors, fragmentAncestors) => {\n const depthDifference = documentAncestors.size - fragmentAncestors.size\n\n // There is nothing to align if the fragment is deeper than the document.\n if (depthDifference < 0) {\n return fragment\n }\n\n for (let fragIdx = 0; fragIdx < fragmentAncestors.size; fragIdx++) {\n // The docIdx loop relaxes our check in that we can still match if there\n // are node type differences leaf-side.\n // This is important for example if our fragment inserts multiple siblings\n // or inserts another type while the tree structure remains the same.\n for (let docIdx = 0; docIdx <= depthDifference; docIdx++) {\n if (\n ancestorTypesMatch(\n fragmentAncestors.slice(fragIdx),\n documentAncestors.slice(docIdx)\n )\n ) {\n return fragmentAncestors.get(fragIdx)\n }\n }\n }\n return fragment\n }\n\n // Get the type definitions for all ancestors up from node with key `key`,\n // except the document object.\n const getAncestorBlocks = (doc, key) => {\n return doc\n .getAncestors(key)\n .slice(1)\n .push(doc.getNode(key))\n .reverse()\n }\n\n const fragmentStartBlock = deepestSingleBlock(fragment)\n\n if (!fragmentStartBlock) {\n return fragment\n }\n\n const documentAncestors = getAncestorBlocks(document, documentKey)\n const fragmentAncestors = getAncestorBlocks(fragment, fragmentStartBlock.key)\n\n return matchingFragmentAncestor(documentAncestors, fragmentAncestors)\n}\n\n/**\n * Insert an `inline` node at `range`.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {Inline|String|Object} inline\n */\n\nCommands.insertInlineAtRange = (editor, range, inline) => {\n inline = Inline.create(inline)\n\n editor.withoutNormalizing(() => {\n range = deleteExpandedAtRange(editor, range)\n\n const { value } = editor\n const { document } = value\n const { start } = range\n const parent = document.getParent(start.path)\n const startText = document.assertDescendant(start.path)\n const index = parent.nodes.indexOf(startText)\n\n if (editor.isVoid(parent)) {\n return\n }\n\n editor.splitNodeByPath(start.path, start.offset)\n editor.insertNodeByKey(parent.key, index + 1, inline)\n })\n}\n\n/**\n * Insert `text` at a `range`, with optional `marks`.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {String} text\n * @param {Set} marks (optional)\n */\n\nCommands.insertTextAtRange = (editor, range, text, marks) => {\n editor.withoutNormalizing(() => {\n range = deleteExpandedAtRange(editor, range)\n\n const { value } = editor\n const { document } = value\n const { start } = range\n const offset = start.offset\n const parent = document.getParent(start.path)\n\n if (editor.isVoid(parent)) {\n return\n }\n\n editor.insertTextByPath(start.path, offset, text, marks)\n })\n}\n\n/**\n * Remove an existing `mark` to the characters at `range`.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {Mark|String} mark (optional)\n */\n\nCommands.removeMarkAtRange = (editor, range, mark) => {\n if (range.isCollapsed) return\n\n const { value } = editor\n const { document } = value\n const texts = document.getTextsAtRange(range)\n const { start, end } = range\n\n editor.withoutNormalizing(() => {\n texts.forEach(node => {\n const { key } = node\n let index = 0\n let length = node.text.length\n\n if (key === start.key) index = start.offset\n if (key === end.key) length = end.offset\n if (key === start.key && key === end.key)\n length = end.offset - start.offset\n\n editor.removeMarkByKey(key, index, length, mark)\n })\n })\n}\n\n/**\n * Set the `properties` of block nodes in a `range`.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {Object|String} properties\n */\n\nCommands.setBlocksAtRange = (editor, range, properties) => {\n const { value } = editor\n const { document } = value\n const blocks = document.getLeafBlocksAtRange(range)\n\n const { start, end, isCollapsed } = range\n const isStartVoid = document.hasVoidParent(start.path, editor)\n const startBlock = document.getClosestBlock(start.path)\n const endBlock = document.getClosestBlock(end.key)\n\n // Check if we have a \"hanging\" selection case where the even though the\n // selection extends into the start of the end node, we actually want to\n // ignore that for UX reasons.\n const isHanging =\n isCollapsed === false &&\n start.offset === 0 &&\n end.offset === 0 &&\n isStartVoid === false &&\n start.key === startBlock.getFirstText().key &&\n end.key === endBlock.getFirstText().key\n\n // If it's a hanging selection, ignore the last block.\n const sets = isHanging ? blocks.slice(0, -1) : blocks\n\n editor.withoutNormalizing(() => {\n sets.forEach(block => {\n editor.setNodeByKey(block.key, properties)\n })\n })\n}\n\n/**\n * Set the `properties` of inline nodes in a `range`.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {Object|String} properties\n */\n\nCommands.setInlinesAtRange = (editor, range, properties) => {\n const { value } = editor\n const { document } = value\n const inlines = document.getLeafInlinesAtRange(range)\n\n editor.withoutNormalizing(() => {\n inlines.forEach(inline => {\n editor.setNodeByKey(inline.key, properties)\n })\n })\n}\n\n/**\n * Split the block nodes at a `range`, to optional `height`.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {Number} height (optional)\n */\n\nCommands.splitBlockAtRange = (editor, range, height = 1) => {\n range = deleteExpandedAtRange(editor, range)\n\n const { start, end } = range\n let { value } = editor\n let { document } = value\n let node = document.assertDescendant(start.path)\n let parent = document.getClosestBlock(node.key)\n let h = 0\n\n while (parent && parent.object === 'block' && h < height) {\n node = parent\n parent = document.getClosestBlock(parent.key)\n h++\n }\n\n editor.withoutNormalizing(() => {\n editor.splitDescendantsByKey(node.key, start.path, start.offset)\n\n value = editor.value\n document = value.document\n\n if (range.isExpanded) {\n if (range.isBackward) range = range.flip()\n const nextBlock = document.getNextBlock(node.key)\n range = range.moveAnchorToStartOfNode(nextBlock)\n range = range.setFocus(range.focus.setPath(null))\n\n if (start.path.equals(end.path)) {\n range = range.moveFocusTo(range.anchor.key, end.offset - start.offset)\n }\n\n range = document.resolveRange(range)\n editor.deleteAtRange(range)\n }\n })\n}\n\n/**\n * Split the inline nodes at a `range`, to optional `height`.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {Number} height (optional)\n */\n\nCommands.splitInlineAtRange = (editor, range, height = Infinity) => {\n range = deleteExpandedAtRange(editor, range)\n\n const { start } = range\n const { value } = editor\n const { document } = value\n let node = document.assertDescendant(start.path)\n let parent = document.getClosestInline(node.key)\n let h = 0\n\n while (parent && parent.object === 'inline' && h < height) {\n node = parent\n parent = document.getClosestInline(parent.key)\n h++\n }\n\n editor.splitDescendantsByKey(node.key, start.path, start.offset)\n}\n\n/**\n * Add or remove a `mark` from the characters at `range`, depending on whether\n * it's already there.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {Mixed} mark\n */\n\nCommands.toggleMarkAtRange = (editor, range, mark) => {\n if (range.isCollapsed) return\n\n mark = Mark.create(mark)\n\n const { value } = editor\n const { document } = value\n const marks = document.getActiveMarksAtRange(range)\n const exists = marks.some(m => m.equals(mark))\n\n if (exists) {\n editor.removeMarkAtRange(range, mark)\n } else {\n editor.addMarkAtRange(range, mark)\n }\n}\n\n/**\n * Unwrap all of the block nodes in a `range` from a block with `properties`.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {String|Object} properties\n */\n\nCommands.unwrapBlockAtRange = (editor, range, properties) => {\n properties = Node.createProperties(properties)\n\n const { value } = editor\n let { document } = value\n const blocks = document.getLeafBlocksAtRange(range)\n const wrappers = blocks\n .map(block => {\n return document.getClosest(block.key, parent => {\n if (parent.object !== 'block') return false\n if (properties.type != null && parent.type !== properties.type)\n return false\n if (properties.data != null && !parent.data.isSuperset(properties.data))\n return false\n return true\n })\n })\n .filter(exists => exists)\n .toOrderedSet()\n .toList()\n\n editor.withoutNormalizing(() => {\n wrappers.forEach(block => {\n const first = block.nodes.first()\n const last = block.nodes.last()\n const parent = editor.value.document.getParent(block.key)\n const index = parent.nodes.indexOf(block)\n\n const children = block.nodes.filter(child => {\n return blocks.some(b => child === b || child.hasDescendant(b.key))\n })\n\n const firstMatch = children.first()\n const lastMatch = children.last()\n\n if (first === firstMatch && last === lastMatch) {\n block.nodes.forEach((child, i) => {\n editor.moveNodeByKey(child.key, parent.key, index + i)\n })\n\n editor.removeNodeByKey(block.key)\n } else if (last === lastMatch) {\n block.nodes.skipUntil(n => n === firstMatch).forEach((child, i) => {\n editor.moveNodeByKey(child.key, parent.key, index + 1 + i)\n })\n } else if (first === firstMatch) {\n block.nodes\n .takeUntil(n => n === lastMatch)\n .push(lastMatch)\n .forEach((child, i) => {\n editor.moveNodeByKey(child.key, parent.key, index + i)\n })\n } else {\n const firstText = firstMatch.getFirstText()\n\n editor.splitDescendantsByKey(block.key, firstText.key, 0)\n\n document = editor.value.document\n\n children.forEach((child, i) => {\n if (i === 0) {\n const extra = child\n child = document.getNextBlock(child.key)\n editor.removeNodeByKey(extra.key)\n }\n\n editor.moveNodeByKey(child.key, parent.key, index + 1 + i)\n })\n }\n })\n })\n}\n\n/**\n * Unwrap the inline nodes in a `range` from an inline with `properties`.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {String|Object} properties\n */\n\nCommands.unwrapInlineAtRange = (editor, range, properties) => {\n properties = Node.createProperties(properties)\n\n const { value } = editor\n const { document } = value\n const texts = document.getTextsAtRange(range)\n const inlines = texts\n .map(text => {\n return document.getClosest(text.key, parent => {\n if (parent.object !== 'inline') return false\n if (properties.type != null && parent.type !== properties.type)\n return false\n if (properties.data != null && !parent.data.isSuperset(properties.data))\n return false\n return true\n })\n })\n .filter(exists => exists)\n .toOrderedSet()\n .toList()\n\n editor.withoutNormalizing(() => {\n inlines.forEach(inline => {\n const parent = editor.value.document.getParent(inline.key)\n const index = parent.nodes.indexOf(inline)\n\n inline.nodes.forEach((child, i) => {\n editor.moveNodeByKey(child.key, parent.key, index + i)\n })\n\n editor.removeNodeByKey(inline.key)\n })\n })\n}\n\n/**\n * Wrap all of the blocks in a `range` in a new `block`.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {Block|Object|String} block\n */\n\nCommands.wrapBlockAtRange = (editor, range, block) => {\n block = Block.create(block)\n block = block.set('nodes', block.nodes.clear())\n\n const { value } = editor\n const { document } = value\n\n const blocks = document.getLeafBlocksAtRange(range)\n const firstblock = blocks.first()\n const lastblock = blocks.last()\n let parent, siblings, index\n\n // If there is only one block in the selection then we know the parent and\n // siblings.\n if (blocks.length === 1) {\n parent = document.getParent(firstblock.key)\n siblings = blocks\n } else {\n // Determine closest shared parent to all blocks in selection.\n parent = document.getClosest(firstblock.key, p1 => {\n return !!document.getClosest(lastblock.key, p2 => p1 === p2)\n })\n }\n\n // If no shared parent could be found then the parent is the document.\n if (parent == null) parent = document\n\n // Create a list of direct children siblings of parent that fall in the\n // selection.\n if (siblings == null) {\n const indexes = parent.nodes.reduce((ind, node, i) => {\n if (node === firstblock || node.hasDescendant(firstblock.key)) ind[0] = i\n if (node === lastblock || node.hasDescendant(lastblock.key)) ind[1] = i\n return ind\n }, [])\n\n index = indexes[0]\n siblings = parent.nodes.slice(indexes[0], indexes[1] + 1)\n }\n\n // Get the index to place the new wrapped node at.\n if (index == null) {\n index = parent.nodes.indexOf(siblings.first())\n }\n\n editor.withoutNormalizing(() => {\n // Inject the new block node into the parent.\n editor.insertNodeByKey(parent.key, index, block)\n\n // Move the sibling nodes into the new block node.\n siblings.forEach((node, i) => {\n editor.moveNodeByKey(node.key, block.key, i)\n })\n })\n}\n\n/**\n * Wrap the text and inlines in a `range` in a new `inline`.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {Inline|Object|String} inline\n */\n\nCommands.wrapInlineAtRange = (editor, range, inline) => {\n const { value } = editor\n let { document } = value\n const { start, end } = range\n\n if (range.isCollapsed) {\n // Wrapping an inline void\n const inlineParent = document.getClosestInline(start.path)\n\n if (!inlineParent) {\n return\n }\n\n if (!editor.isVoid(inlineParent)) {\n return\n }\n\n return editor.wrapInlineByKey(inlineParent.key, inline)\n }\n\n inline = Inline.create(inline)\n inline = inline.set('nodes', inline.nodes.clear())\n\n const blocks = document.getLeafBlocksAtRange(range)\n let startBlock = document.getClosestBlock(start.path)\n let endBlock = document.getClosestBlock(end.path)\n const startInline = document.getClosestInline(start.path)\n const endInline = document.getClosestInline(end.path)\n let startChild = startBlock.getFurthestChild(start.key)\n let endChild = endBlock.getFurthestChild(end.key)\n\n editor.withoutNormalizing(() => {\n if (!startInline || startInline !== endInline) {\n editor.splitDescendantsByKey(endChild.key, end.key, end.offset)\n editor.splitDescendantsByKey(startChild.key, start.key, start.offset)\n }\n\n document = editor.value.document\n startBlock = document.getDescendant(startBlock.key)\n endBlock = document.getDescendant(endBlock.key)\n startChild = startBlock.getFurthestChild(start.key)\n endChild = endBlock.getFurthestChild(end.key)\n const startIndex = startBlock.nodes.indexOf(startChild)\n const endIndex = endBlock.nodes.indexOf(endChild)\n\n if (startInline && startInline === endInline) {\n const texts = startBlock.getTextsAtRange(range).map(text => {\n if (start.key === text.key && end.key === text.key) {\n return text\n .splitText(start.offset)[1]\n .splitText(end.offset - start.offset)[0]\n .regenerateKey()\n } else if (start.key === text.key) {\n return text.splitText(start.offset)[1].regenerateKey()\n } else if (end.key === text.key) {\n return text.splitText(end.offset)[0].regenerateKey()\n } else {\n return text.regenerateKey()\n }\n })\n\n inline = inline.set('nodes', texts)\n editor.insertInlineAtRange(range, inline)\n } else if (startBlock === endBlock) {\n document = editor.value.document\n startBlock = document.getClosestBlock(start.key)\n startChild = startBlock.getFurthestChild(start.key)\n\n const startInner = document.getNextSibling(startChild.key)\n const startInnerIndex = startBlock.nodes.indexOf(startInner)\n const endInner =\n start.key === end.key\n ? startInner\n : startBlock.getFurthestChild(end.key)\n const inlines = startBlock.nodes\n .skipUntil(n => n === startInner)\n .takeUntil(n => n === endInner)\n .push(endInner)\n\n const node = inline.regenerateKey()\n\n editor.insertNodeByKey(startBlock.key, startInnerIndex, node)\n\n inlines.forEach((child, i) => {\n editor.moveNodeByKey(child.key, node.key, i)\n })\n } else {\n const startInlines = startBlock.nodes.slice(startIndex + 1)\n const endInlines = endBlock.nodes.slice(0, endIndex + 1)\n const startNode = inline.regenerateKey()\n const endNode = inline.regenerateKey()\n\n editor.insertNodeByKey(startBlock.key, startIndex + 1, startNode)\n editor.insertNodeByKey(endBlock.key, endIndex, endNode)\n\n startInlines.forEach((child, i) => {\n editor.moveNodeByKey(child.key, startNode.key, i)\n })\n\n endInlines.forEach((child, i) => {\n editor.moveNodeByKey(child.key, endNode.key, i)\n })\n\n blocks.slice(1, -1).forEach(block => {\n const node = inline.regenerateKey()\n editor.insertNodeByKey(block.key, 0, node)\n\n block.nodes.forEach((child, i) => {\n editor.moveNodeByKey(child.key, node.key, i)\n })\n })\n }\n })\n}\n\n/**\n * Wrap the text in a `range` in a prefix/suffix.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @param {String} prefix\n * @param {String} suffix (optional)\n */\n\nCommands.wrapTextAtRange = (editor, range, prefix, suffix = prefix) => {\n const { start, end } = range\n const startRange = range.moveToStart()\n let endRange = range.moveToEnd()\n\n if (start.path.equals(end.path)) {\n endRange = endRange.moveForward(prefix.length)\n }\n\n editor.withoutNormalizing(() => {\n editor.insertTextAtRange(startRange, prefix)\n editor.insertTextAtRange(endRange, suffix)\n })\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default Commands\n","import pick from 'lodash/pick'\nimport Block from '../models/block'\nimport Inline from '../models/inline'\nimport Mark from '../models/mark'\nimport Node from '../models/node'\nimport PathUtils from '../utils/path-utils'\n\n/**\n * Commands.\n *\n * @type {Object}\n */\n\nconst Commands = {}\n\n/**\n * Add mark to text at `offset` and `length` in node by `path`.\n *\n * @param {Editor} editor\n * @param {Array} path\n * @param {Number} offset\n * @param {Number} length\n * @param {Mixed} mark\n */\n\nCommands.addMarkByPath = (editor, path, offset, length, mark) => {\n mark = Mark.create(mark)\n editor.addMarksByPath(path, offset, length, [mark])\n}\n\nCommands.addMarksByPath = (editor, path, offset, length, marks) => {\n marks = Mark.createSet(marks)\n\n if (!marks.size) {\n return\n }\n\n const { value } = editor\n const { document } = value\n const node = document.assertNode(path)\n\n editor.withoutNormalizing(() => {\n // If it ends before the end of the node, we'll need to split to create a new\n // text with different marks.\n if (offset + length < node.text.length) {\n editor.splitNodeByPath(path, offset + length)\n }\n\n // Same thing if it starts after the start. But in that case, we need to\n // update our path and offset to point to the new start.\n if (offset > 0) {\n editor.splitNodeByPath(path, offset)\n path = PathUtils.increment(path)\n offset = 0\n }\n\n marks.forEach(mark => {\n editor.applyOperation({\n type: 'add_mark',\n path,\n mark: Mark.create(mark),\n })\n })\n })\n}\n\n/**\n * Sets specific set of marks on the path\n * @param {Editor} editor\n * @param {Array} path\n * @param {Number} offset\n * @param {Number} length\n * @param {Array} marks\n */\n\nCommands.replaceMarksByPath = (editor, path, offset, length, marks) => {\n const marksSet = Mark.createSet(marks)\n\n const { value } = editor\n const { document } = value\n const node = document.assertNode(path)\n\n if (node.marks.equals(marksSet)) {\n return\n }\n\n editor.withoutNormalizing(() => {\n // If it ends before the end of the node, we'll need to split to create a new\n // text with different marks.\n if (offset + length < node.text.length) {\n editor.splitNodeByPath(path, offset + length)\n }\n\n // Same thing if it starts after the start. But in that case, we need to\n // update our path and offset to point to the new start.\n if (offset > 0) {\n editor.splitNodeByPath(path, offset)\n path = PathUtils.increment(path)\n offset = 0\n }\n\n const marksToApply = marksSet.subtract(node.marks)\n const marksToRemove = node.marks.subtract(marksSet)\n\n marksToRemove.forEach(mark => {\n editor.applyOperation({\n type: 'remove_mark',\n path,\n mark: Mark.create(mark),\n })\n })\n\n marksToApply.forEach(mark => {\n editor.applyOperation({\n type: 'add_mark',\n path,\n mark: Mark.create(mark),\n })\n })\n })\n}\n\n/**\n * Insert a `fragment` at `index` in a node by `path`.\n *\n * @param {Editor} editor\n * @param {Array} path\n * @param {Number} index\n * @param {Fragment} fragment\n */\n\nCommands.insertFragmentByPath = (editor, path, index, fragment) => {\n fragment.nodes.forEach((node, i) => {\n editor.insertNodeByPath(path, index + i, node)\n })\n}\n\n/**\n * Insert a `node` at `index` in a node by `path`.\n *\n * @param {Editor} editor\n * @param {Array} path\n * @param {Number} index\n * @param {Node} node\n */\n\nCommands.insertNodeByPath = (editor, path, index, node) => {\n editor.applyOperation({\n type: 'insert_node',\n path: path.concat(index),\n node,\n })\n}\n\n/**\n * Insert `text` at `offset` in node by `path`.\n *\n * @param {Editor} editor\n * @param {Array} path\n * @param {Number} offset\n * @param {String} text\n * @param {Set} marks (optional)\n */\n\nCommands.insertTextByPath = (editor, path, offset, text, marks) => {\n const { value } = editor\n const { annotations, document } = value\n document.assertNode(path)\n\n editor.withoutNormalizing(() => {\n for (const annotation of annotations.values()) {\n const { start, end } = annotation\n const isAtomic = editor.isAtomic(annotation)\n\n if (!isAtomic) {\n continue\n }\n\n if (!start.path.equals(path)) {\n continue\n }\n\n if (\n start.offset < offset &&\n (!end.path.equals(path) || end.offset > offset)\n ) {\n editor.removeAnnotation(annotation)\n }\n }\n\n editor.applyOperation({\n type: 'insert_text',\n path,\n offset,\n text,\n })\n\n if (marks) {\n editor.replaceMarksByPath(path, offset, text.length, marks)\n }\n })\n}\n\n/**\n * Merge a node by `path` with the previous node.\n *\n * @param {Editor} editor\n * @param {Array} path\n */\n\nCommands.mergeNodeByPath = (editor, path) => {\n const { value } = editor\n const { document } = value\n const original = document.getDescendant(path)\n const previous = document.getPreviousSibling(path)\n\n if (!previous) {\n throw new Error(\n `Unable to merge node with path \"${path}\", because it has no previous sibling.`\n )\n }\n\n const position =\n previous.object === 'text' ? previous.text.length : previous.nodes.size\n\n editor.applyOperation({\n type: 'merge_node',\n path,\n position,\n // for undos to succeed we only need the type and data because\n // these are the only properties that get changed in the merge operation\n properties: {\n type: original.type,\n data: original.data,\n },\n target: null,\n })\n}\n\n/**\n * Move a node by `path` to a new parent by `newParentPath` and `newIndex`.\n *\n * @param {Editor} editor\n * @param {Array} path\n * @param {String} newParentPath\n * @param {Number} newIndex\n */\n\nCommands.moveNodeByPath = (editor, path, newParentPath, newIndex) => {\n // If the operation path and newParentPath are the same,\n // this should be considered a NOOP\n if (PathUtils.isEqual(path, newParentPath)) {\n return editor\n }\n\n const newPath = newParentPath.concat(newIndex)\n\n if (PathUtils.isEqual(path, newPath)) {\n return editor\n }\n\n editor.applyOperation({\n type: 'move_node',\n path,\n newPath,\n })\n}\n\n/**\n * Remove mark from text at `offset` and `length` in node by `path`.\n *\n * @param {Editor} editor\n * @param {Array} path\n * @param {Number} offset\n * @param {Number} length\n * @param {Mark} mark\n */\n\nCommands.removeMarkByPath = (editor, path, offset, length, mark) => {\n mark = Mark.create(mark)\n editor.removeMarksByPath(path, offset, length, [mark])\n}\n\nCommands.removeMarksByPath = (editor, path, offset, length, marks) => {\n marks = Mark.createSet(marks)\n\n if (!marks.size) {\n return\n }\n\n const { value } = editor\n const { document } = value\n const node = document.assertNode(path)\n\n if (marks.intersect(node.marks).isEmpty()) {\n return\n }\n\n editor.withoutNormalizing(() => {\n // If it ends before the end of the node, we'll need to split to create a new\n // text with different marks.\n if (offset + length < node.text.length) {\n editor.splitNodeByPath(path, offset + length)\n }\n\n // Same thing if it starts after the start. But in that case, we need to\n // update our path and offset to point to the new start.\n if (offset > 0) {\n editor.splitNodeByPath(path, offset)\n path = PathUtils.increment(path)\n offset = 0\n }\n\n marks.forEach(mark => {\n editor.applyOperation({\n type: 'remove_mark',\n path,\n offset,\n length,\n mark,\n })\n })\n })\n}\n\n/**\n * Remove all `marks` from node by `path`.\n *\n * @param {Editor} editor\n * @param {Array} path\n */\n\nCommands.removeAllMarksByPath = (editor, path) => {\n const { state } = editor\n const { document } = state\n const node = document.assertNode(path)\n\n editor.withoutNormalizing(() => {\n if (node.object === 'text') {\n editor.removeMarksByPath(path, 0, node.text.length, node.marks)\n return\n }\n\n for (const [n, p] of node.texts()) {\n const pth = path.concat(p)\n editor.removeMarksByPath(pth, 0, n.text.length, n.marks)\n }\n })\n}\n\n/**\n * Remove a node by `path`.\n *\n * @param {Editor} editor\n * @param {Array} path\n */\n\nCommands.removeNodeByPath = (editor, path) => {\n const { value } = editor\n const { document } = value\n const node = document.assertNode(path)\n\n editor.applyOperation({\n type: 'remove_node',\n path,\n node,\n })\n}\n\n/**\n * Remove text at `offset` and `length` in node by `path`.\n *\n * @param {Editor} editor\n * @param {Array} path\n * @param {Number} offset\n * @param {Number} length\n */\n\nCommands.removeTextByPath = (editor, path, offset, length) => {\n const { value } = editor\n const { document, annotations } = value\n const node = document.assertNode(path)\n const text = node.text.slice(offset, offset + length)\n\n editor.withoutNormalizing(() => {\n for (const annotation of annotations.values()) {\n const { start, end } = annotation\n const isAtomic = editor.isAtomic(annotation)\n\n if (!isAtomic) {\n continue\n }\n\n if (!start.path.equals(path)) {\n continue\n }\n\n if (\n start.offset < offset &&\n (!end.path.equals(path) || end.offset > offset)\n ) {\n editor.removeAnnotation(annotation)\n }\n }\n\n editor.applyOperation({\n type: 'remove_text',\n path,\n offset,\n text,\n })\n })\n}\n\n/**\n`* Replace a `node` with another `node`\n *\n * @param {Editor} editor\n * @param {Array} path\n * @param {Object|Node} node\n */\n\nCommands.replaceNodeByPath = (editor, path, newNode) => {\n newNode = Node.create(newNode)\n const index = path.last()\n const parentPath = PathUtils.lift(path)\n\n editor.withoutNormalizing(() => {\n editor.removeNodeByPath(path)\n editor.insertNodeByPath(parentPath, index, newNode)\n })\n}\n\n/**\n * Replace a `length` of text at `offset` with new `text` and optional `marks`.\n *\n * @param {Editor} editor\n * @param {String} key\n * @param {Number} offset\n * @param {Number} length\n * @param {string} text\n * @param {Set} marks (optional)\n */\n\nCommands.replaceTextByPath = (editor, path, offset, length, text, marks) => {\n editor.withoutNormalizing(() => {\n editor.removeTextByPath(path, offset, length)\n editor.insertTextByPath(path, offset, text, marks)\n })\n}\n\n/**\n * Set `newProperties` on mark on text at `offset` and `length` in node by `path`.\n *\n * @param {Editor} editor\n * @param {Array} path\n * @param {Number} offset\n * @param {Number} length\n * @param {Object|Mark} properties\n * @param {Object} newProperties\n */\n\nCommands.setMarkByPath = (\n editor,\n path,\n offset,\n length,\n properties,\n newProperties\n) => {\n properties = Mark.create(properties)\n newProperties = Mark.createProperties(newProperties)\n\n const { value } = editor\n const { document } = value\n const node = document.assertNode(path)\n\n editor.withoutNormalizing(() => {\n // If it ends before the end of the node, we'll need to split to create a new\n // text with different marks.\n if (offset + length < node.text.length) {\n editor.splitNodeByPath(path, offset + length)\n }\n\n // Same thing if it starts after the start. But in that case, we need to\n // update our path and offset to point to the new start.\n if (offset > 0) {\n editor.splitNodeByPath(path, offset)\n path = PathUtils.increment(path)\n offset = 0\n }\n\n editor.applyOperation({\n type: 'set_mark',\n path,\n properties,\n newProperties,\n })\n })\n}\n\n/**\n * Set `properties` on a node by `path`.\n *\n * @param {Editor} editor\n * @param {Array} path\n * @param {Object|String} newProperties\n */\n\nCommands.setNodeByPath = (editor, path, newProperties) => {\n const { value } = editor\n const { document } = value\n const node = document.assertNode(path)\n newProperties = Node.createProperties(newProperties)\n const prevProperties = pick(node, Object.keys(newProperties))\n\n editor.applyOperation({\n type: 'set_node',\n path,\n properties: prevProperties,\n newProperties,\n })\n}\n\n/**\n * Insert `text` at `offset` in node by `path`.\n *\n * @param {Editor} editor\n * @param {Array} path\n * @param {String} text\n * @param {Set} marks (optional)\n */\n\nCommands.setTextByPath = (editor, path, text, marks) => {\n const { value } = editor\n const { document } = value\n const node = document.assertNode(path)\n const end = node.text.length\n editor.replaceTextByPath(path, 0, end, text, marks)\n}\n\n/**\n * Split a node by `path` at `position`.\n *\n * @param {Editor} editor\n * @param {Array} path\n * @param {Number} position\n * @param {Object} options\n */\n\nCommands.splitNodeByPath = (editor, path, position, options = {}) => {\n const { target = null } = options\n const { value } = editor\n const { document } = value\n const node = document.getDescendant(path)\n\n editor.applyOperation({\n type: 'split_node',\n path,\n position,\n target,\n properties: {\n type: node.type,\n data: node.data,\n },\n })\n}\n\n/**\n * Split a node deeply down the tree by `path`, `textPath` and `textOffset`.\n *\n * @param {Editor} editor\n * @param {Array} path\n * @param {Array} textPath\n * @param {Number} textOffset\n */\n\nCommands.splitDescendantsByPath = (editor, path, textPath, textOffset) => {\n if (path.equals(textPath)) {\n editor.splitNodeByPath(textPath, textOffset)\n return\n }\n\n const { value } = editor\n const { document } = value\n let index = textOffset\n let lastPath = textPath\n\n editor.withoutNormalizing(() => {\n editor.splitNodeByKey(textPath, textOffset)\n\n for (const [, ancestorPath] of document.ancestors(textPath)) {\n const target = index\n index = lastPath.last() + 1\n lastPath = ancestorPath\n editor.splitNodeByPath(ancestorPath, index, { target })\n\n if (ancestorPath.equals(path)) {\n break\n }\n }\n })\n}\n\n/**\n * Unwrap content from an inline parent with `properties`.\n *\n * @param {Editor} editor\n * @param {Array} path\n * @param {Object|String} properties\n */\n\nCommands.unwrapInlineByPath = (editor, path, properties) => {\n const { value } = editor\n const { document, selection } = value\n const node = document.assertNode(path)\n const first = node.getFirstText()\n const last = node.getLastText()\n const range = selection.moveToRangeOfNode(first, last)\n editor.unwrapInlineAtRange(range, properties)\n}\n\n/**\n * Unwrap content from a block parent with `properties`.\n *\n * @param {Editor} editor\n * @param {Array} path\n * @param {Object|String} properties\n */\n\nCommands.unwrapBlockByPath = (editor, path, properties) => {\n const { value } = editor\n const { document, selection } = value\n const node = document.assertNode(path)\n const first = node.getFirstText()\n const last = node.getLastText()\n const range = selection.moveToRangeOfNode(first, last)\n editor.unwrapBlockAtRange(range, properties)\n}\n\n/**\n * Unwrap a single node from its parent.\n *\n * If the node is surrounded with siblings, its parent will be\n * split. If the node is the only child, the parent is removed, and\n * simply replaced by the node itself. Cannot unwrap a root node.\n *\n * @param {Editor} editor\n * @param {Array} path\n */\n\nCommands.unwrapNodeByPath = (editor, path) => {\n const { value } = editor\n const { document } = value\n document.assertNode(path)\n\n const parentPath = PathUtils.lift(path)\n const parent = document.assertNode(parentPath)\n const index = path.last()\n const parentIndex = parentPath.last()\n const grandPath = PathUtils.lift(parentPath)\n const isFirst = index === 0\n const isLast = index === parent.nodes.size - 1\n\n editor.withoutNormalizing(() => {\n if (parent.nodes.size === 1) {\n editor.moveNodeByPath(path, grandPath, parentIndex + 1)\n editor.removeNodeByPath(parentPath)\n } else if (isFirst) {\n editor.moveNodeByPath(path, grandPath, parentIndex)\n } else if (isLast) {\n editor.moveNodeByPath(path, grandPath, parentIndex + 1)\n } else {\n let updatedPath = PathUtils.increment(path, 1, parentPath.size - 1)\n updatedPath = updatedPath.set(updatedPath.size - 1, 0)\n editor.splitNodeByPath(parentPath, index)\n editor.moveNodeByPath(updatedPath, grandPath, parentIndex + 1)\n }\n })\n}\n\n/**\n * Unwrap all of the children of a node, by removing the node and replacing it\n * with the children in the tree.\n *\n * @param {Editor} editor\n * @param {Array} path\n */\n\nCommands.unwrapChildrenByPath = (editor, path) => {\n path = PathUtils.create(path)\n const { value } = editor\n const { document } = value\n const node = document.assertNode(path)\n const parentPath = PathUtils.lift(path)\n const index = path.last()\n const { nodes } = node\n\n editor.withoutNormalizing(() => {\n nodes.reverse().forEach((child, i) => {\n const childIndex = nodes.size - i - 1\n const childPath = path.push(childIndex)\n editor.moveNodeByPath(childPath, parentPath, index + 1)\n })\n\n editor.removeNodeByPath(path)\n })\n}\n\n/**\n * Wrap a node in a block with `properties`.\n *\n * @param {Editor} editor\n * @param {Array} path\n * @param {Block|Object|String} block\n */\n\nCommands.wrapBlockByPath = (editor, path, block) => {\n block = Block.create(block)\n block = block.set('nodes', block.nodes.clear())\n const parentPath = PathUtils.lift(path)\n const index = path.last()\n const newPath = PathUtils.increment(path)\n\n editor.withoutNormalizing(() => {\n editor.insertNodeByPath(parentPath, index, block)\n editor.moveNodeByPath(newPath, path, 0)\n })\n}\n\n/**\n * Wrap a node in an inline with `properties`.\n *\n * @param {Editor} editor\n * @param {Array} path\n * @param {Block|Object|String} inline\n */\n\nCommands.wrapInlineByPath = (editor, path, inline) => {\n inline = Inline.create(inline)\n inline = inline.set('nodes', inline.nodes.clear())\n const parentPath = PathUtils.lift(path)\n const index = path.last()\n const newPath = PathUtils.increment(path)\n\n editor.withoutNormalizing(() => {\n editor.insertNodeByPath(parentPath, index, inline)\n editor.moveNodeByPath(newPath, path, 0)\n })\n}\n\n/**\n * Wrap a node by `path` with `node`.\n *\n * @param {Editor} editor\n * @param {Array} path\n * @param {Node|Object} node\n */\n\nCommands.wrapNodeByPath = (editor, path, node) => {\n node = Node.create(node)\n\n if (node.object === 'block') {\n editor.wrapBlockByPath(path, node)\n } else if (node.object === 'inline') {\n editor.wrapInlineByPath(path, node)\n }\n}\n\n/**\n * Mix in `*ByKey` variants.\n */\n\nconst COMMANDS = [\n 'addMark',\n 'insertFragment',\n 'insertNode',\n 'insertText',\n 'mergeNode',\n 'removeAllMarks',\n 'removeMark',\n 'removeNode',\n 'removeText',\n 'replaceMarks',\n 'replaceNode',\n 'replaceText',\n 'setMark',\n 'setNode',\n 'setText',\n 'splitNode',\n 'unwrapBlock',\n 'unwrapChildren',\n 'unwrapInline',\n 'unwrapNode',\n 'wrapBlock',\n 'wrapInline',\n 'wrapNode',\n]\n\nfor (const method of COMMANDS) {\n Commands[`${method}ByKey`] = (editor, key, ...args) => {\n const { value } = editor\n const { document } = value\n const path = document.assertPath(key)\n editor[`${method}ByPath`](path, ...args)\n }\n}\n\n// Moving nodes takes two keys, so it's slightly different.\nCommands.moveNodeByKey = (editor, key, newKey, ...args) => {\n const { value } = editor\n const { document } = value\n const path = document.assertPath(key)\n const newPath = document.assertPath(newKey)\n editor.moveNodeByPath(path, newPath, ...args)\n}\n\n// Splitting descendants takes two keys, so it's slightly different.\nCommands.splitDescendantsByKey = (editor, key, textKey, ...args) => {\n const { value } = editor\n const { document } = value\n const path = document.assertPath(key)\n const textPath = document.assertPath(textKey)\n editor.splitDescendantsByPath(path, textPath, ...args)\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default Commands\n","import omit from 'lodash/omit'\nimport { List } from 'immutable'\n\n/**\n * Commands.\n *\n * @type {Object}\n */\n\nconst Commands = {}\n\n/**\n * Save an `operation` into the history.\n *\n * @param {Editor} editor\n * @param {Object} operation\n */\n\nCommands.save = (editor, operation) => {\n const { operations, value } = editor\n const { data } = value\n let { save, merge } = editor.tmp\n if (save === false || !isValidOperation(operation)) return\n\n let undos = data.get('undos') || List()\n const lastBatch = undos.last()\n const lastOperation = lastBatch && lastBatch.last()\n\n // If `merge` is non-commital, and this is not the first operation in a new\n // editor, then merge, otherwise merge based on the last operation.\n if (merge == null) {\n if (operations.size !== 0) {\n merge = true\n } else {\n merge = shouldMerge(operation, lastOperation)\n }\n }\n\n // If the `merge` flag is true, add the operation to the last batch.\n if (merge && lastBatch) {\n const batch = lastBatch.push(operation)\n undos = undos.pop()\n undos = undos.push(batch)\n } else {\n // Otherwise, create a new batch with the operation.\n const batch = List([operation])\n undos = undos.push(batch)\n }\n\n // Constrain the history to 100 entries for memory's sake.\n if (undos.size > 100) {\n undos = undos.takeLast(100)\n }\n\n // Clear the redos and update the history.\n editor.withoutSaving(() => {\n const redos = List()\n const newData = data.set('undos', undos).set('redos', redos)\n editor.setData(newData)\n })\n}\n\n/**\n * Redo to the next value in the history.\n *\n * @param {Editor} editor\n */\n\nCommands.redo = editor => {\n const { value } = editor\n const { data } = value\n let redos = data.get('redos') || List()\n let undos = data.get('undos') || List()\n const batch = redos.last()\n if (!batch) return\n\n editor.withoutSaving(() => {\n editor.withoutNormalizing(() => {\n // Replay the batch of operations.\n batch.forEach(op => {\n const { type, newProperties } = op\n\n // When the operation mutates the selection, omit its `isFocused` value to\n // prevent the editor focus from changing during redoing.\n if (type === 'set_selection') {\n op = op.set('newProperties', omit(newProperties, 'isFocused'))\n }\n\n editor.applyOperation(op)\n })\n\n // Shift the next value into the undo stack.\n redos = redos.pop()\n undos = undos.push(batch)\n const newData = data.set('undos', undos).set('redos', redos)\n editor.setData(newData)\n })\n })\n}\n\n/**\n * Undo the previous operations in the history.\n *\n * @param {Editor} editor\n */\n\nCommands.undo = editor => {\n const { value } = editor\n const { data } = value\n let redos = data.get('redos') || List()\n let undos = data.get('undos') || List()\n const batch = undos.last()\n if (!batch) return\n\n editor.withoutSaving(() => {\n editor.withoutNormalizing(() => {\n // Replay the inverse of the previous operations.\n batch\n .slice()\n .reverse()\n .map(op => op.invert())\n .forEach(inverse => {\n const { type, newProperties } = inverse\n\n // When the operation mutates the selection, omit its `isFocused` value to\n // prevent the editor focus from changing during undoing.\n if (type === 'set_selection') {\n inverse = inverse.set(\n 'newProperties',\n omit(newProperties, 'isFocused')\n )\n }\n\n editor.applyOperation(inverse)\n })\n\n // Shift the previous operations into the redo stack.\n redos = redos.push(batch)\n undos = undos.pop()\n const newData = data.set('undos', undos).set('redos', redos)\n editor.setData(newData)\n })\n })\n}\n\n/**\n * Apply a series of changes inside a synchronous `fn`, without merging any of\n * the new operations into previous save point in the history.\n *\n * @param {Editor} editor\n * @param {Function} fn\n */\n\nCommands.withoutMerging = (editor, fn) => {\n const value = editor.tmp.merge\n editor.tmp.merge = false\n fn(editor)\n editor.tmp.merge = value\n}\n\n/**\n * Apply a series of changes inside a synchronous `fn`, without saving any of\n * their operations into the history.\n *\n * @param {Editor} editor\n * @param {Function} fn\n */\n\nCommands.withoutSaving = (editor, fn) => {\n const value = editor.tmp.save\n editor.tmp.save = false\n fn(editor)\n editor.tmp.save = value\n}\n\n/**\n * Check whether to merge a new operation `o` into the previous operation `p`.\n *\n * @param {Object} o\n * @param {Object} p\n * @return {Boolean}\n */\n\nfunction shouldMerge(o, p) {\n if (!p) return false\n\n const merge =\n (o.type === 'set_selection' && p.type === 'set_selection') ||\n (o.type === 'insert_text' &&\n p.type === 'insert_text' &&\n o.offset === p.offset + p.text.length &&\n o.path.equals(p.path)) ||\n (o.type === 'remove_text' &&\n p.type === 'remove_text' &&\n o.offset + o.text.length === p.offset &&\n o.path.equals(p.path))\n\n return merge\n}\n\n/**\n * Check weather an operation needs to be saved to the history\n * @param {Object} o - operation\n * @returns {Boolean}\n */\n\nfunction isValidOperation(o) {\n if (o.type === 'set_selection') {\n const { isFocused, anchor, focus } = o.newProperties\n\n // this is blur/focus operation, dont need to store it into the history\n if (isFocused !== undefined && !anchor && !focus) {\n return false\n }\n }\n return true\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default Commands\n","import { is } from 'immutable'\nimport pick from 'lodash/pick'\n\nimport Selection from '../models/selection'\nimport TextUtils from '../utils/text-utils'\n\nconst Commands = {}\n\nCommands.blur = editor => {\n editor.select({ isFocused: false })\n}\n\nCommands.deselect = editor => {\n const range = Selection.create()\n editor.select(range)\n}\n\nCommands.focus = editor => {\n editor.select({ isFocused: true })\n}\n\nCommands.flip = editor => {\n editor.command(proxy, 'flip')\n}\n\nCommands.moveAnchorBackward = (editor, ...args) => {\n editor.command(pointBackward, 'anchor', ...args)\n}\n\nCommands.moveAnchorWordBackward = (editor, ...args) => {\n editor.command(pointWordBackward, 'anchor', ...args)\n}\n\nCommands.moveAnchorForward = (editor, ...args) => {\n editor.command(pointForward, 'anchor', ...args)\n}\n\nCommands.moveAnchorWordForward = (editor, ...args) => {\n editor.command(pointWordForward, 'anchor', ...args)\n}\n\nCommands.moveAnchorTo = (editor, ...args) => {\n editor.command(proxy, 'moveAnchorTo', ...args)\n}\n\nCommands.moveAnchorToEndOfBlock = editor => {\n editor.command(pointEdgeObject, 'anchor', 'end', 'block')\n}\n\nCommands.moveAnchorToEndOfInline = editor => {\n editor.command(pointEdgeObject, 'anchor', 'end', 'inline')\n}\n\nCommands.moveAnchorToEndOfDocument = editor => {\n editor.moveAnchorToEndOfNode(editor.value.document).moveToAnchor()\n}\n\nCommands.moveAnchorToEndOfNextBlock = editor => {\n editor.command(pointEdgeSideObject, 'anchor', 'end', 'next', 'block')\n}\n\nCommands.moveAnchorToEndOfNextInline = editor => {\n editor.command(pointEdgeSideObject, 'anchor', 'end', 'next', 'inline')\n}\n\nCommands.moveAnchorToEndOfNextText = editor => {\n editor.command(pointEdgeSideObject, 'anchor', 'end', 'next', 'text')\n}\n\nCommands.moveAnchorToEndOfNode = (editor, ...args) => {\n editor.command(proxy, 'moveAnchorToEndOfNode', ...args)\n}\n\nCommands.moveAnchorToEndOfPreviousBlock = editor => {\n editor.command(pointEdgeSideObject, 'anchor', 'end', 'previous', 'block')\n}\n\nCommands.moveAnchorToEndOfPreviousInline = editor => {\n editor.command(pointEdgeSideObject, 'anchor', 'end', 'previous', 'inline')\n}\n\nCommands.moveAnchorToEndOfPreviousText = editor => {\n editor.command(pointEdgeSideObject, 'anchor', 'end', 'previous', 'text')\n}\n\nCommands.moveAnchorToEndOfText = editor => {\n editor.command(pointEdgeObject, 'anchor', 'end', 'text')\n}\n\nCommands.moveAnchorToStartOfBlock = editor => {\n editor.command(pointEdgeObject, 'anchor', 'start', 'block')\n}\n\nCommands.moveAnchorToStartOfDocument = editor => {\n editor.moveAnchorToStartOfNode(editor.value.document).moveToAnchor()\n}\n\nCommands.moveAnchorToStartOfInline = editor => {\n editor.command(pointEdgeObject, 'anchor', 'start', 'inline')\n}\n\nCommands.moveAnchorToStartOfNextBlock = editor => {\n editor.command(pointEdgeSideObject, 'anchor', 'start', 'next', 'block')\n}\n\nCommands.moveAnchorToStartOfNextInline = editor => {\n editor.command(pointEdgeSideObject, 'anchor', 'start', 'next', 'inline')\n}\n\nCommands.moveAnchorToStartOfNextText = editor => {\n editor.command(pointEdgeSideObject, 'anchor', 'start', 'next', 'text')\n}\n\nCommands.moveAnchorToStartOfNode = (editor, ...args) => {\n editor.command(proxy, 'moveAnchorToStartOfNode', ...args)\n}\n\nCommands.moveAnchorToStartOfPreviousBlock = editor => {\n editor.command(pointEdgeSideObject, 'anchor', 'start', 'previous', 'block')\n}\n\nCommands.moveAnchorToStartOfPreviousInline = editor => {\n editor.command(pointEdgeSideObject, 'anchor', 'start', 'previous', 'inline')\n}\n\nCommands.moveAnchorToStartOfPreviousText = editor => {\n editor.command(pointEdgeSideObject, 'anchor', 'start', 'previous', 'text')\n}\n\nCommands.moveAnchorToStartOfText = editor => {\n editor.command(pointEdgeObject, 'anchor', 'start', 'text')\n}\n\nCommands.moveBackward = (editor, chars = 1) => {\n if (chars === 0) return\n\n const { value } = editor\n const { document, selection } = value\n const { start } = selection\n const startBlock = document.getClosestBlock(start.key)\n const o = startBlock.getOffset(start.key)\n const offset = o + start.offset\n const { text } = startBlock\n const charsOffset = TextUtils.getCharOffsetBackward(text, offset, chars)\n editor.moveAnchorBackward(charsOffset).moveFocusBackward(charsOffset)\n}\n\nCommands.moveWordBackward = (editor, ...args) => {\n editor.moveFocusWordBackward(...args).moveToFocus()\n}\n\nCommands.moveEndBackward = (editor, ...args) => {\n editor.command(pointBackward, 'end', ...args)\n}\n\nCommands.moveEndWordBackward = (editor, ...args) => {\n editor.command(pointWordBackward, 'end', ...args)\n}\n\nCommands.moveEndForward = (editor, ...args) => {\n editor.command(pointForward, 'end', ...args)\n}\n\nCommands.moveEndWordForward = (editor, ...args) => {\n editor.command(pointWordForward, 'end', ...args)\n}\n\nCommands.moveEndTo = (editor, ...args) => {\n editor.command(proxy, 'moveEndTo', ...args)\n}\n\nCommands.moveEndToEndOfBlock = editor => {\n editor.command(pointEdgeObject, 'end', 'end', 'block')\n}\n\nCommands.moveEndToEndOfDocument = editor => {\n editor.moveEndToEndOfNode(editor.value.document).moveToEnd()\n}\n\nCommands.moveEndToEndOfInline = editor => {\n editor.command(pointEdgeObject, 'end', 'end', 'inline')\n}\n\nCommands.moveEndToEndOfNextBlock = editor => {\n editor.command(pointEdgeSideObject, 'end', 'end', 'next', 'block')\n}\n\nCommands.moveEndToEndOfNextInline = editor => {\n editor.command(pointEdgeSideObject, 'end', 'end', 'next', 'inline')\n}\n\nCommands.moveEndToEndOfNextText = editor => {\n editor.command(pointEdgeSideObject, 'end', 'end', 'next', 'text')\n}\n\nCommands.moveEndToEndOfNode = (editor, ...args) => {\n editor.command(proxy, 'moveEndToEndOfNode', ...args)\n}\n\nCommands.moveEndToEndOfPreviousBlock = editor => {\n editor.command(pointEdgeSideObject, 'end', 'end', 'previous', 'block')\n}\n\nCommands.moveEndToEndOfPreviousInline = editor => {\n editor.command(pointEdgeSideObject, 'end', 'end', 'previous', 'inline')\n}\n\nCommands.moveEndToEndOfPreviousText = editor => {\n editor.command(pointEdgeSideObject, 'end', 'end', 'previous', 'text')\n}\n\nCommands.moveEndToEndOfText = editor => {\n editor.command(pointEdgeObject, 'end', 'end', 'text')\n}\n\nCommands.moveEndToStartOfBlock = editor => {\n editor.command(pointEdgeObject, 'end', 'start', 'block')\n}\n\nCommands.moveEndToStartOfDocument = editor => {\n editor.moveEndToStartOfNode(editor.value.document).moveToEnd()\n}\n\nCommands.moveEndToStartOfInline = editor => {\n editor.command(pointEdgeObject, 'end', 'start', 'inline')\n}\n\nCommands.moveEndToStartOfNextBlock = editor => {\n editor.command(pointEdgeSideObject, 'end', 'start', 'next', 'block')\n}\n\nCommands.moveEndToStartOfNextInline = editor => {\n editor.command(pointEdgeSideObject, 'end', 'start', 'next', 'inline')\n}\n\nCommands.moveEndToStartOfNextText = editor => {\n editor.command(pointEdgeSideObject, 'end', 'start', 'next', 'text')\n}\n\nCommands.moveEndToStartOfNode = (editor, ...args) => {\n editor.command(proxy, 'moveEndToStartOfNode', ...args)\n}\n\nCommands.moveEndToStartOfPreviousBlock = editor => {\n editor.command(pointEdgeSideObject, 'end', 'start', 'previous', 'block')\n}\n\nCommands.moveEndToStartOfPreviousInline = editor => {\n editor.command(pointEdgeSideObject, 'end', 'start', 'previous', 'inline')\n}\n\nCommands.moveEndToStartOfPreviousText = editor => {\n editor.command(pointEdgeSideObject, 'end', 'start', 'previous', 'text')\n}\n\nCommands.moveEndToStartOfText = editor => {\n editor.command(pointEdgeObject, 'end', 'start', 'text')\n}\n\nCommands.moveFocusBackward = (editor, ...args) => {\n editor.command(pointBackward, 'focus', ...args)\n}\n\nCommands.moveFocusWordBackward = (editor, ...args) => {\n editor.command(pointWordBackward, 'focus', ...args)\n}\n\nCommands.moveFocusForward = (editor, ...args) => {\n editor.command(pointForward, 'focus', ...args)\n}\n\nCommands.moveFocusWordForward = (editor, ...args) => {\n editor.command(pointWordForward, 'focus', ...args)\n}\n\nCommands.moveFocusTo = (editor, ...args) => {\n editor.command(proxy, 'moveFocusTo', ...args)\n}\n\nCommands.moveFocusToEndOfBlock = editor => {\n editor.command(pointEdgeObject, 'focus', 'end', 'block')\n}\n\nCommands.moveFocusToEndOfDocument = editor => {\n editor.moveFocusToEndOfNode(editor.value.document).moveToFocus()\n}\n\nCommands.moveFocusToEndOfInline = editor => {\n editor.command(pointEdgeObject, 'focus', 'end', 'inline')\n}\n\nCommands.moveFocusToEndOfNextBlock = editor => {\n editor.command(pointEdgeSideObject, 'focus', 'end', 'next', 'block')\n}\n\nCommands.moveFocusToEndOfNextInline = editor => {\n editor.command(pointEdgeSideObject, 'focus', 'end', 'next', 'inline')\n}\n\nCommands.moveFocusToEndOfNextText = editor => {\n editor.command(pointEdgeSideObject, 'focus', 'end', 'next', 'text')\n}\n\nCommands.moveFocusToEndOfNode = (editor, ...args) => {\n editor.command(proxy, 'moveFocusToEndOfNode', ...args)\n}\n\nCommands.moveFocusToEndOfPreviousBlock = editor => {\n editor.command(pointEdgeSideObject, 'focus', 'end', 'previous', 'block')\n}\n\nCommands.moveFocusToEndOfPreviousInline = editor => {\n editor.command(pointEdgeSideObject, 'focus', 'end', 'previous', 'inline')\n}\n\nCommands.moveFocusToEndOfPreviousText = editor => {\n editor.command(pointEdgeSideObject, 'focus', 'end', 'previous', 'text')\n}\n\nCommands.moveFocusToEndOfText = editor => {\n editor.command(pointEdgeObject, 'focus', 'end', 'text')\n}\n\nCommands.moveFocusToStartOfBlock = editor => {\n editor.command(pointEdgeObject, 'focus', 'start', 'block')\n}\n\nCommands.moveFocusToStartOfDocument = editor => {\n editor.moveFocusToStartOfNode(editor.value.document).moveToFocus()\n}\n\nCommands.moveFocusToStartOfInline = editor => {\n editor.command(pointEdgeObject, 'focus', 'start', 'inline')\n}\n\nCommands.moveFocusToStartOfNextBlock = editor => {\n editor.command(pointEdgeSideObject, 'focus', 'start', 'next', 'block')\n}\n\nCommands.moveFocusToStartOfNextInline = editor => {\n editor.command(pointEdgeSideObject, 'focus', 'start', 'next', 'inline')\n}\n\nCommands.moveFocusToStartOfNextText = editor => {\n editor.command(pointEdgeSideObject, 'focus', 'start', 'next', 'text')\n}\n\nCommands.moveFocusToStartOfNode = (editor, ...args) => {\n editor.command(proxy, 'moveFocusToStartOfNode', ...args)\n}\n\nCommands.moveFocusToStartOfPreviousBlock = editor => {\n editor.command(pointEdgeSideObject, 'focus', 'start', 'previous', 'block')\n}\n\nCommands.moveFocusToStartOfPreviousInline = editor => {\n editor.command(pointEdgeSideObject, 'focus', 'start', 'previous', 'inline')\n}\n\nCommands.moveFocusToStartOfPreviousText = editor => {\n editor.command(pointEdgeSideObject, 'focus', 'start', 'previous', 'text')\n}\n\nCommands.moveFocusToStartOfText = editor => {\n editor.command(pointEdgeObject, 'focus', 'start', 'text')\n}\n\nCommands.moveForward = (editor, chars = 1) => {\n if (chars === 0) return\n\n const { value } = editor\n const { document, selection } = value\n const { start } = selection\n const startBlock = document.getClosestBlock(start.path)\n const o = startBlock.getOffset(start.key)\n const offset = o + start.offset\n const { text } = startBlock\n const charsOffset = TextUtils.getCharOffsetForward(text, offset, chars)\n editor.moveAnchorForward(charsOffset).moveFocusForward(charsOffset)\n}\n\nCommands.moveWordForward = (editor, ...args) => {\n editor.moveFocusWordForward(...args).moveToFocus(...args)\n}\n\nCommands.moveStartBackward = (editor, ...args) => {\n editor.command(pointBackward, 'start', ...args)\n}\n\nCommands.moveStartWordBackward = (editor, ...args) => {\n editor.command(pointWordBackward, 'start', ...args)\n}\n\nCommands.moveStartForward = (editor, ...args) => {\n editor.command(pointForward, 'start', ...args)\n}\n\nCommands.moveStartWordForward = (editor, ...args) => {\n editor.command(pointWordForward, 'start', ...args)\n}\n\nCommands.moveStartTo = (editor, ...args) => {\n editor.command(proxy, 'moveStartTo', ...args)\n}\n\nCommands.moveStartToEndOfBlock = editor => {\n editor.command(pointEdgeObject, 'start', 'end', 'block')\n}\n\nCommands.moveStartToEndOfDocument = editor => {\n editor.moveStartToEndOfNode(editor.value.document).moveToStart()\n}\n\nCommands.moveStartToEndOfInline = editor => {\n editor.command(pointEdgeObject, 'start', 'end', 'inline')\n}\n\nCommands.moveStartToEndOfNextBlock = editor => {\n editor.command(pointEdgeSideObject, 'start', 'end', 'next', 'block')\n}\n\nCommands.moveStartToEndOfNextInline = editor => {\n editor.command(pointEdgeSideObject, 'start', 'end', 'next', 'inline')\n}\n\nCommands.moveStartToEndOfNextText = editor => {\n editor.command(pointEdgeSideObject, 'start', 'end', 'next', 'text')\n}\n\nCommands.moveStartToEndOfNode = (editor, ...args) => {\n editor.command(proxy, 'moveStartToEndOfNode', ...args)\n}\n\nCommands.moveStartToEndOfPreviousBlock = editor => {\n editor.command(pointEdgeSideObject, 'start', 'end', 'previous', 'block')\n}\n\nCommands.moveStartToEndOfPreviousInline = editor => {\n editor.command(pointEdgeSideObject, 'start', 'end', 'previous', 'inline')\n}\n\nCommands.moveStartToEndOfPreviousText = editor => {\n editor.command(pointEdgeSideObject, 'start', 'end', 'previous', 'text')\n}\n\nCommands.moveStartToEndOfText = editor => {\n editor.command(pointEdgeObject, 'start', 'end', 'text')\n}\n\nCommands.moveStartToStartOfBlock = editor => {\n editor.command(pointEdgeObject, 'start', 'start', 'block')\n}\n\nCommands.moveStartToStartOfDocument = editor => {\n editor.moveStartToStartOfNode(editor.value.document).moveToStart()\n}\n\nCommands.moveStartToStartOfInline = editor => {\n editor.command(pointEdgeObject, 'start', 'start', 'inline')\n}\n\nCommands.moveStartToStartOfNextBlock = editor => {\n editor.command(pointEdgeSideObject, 'start', 'start', 'next', 'block')\n}\n\nCommands.moveStartToStartOfNextInline = editor => {\n editor.command(pointEdgeSideObject, 'start', 'start', 'next', 'inline')\n}\n\nCommands.moveStartToStartOfNextText = editor => {\n editor.command(pointEdgeSideObject, 'start', 'start', 'next', 'text')\n}\n\nCommands.moveStartToStartOfNode = (editor, ...args) => {\n editor.command(proxy, 'moveStartToStartOfNode', ...args)\n}\n\nCommands.moveStartToStartOfPreviousBlock = editor => {\n editor.command(pointEdgeSideObject, 'start', 'start', 'previous', 'block')\n}\n\nCommands.moveStartToStartOfPreviousInline = editor => {\n editor.command(pointEdgeSideObject, 'start', 'start', 'previous', 'inline')\n}\n\nCommands.moveStartToStartOfPreviousText = editor => {\n editor.command(pointEdgeSideObject, 'start', 'start', 'previous', 'text')\n}\n\nCommands.moveStartToStartOfText = editor => {\n editor.command(pointEdgeObject, 'start', 'start', 'text')\n}\n\nCommands.moveTo = (editor, ...args) => {\n editor.command(proxy, 'moveTo', ...args)\n}\n\nCommands.moveToAnchor = editor => {\n editor.command(proxy, 'moveToAnchor')\n}\n\nCommands.moveToEnd = editor => {\n editor.command(proxy, 'moveToEnd')\n}\n\nCommands.moveToEndOfBlock = editor => {\n editor.moveEndToEndOfBlock().moveToEnd()\n}\n\nCommands.moveToEndOfDocument = editor => {\n editor.moveEndToEndOfNode(editor.value.document).moveToEnd()\n}\n\nCommands.moveToEndOfInline = editor => {\n editor.moveEndToEndOfInline().moveToEnd()\n}\n\nCommands.moveToEndOfNextBlock = editor => {\n editor.moveEndToEndOfNextBlock().moveToEnd()\n}\n\nCommands.moveToEndOfNextInline = editor => {\n editor.moveEndToEndOfNextInline().moveToEnd()\n}\n\nCommands.moveToEndOfNextText = editor => {\n editor.moveEndToEndOfNextText().moveToEnd()\n}\n\nCommands.moveToEndOfNode = (editor, ...args) => {\n editor.command(proxy, 'moveToEndOfNode', ...args)\n}\n\nCommands.moveToEndOfPreviousBlock = editor => {\n editor.moveStartToEndOfPreviousBlock().moveToStart()\n}\n\nCommands.moveToEndOfPreviousInline = editor => {\n editor.moveStartToEndOfPreviousInline().moveToStart()\n}\n\nCommands.moveToEndOfPreviousText = editor => {\n editor.moveStartToEndOfPreviousText().moveToStart()\n}\n\nCommands.moveToEndOfText = editor => {\n editor.moveEndToEndOfText().moveToEnd()\n}\n\nCommands.moveToFocus = editor => {\n editor.command(proxy, 'moveToFocus')\n}\n\nCommands.moveToRangeOfDocument = editor => {\n editor.moveToRangeOfNode(editor.value.document)\n}\n\nCommands.moveToRangeOfNode = (editor, ...args) => {\n editor.command(proxy, 'moveToRangeOfNode', ...args)\n}\n\nCommands.moveToStart = editor => {\n editor.command(proxy, 'moveToStart')\n}\n\nCommands.moveToStartOfBlock = editor => {\n editor.moveStartToStartOfBlock().moveToStart()\n}\n\nCommands.moveToStartOfDocument = editor => {\n editor.moveStartToStartOfNode(editor.value.document).moveToStart()\n}\n\nCommands.moveToStartOfInline = editor => {\n editor.moveStartToStartOfInline().moveToStart()\n}\n\nCommands.moveToStartOfNextBlock = editor => {\n editor.moveEndToStartOfNextBlock().moveToEnd()\n}\n\nCommands.moveToStartOfNextInline = editor => {\n editor.moveEndToStartOfNextInline().moveToEnd()\n}\n\nCommands.moveToStartOfNextText = editor => {\n editor.moveEndToStartOfNextText().moveToEnd()\n}\n\nCommands.moveToStartOfNode = (editor, ...args) => {\n editor.command(proxy, 'moveToStartOfNode', ...args)\n}\n\nCommands.moveToStartOfPreviousBlock = editor => {\n editor.moveStartToStartOfPreviousBlock().moveToStart()\n}\n\nCommands.moveToStartOfPreviousInline = editor => {\n editor.moveStartToStartOfPreviousInline().moveToStart()\n}\n\nCommands.moveToStartOfPreviousText = editor => {\n editor.moveStartToStartOfPreviousText().moveToStart()\n}\n\nCommands.moveToStartOfText = editor => {\n editor.moveStartToStartOfText().moveToStart()\n}\n\nCommands.select = (editor, properties, options = {}) => {\n properties = Selection.createProperties(properties)\n const { snapshot = false } = options\n const { value } = editor\n const { document, selection } = value\n const newProperties = {}\n let next = selection.setProperties(properties)\n next = document.resolveSelection(next)\n\n // Re-compute the properties, to ensure that we get their normalized values.\n properties = pick(next, Object.keys(properties))\n\n // Remove any properties that are already equal to the current selection. And\n // create a dictionary of the previous values for all of the properties that\n // are being changed, for the inverse operation.\n for (const k in properties) {\n if (snapshot === true || !is(properties[k], selection[k])) {\n newProperties[k] = properties[k]\n }\n }\n\n // If the selection moves, clear any marks, unless the new selection\n // properties change the marks in some way.\n if (\n selection.marks &&\n !newProperties.marks &&\n (newProperties.anchor || newProperties.focus)\n ) {\n newProperties.marks = null\n }\n\n // If there are no new properties to set, abort to avoid extra operations.\n if (Object.keys(newProperties).length === 0) {\n return\n }\n\n // TODO: for some reason toJSON() is required here (it breaks selections between blocks)? - 2018-10-10\n const prevProperties = pick(selection.toJSON(), Object.keys(newProperties))\n\n editor.applyOperation(\n {\n type: 'set_selection',\n value,\n properties: prevProperties,\n newProperties,\n },\n snapshot ? { skip: false, merge: false } : {}\n )\n}\n\nCommands.setAnchor = (editor, ...args) => {\n editor.command(proxy, 'setAnchor', ...args)\n}\n\nCommands.setEnd = (editor, ...args) => {\n editor.command(proxy, 'setEnd', ...args)\n}\n\nCommands.setFocus = (editor, ...args) => {\n editor.command(proxy, 'setFocus', ...args)\n}\n\nCommands.setStart = (editor, ...args) => {\n editor.command(proxy, 'setStart', ...args)\n}\n\nCommands.snapshotSelection = editor => {\n editor.withoutMerging(() => {\n editor.select(editor.value.selection, { snapshot: true })\n })\n}\n\n/**\n * Helpers.\n */\n\nfunction proxy(editor, method, ...args) {\n const range = editor.value.selection[method](...args)\n editor.select(range)\n}\n\nfunction pointEdgeObject(editor, point, edge, object) {\n const Point = point.slice(0, 1).toUpperCase() + point.slice(1)\n const Edge = edge.slice(0, 1).toUpperCase() + edge.slice(1)\n const Object = object.slice(0, 1).toUpperCase() + object.slice(1)\n const method = `move${Point}To${Edge}OfNode`\n const getNode = object === 'text' ? 'getNode' : `getClosest${Object}`\n const { value } = editor\n const { document, selection } = value\n const p = selection[point]\n const node = document[getNode](p.key)\n if (!node) return\n editor[method](node)\n}\n\nfunction pointEdgeSideObject(editor, point, edge, side, object) {\n const Point = point.slice(0, 1).toUpperCase() + point.slice(1)\n const Edge = edge.slice(0, 1).toUpperCase() + edge.slice(1)\n const Side = side.slice(0, 1).toUpperCase() + side.slice(1)\n const Object = object.slice(0, 1).toUpperCase() + object.slice(1)\n const method = `move${Point}To${Edge}OfNode`\n const getNode = object === 'text' ? 'getNode' : `getClosest${Object}`\n const getDirectionNode = `get${Side}${Object}`\n const { value } = editor\n const { document, selection } = value\n const p = selection[point]\n const node = document[getNode](p.key)\n if (!node) return\n const target = document[getDirectionNode](node.key)\n if (!target) return\n editor[method](target)\n}\n\nfunction pointBackward(editor, point, n = 1) {\n if (n === 0) return\n if (n < 0) return pointForward(editor, point, -n)\n\n const Point = point.slice(0, 1).toUpperCase() + point.slice(1)\n const { value } = editor\n const { document, selection } = value\n const p = selection[point]\n const hasVoidParent = document.hasVoidParent(p.path, editor)\n\n // what is this?\n if (!hasVoidParent && p.offset - n >= 0) {\n const range = selection[`move${Point}Backward`](n)\n editor.select(range)\n return\n }\n\n const previous = document.getPreviousText(p.path)\n if (!previous) return\n\n const block = document.getClosestBlock(p.path)\n const isInBlock = block.hasNode(previous.key)\n const isPreviousInVoid =\n previous && document.hasVoidParent(previous.key, editor)\n editor[`move${Point}ToEndOfNode`](previous)\n\n // when is this called?\n if (!hasVoidParent && !isPreviousInVoid && isInBlock) {\n const range = editor.value.selection[`move${Point}Backward`](n)\n editor.select(range)\n }\n}\n\nfunction pointForward(editor, point, n = 1) {\n if (n === 0) return\n if (n < 0) return pointBackward(editor, point, -n)\n\n const Point = point.slice(0, 1).toUpperCase() + point.slice(1)\n const { value } = editor\n const { document, selection } = value\n const p = selection[point]\n const text = document.getNode(p.path)\n const hasVoidParent = document.hasVoidParent(p.path, editor)\n\n // what is this?\n if (!hasVoidParent && p.offset + n <= text.text.length) {\n const range = selection[`move${Point}Forward`](n)\n editor.select(range)\n return\n }\n\n const next = document.getNextText(p.path)\n if (!next) return\n\n const block = document.getClosestBlock(p.path)\n const isInBlock = block.hasNode(next.key)\n const isNextInVoid = document.hasVoidParent(next.key, editor)\n editor[`move${Point}ToStartOfNode`](next)\n\n // when is this called?\n if (!hasVoidParent && !isNextInVoid && isInBlock) {\n const range = editor.value.selection[`move${Point}Forward`](n)\n editor.select(range)\n }\n}\n\nfunction pointWordBackward(editor, pointName) {\n const { value } = editor\n const { document, selection } = value\n const point = selection[pointName]\n const block = document.getClosestBlock(point.key)\n const offset = block.getOffset(point.key)\n const o = offset + point.offset\n const { text } = block\n const n = TextUtils.getWordOffsetBackward(text, o)\n editor.command(pointBackward, pointName, n > 0 ? n : 1)\n}\n\nfunction pointWordForward(editor, pointName) {\n const { value } = editor\n const { document, selection } = value\n const point = selection[pointName]\n const block = document.getClosestBlock(point.key)\n const offset = block.getOffset(point.key)\n const o = offset + point.offset\n const { text } = block\n const n = TextUtils.getWordOffsetForward(text, o)\n editor.command(pointForward, pointName, n > 0 ? n : 1)\n}\n\nexport default Commands\n","import pick from 'lodash/pick'\nimport Annotation from '../models/annotation'\nimport Value from '../models/value'\n\n/**\n * Commands.\n *\n * @type {Object}\n */\n\nconst Commands = {}\n\n/**\n * Set `properties` on the value.\n *\n * @param {Editor} editor\n * @param {Object|Value} properties\n */\n\nCommands.setData = (editor, data = {}) => {\n const { value } = editor\n const newProperties = Value.createProperties({ data })\n const prevProperties = pick(value, Object.keys(newProperties))\n\n editor.applyOperation({\n type: 'set_value',\n properties: prevProperties,\n newProperties,\n })\n}\n\nCommands.addAnnotation = (editor, annotation) => {\n annotation = Annotation.create(annotation)\n\n editor.applyOperation({\n type: 'add_annotation',\n annotation,\n })\n}\n\nCommands.removeAnnotation = (editor, annotation) => {\n annotation = Annotation.create(annotation)\n\n editor.applyOperation({\n type: 'remove_annotation',\n annotation,\n })\n}\n\nCommands.setAnnotation = (editor, annotation, newProperties) => {\n annotation = Annotation.create(annotation)\n newProperties = Annotation.createProperties(newProperties)\n\n editor.applyOperation({\n type: 'set_annotation',\n properties: annotation,\n newProperties,\n })\n}\n\nCommands.setAnnotations = (editor, annotations = []) => {\n const { value } = editor\n const newProperties = Value.createProperties({ annotations })\n const prevProperties = pick(value, Object.keys(newProperties))\n\n editor.applyOperation({\n type: 'set_value',\n properties: prevProperties,\n newProperties,\n })\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default Commands\n","/**\n * A plugin that adds a set of queries to the editor.\n *\n * @param {Object} queries\n * @return {Object}\n */\n\nfunction QueriesPlugin(queries = {}) {\n /**\n * On construct, register all the queries.\n *\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onConstruct(editor, next) {\n for (const query in queries) {\n editor.registerQuery(query)\n }\n\n return next()\n }\n\n /**\n * On query, if it exists in our list of queries, call it.\n *\n * @param {Object} query\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onQuery(query, editor, next) {\n const { type, args } = query\n const fn = queries[type]\n if (!fn) return next()\n const ret = fn(editor, ...args)\n return ret === undefined ? next() : ret\n }\n\n /**\n * Return the plugin.\n *\n * @type {Object}\n */\n\n return {\n onConstruct,\n onQuery,\n }\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default QueriesPlugin\n","/**\n * Define a Slate error.\n *\n * @type {SlateError}\n */\n\nclass SlateError extends Error {\n constructor(code, attrs = {}) {\n super(code)\n this.code = code\n\n for (const key in attrs) {\n this[key] = attrs[key]\n }\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor)\n } else {\n this.stack = new Error().stack\n }\n }\n}\n\n/**\n * Export.\n *\n * @type {SlateError}\n */\n\nexport default SlateError\n","import SlateError from '../utils/slate-error'\nimport Queries from './queries'\n\n/**\n * Create a plugin from a `schema` definition.\n *\n * @param {Object} schema\n * @return {Object}\n */\n\nfunction SchemaPlugin(schema) {\n const {\n rules,\n document,\n blocks,\n inlines,\n marks,\n annotations,\n decorations,\n } = schema\n let schemaRules = []\n\n if (rules) {\n schemaRules = schemaRules.concat(rules)\n }\n\n if (document) {\n schemaRules.push({\n match: [{ object: 'document' }],\n ...document,\n })\n }\n\n if (blocks) {\n for (const key in blocks) {\n schemaRules.push({\n match: [{ object: 'block', type: key }],\n ...blocks[key],\n })\n }\n }\n\n if (inlines) {\n for (const key in inlines) {\n schemaRules.push({\n match: [{ object: 'inline', type: key }],\n ...inlines[key],\n })\n }\n }\n\n if (marks) {\n for (const key in marks) {\n schemaRules.push({\n match: [{ object: 'mark', type: key }],\n ...marks[key],\n })\n }\n }\n\n if (annotations) {\n for (const key in annotations) {\n schemaRules.push({\n match: [{ object: 'annotation', type: key }],\n ...annotations[key],\n })\n }\n }\n\n if (decorations) {\n for (const key in decorations) {\n schemaRules.push({\n match: [{ object: 'decoration', type: key }],\n ...decorations[key],\n })\n }\n }\n\n /**\n * Check if a `format` is atomic based on the schema rules.\n *\n * @param {Editor} editor\n * @param {Format} format\n * @return {Boolean}\n */\n\n function isAtomic(editor, format) {\n const rule = schemaRules.find(\n r => 'isAtomic' in r && testRules(format, r.match)\n )\n\n return rule && rule.isAtomic\n }\n\n /**\n * Check if a `node` is void based on the schema rules.\n *\n * @param {Editor} editor\n * @param {Node} node\n * @return {Boolean}\n */\n\n function isVoid(editor, node) {\n const rule = schemaRules.find(\n r => 'isVoid' in r && testRules(node, r.match)\n )\n\n return rule && rule.isVoid\n }\n\n /**\n * Normalize a `node` with the schema rules, returning a function that will\n * fix the invalid node, or void if the node is valid.\n *\n * @param {Node} node\n * @param {Editor} editor\n * @param {Function} next\n * @return {Function|Void}\n */\n\n function normalizeNode(node, editor, next) {\n const error = validateNode(node, editor, () => {})\n if (!error) return next()\n\n return () => {\n const { rule } = error\n const { size } = editor.operations\n\n // First run the user-provided `normalize` function if one exists...\n if (rule.normalize) {\n rule.normalize(editor, error)\n }\n\n // If the `normalize` function did not add any operations to the editor\n // object, it can't have normalized, so run the default one.\n if (editor.operations.size === size) {\n defaultNormalize(editor, error)\n }\n }\n }\n\n /**\n * Validate a `node` with the schema rules, returning a `SlateError` if it's\n * invalid.\n *\n * @param {Node} node\n * @param {Editor} editor\n * @param {Function} next\n * @return {Error|Void}\n */\n\n function validateNode(node, editor, next) {\n const matches = schemaRules.filter(r => testRules(node, r.match))\n const failure = validateRules(node, matches, schemaRules, { every: true })\n if (!failure) return next()\n const error = new SlateError(failure.code, failure)\n return error\n }\n\n /**\n * On schema-related queries, respond if we can.\n *\n * @param {Object} query\n * @param {Function} next\n */\n\n const queries = Queries({ isAtomic, isVoid })\n\n /**\n * Return the plugins.\n *\n * @type {Object}\n */\n\n return [{ normalizeNode, validateNode }, queries]\n}\n\n/**\n * Normalize an invalid value with `error` with default remedies.\n *\n * @param {Editor} editor\n * @param {SlateError} error\n */\n\nfunction defaultNormalize(editor, error) {\n const { code, node, child, next, previous, key, mark } = error\n\n switch (code) {\n case 'child_max_invalid':\n case 'child_object_invalid':\n case 'child_type_invalid':\n case 'child_unknown':\n case 'first_child_object_invalid':\n case 'first_child_type_invalid':\n case 'last_child_object_invalid':\n case 'last_child_type_invalid': {\n return child.object === 'text' &&\n node.object === 'block' &&\n node.nodes.size === 1\n ? editor.removeNodeByKey(node.key)\n : editor.removeNodeByKey(child.key)\n }\n\n case 'previous_sibling_object_invalid':\n case 'previous_sibling_type_invalid': {\n return previous.object === 'text' &&\n node.object === 'block' &&\n node.nodes.size === 1\n ? editor.removeNodeByKey(node.key)\n : editor.removeNodeByKey(previous.key)\n }\n\n case 'next_sibling_object_invalid':\n case 'next_sibling_type_invalid': {\n return next.object === 'text' &&\n node.object === 'block' &&\n node.nodes.size === 1\n ? editor.removeNodeByKey(node.key)\n : editor.removeNodeByKey(next.key)\n }\n\n case 'child_min_invalid':\n case 'node_text_invalid':\n case 'parent_object_invalid':\n case 'parent_type_invalid': {\n return node.object === 'document'\n ? node.nodes.forEach(n => editor.removeNodeByKey(n.key))\n : editor.removeNodeByKey(node.key)\n }\n\n case 'node_data_invalid': {\n return node.data.get(key) === undefined && node.object !== 'document'\n ? editor.removeNodeByKey(node.key)\n : editor.setNodeByKey(node.key, { data: node.data.delete(key) })\n }\n\n case 'node_mark_invalid': {\n return node\n .getTexts()\n .forEach(t => editor.removeMarkByKey(t.key, 0, t.text.length, mark))\n }\n\n default: {\n return editor.removeNodeByKey(node.key)\n }\n }\n}\n\n/**\n * Check that an `object` matches one of a set of `rules`.\n *\n * @param {Mixed} object\n * @param {Object|Array} rules\n * @return {Boolean}\n */\n\nfunction testRules(object, rules) {\n const error = validateRules(object, rules)\n return !error\n}\n\n/**\n * Validate that a `object` matches a `rule` object or array.\n *\n * @param {Mixed} object\n * @param {Object|Array} rule\n * @param {Array|Void} rules\n * @return {Error|Void}\n */\n\nfunction validateRules(object, rule, rules, options = {}) {\n const { every = false, match = null } = options\n\n if (typeof rule === 'function') {\n const valid = rule(object, match)\n return valid ? null : fail('node_invalid', { rule, node: object })\n }\n\n if (Array.isArray(rule)) {\n const array = rule.length ? rule : [{}]\n let first\n\n for (const r of array) {\n const error = validateRules(object, r, rules)\n first = first || error\n if (every && error) return error\n if (!every && !error) return\n }\n\n return first\n }\n\n const error =\n validateObject(object, rule) ||\n validateType(object, rule) ||\n validateData(object, rule) ||\n validateMarks(object, rule) ||\n validateText(object, rule) ||\n validateFirst(object, rule) ||\n validateLast(object, rule) ||\n validateNodes(object, rule, rules)\n\n return error\n}\n\nfunction validateObject(node, rule) {\n if (rule.object == null) return\n if (rule.object === node.object) return\n if (typeof rule.object === 'function' && rule.object(node.object)) return\n return fail('node_object_invalid', { rule, node })\n}\n\nfunction validateType(node, rule) {\n if (rule.type == null) return\n if (rule.type === node.type) return\n if (typeof rule.type === 'function' && rule.type(node.type)) return\n return fail('node_type_invalid', { rule, node })\n}\n\nfunction validateData(node, rule) {\n if (rule.data == null) return\n if (node.data == null) return\n\n if (typeof rule.data === 'function') {\n if (rule.data(node.data)) return\n return fail('node_data_invalid', { rule, node })\n }\n\n for (const key in rule.data) {\n const fn = rule.data[key]\n const value = node.data && node.data.get(key)\n const valid = typeof fn === 'function' ? fn(value) : fn === value\n if (valid) continue\n return fail('node_data_invalid', { rule, node, key, value })\n }\n}\n\nfunction validateMarks(node, rule) {\n if (rule.marks == null) return\n\n const marks =\n node.object === 'text' ? node.marks.toArray() : node.getMarks().toArray()\n\n for (const mark of marks) {\n const valid = rule.marks.some(\n def =>\n typeof def.type === 'function'\n ? def.type(mark.type)\n : def.type === mark.type\n )\n if (valid) continue\n return fail('node_mark_invalid', { rule, node, mark })\n }\n}\n\nfunction validateText(node, rule) {\n if (rule.text == null) return\n const { text } = node\n const valid =\n typeof rule.text === 'function' ? rule.text(text) : rule.text.test(text)\n if (valid) return\n return fail('node_text_invalid', { rule, node, text })\n}\n\nfunction validateFirst(node, rule) {\n if (rule.first == null) return\n const first = node.nodes.first()\n if (!first) return\n const error = validateRules(first, rule.first)\n if (!error) return\n error.rule = rule\n error.node = node\n error.child = first\n error.code = error.code.replace('node_', 'first_child_')\n return error\n}\n\nfunction validateLast(node, rule) {\n if (rule.last == null) return\n const last = node.nodes.last()\n if (!last) return\n const error = validateRules(last, rule.last)\n if (!error) return\n error.rule = rule\n error.node = node\n error.child = last\n error.code = error.code.replace('node_', 'last_child_')\n return error\n}\n\nfunction validateNodes(node, rule, rules = []) {\n if (node.nodes == null) return\n\n const children = node.nodes\n const defs = rule.nodes != null ? rule.nodes.slice() : []\n let count = 0\n let lastCount = 0\n let min = null\n let index = -1\n let def = null\n let max = null\n let child = null\n let previous = null\n let next = null\n\n function nextDef() {\n if (defs.length === 0) return false\n def = defs.shift()\n lastCount = count\n count = 0\n min = def.min || null\n max = def.max || null\n return true\n }\n\n function nextChild() {\n index += 1\n previous = index ? children.get(index - 1) : null\n child = children.get(index)\n next = children.get(index + 1)\n if (!child) return false\n lastCount = count\n count += 1\n return true\n }\n\n function rewind() {\n if (index > 0) {\n index -= 1\n count = lastCount\n }\n }\n\n if (rule.nodes != null) {\n nextDef()\n }\n\n while (nextChild()) {\n const err =\n validateParent(node, child, rules) ||\n validatePrevious(node, child, previous, index, rules) ||\n validateNext(node, child, next, index, rules)\n\n if (err) return err\n\n if (rule.nodes != null) {\n if (!def) {\n return fail('child_unknown', { rule, node, child, index })\n }\n\n if (def.match) {\n const error = validateRules(child, def.match)\n\n if (error) {\n // Since we want to report overflow on last matching child we don't\n // immediately check for count > max, but instead do so once we find\n // a child that doesn't match.\n if (max != null && count - 1 > max) {\n rewind()\n return fail('child_max_invalid', {\n rule,\n node,\n index,\n child: children.get(index),\n count,\n limit: max,\n })\n }\n\n const lastMin = min\n\n // If there are more groups after this one then child might actually\n // be valid.\n if (nextDef()) {\n // If we've already satisfied the minimum for the current group,\n // then we can rewind and proceed to the next group.\n if (lastCount - 1 >= lastMin) {\n index -= 1\n continue\n }\n\n // Otherwise we know that current value is underflowing. There are\n // three possible causes for this...\n\n // 1. There might just not be enough elements for current group, and\n // current child is in fact the first of the next group. If so, the\n // next def will not report errors, in which case we can rewind and\n // report an minimum error.\n if (validateRules(child, def.match) == null) {\n rewind()\n return fail('child_min_invalid', {\n rule,\n node,\n index,\n count: lastCount - 1,\n limit: lastMin,\n })\n }\n\n // 2. The current group is underflowing, but there is also an\n // invalid child before the next group.\n // 3. Or the current group is not underflowing but it appears so\n // because there's an invalid child between its members.\n // It's either the second or third case. If it's the second then\n // we could report an underflow, but presence of an invalid child\n // is arguably more important, so we report it first. It also lets\n // us avoid checking for which case exactly is it.\n error.rule = rule\n error.node = node\n error.child = child\n error.index = index\n error.code = error.code.replace('node_', 'child_')\n return error\n }\n\n // Otherwise either we exhausted the last group, in which case it's\n // an unknown child, ...\n if (max != null && count > max) {\n return fail('child_unknown', { rule, node, child, index })\n }\n\n // ... or it's an invalid child for the last group.\n error.rule = rule\n error.node = node\n error.child = child\n error.index = index\n error.code = error.code.replace('node_', 'child_')\n return error\n }\n }\n }\n }\n\n // Since we want to report overflow on last matching child we don't\n // immediately check for count > max, but do so after processing all nodes.\n if (max != null && count > max) {\n return fail('child_max_invalid', {\n rule,\n node,\n index: index - 1,\n count,\n child: children.get(index - 1),\n limit: max,\n })\n }\n\n if (rule.nodes != null) {\n do {\n if (count < min) {\n return fail('child_min_invalid', {\n rule,\n node,\n index,\n count,\n limit: min,\n })\n }\n } while (nextDef())\n }\n}\n\nfunction validateParent(node, child, rules) {\n for (const rule of rules) {\n if (rule.parent == null) continue\n if (!testRules(child, rule.match)) continue\n\n const error = validateRules(node, rule.parent)\n if (!error) continue\n\n error.rule = rule\n error.parent = node\n error.node = child\n error.code = error.code.replace('node_', 'parent_')\n return error\n }\n}\n\nfunction validatePrevious(node, child, previous, index, rules) {\n if (!previous) return\n\n for (const rule of rules) {\n if (rule.previous == null) continue\n if (!testRules(child, rule.match)) continue\n\n const error = validateRules(previous, rule.previous)\n if (!error) continue\n\n error.rule = rule\n error.node = node\n error.child = child\n error.index = index\n error.previous = previous\n error.code = error.code.replace('node_', 'previous_sibling_')\n return error\n }\n}\n\nfunction validateNext(node, child, next, index, rules) {\n if (!next) return\n\n for (const rule of rules) {\n if (rule.next == null) continue\n if (!testRules(child, rule.match)) continue\n\n const error = validateRules(next, rule.next, [], { match: child })\n if (!error) continue\n\n error.rule = rule\n error.node = node\n error.child = child\n error.index = index\n error.next = next\n error.code = error.code.replace('node_', 'next_sibling_')\n return error\n }\n}\n\n/**\n * Create an interim failure object with `code` and `attrs`.\n *\n * @param {String} code\n * @param {Object} attrs\n * @return {Object}\n */\n\nfunction fail(code, attrs) {\n return { code, ...attrs }\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default SchemaPlugin\n","import Block from '../models/block'\nimport Inline from '../models/inline'\nimport Mark from '../models/mark'\n\n/**\n * Ensure that an expanded selection is deleted first using the `editor.delete`\n * command. This guarantees that it uses the proper semantic \"intent\" instead of\n * using `deleteAtRange` under the covers and skipping `delete`.\n *\n * @param {Editor}\n */\n\nfunction deleteExpanded(editor) {\n const { value } = editor\n const { selection } = value\n\n if (selection.isExpanded) {\n editor.delete()\n }\n}\n\n/**\n * Commands.\n *\n * @type {Object}\n */\n\nconst Commands = {}\n\n/**\n * Add a `mark` to the characters in the current selection.\n *\n * @param {Editor} editor\n * @param {Mark} mark\n */\n\nCommands.addMark = (editor, mark) => {\n mark = Mark.create(mark)\n const { value } = editor\n const { document, selection } = value\n\n if (selection.isExpanded) {\n editor.addMarkAtRange(selection, mark)\n } else if (selection.marks) {\n const marks = selection.marks.add(mark)\n const sel = selection.set('marks', marks)\n editor.select(sel)\n } else {\n const marks = document.getActiveMarksAtRange(selection).add(mark)\n const sel = selection.set('marks', marks)\n editor.select(sel)\n }\n}\n\n/**\n * Add a list of `marks` to the characters in the current selection.\n *\n * @param {Editor} editor\n * @param {Set|Array} marks\n */\n\nCommands.addMarks = (editor, marks) => {\n marks.forEach(mark => editor.addMark(mark))\n}\n\n/**\n * Delete at the current selection.\n *\n * @param {Editor} editor\n */\n\nCommands.delete = editor => {\n const { value } = editor\n const { selection } = value\n editor.deleteAtRange(selection)\n\n // COMPAT: Ensure that the selection is collapsed, because in certain cases\n // when deleting across inline nodes, when splitting the inline node the end\n // point of the selection will end up after the split point.\n editor.moveToFocus()\n}\n\n/**\n * Delete backward `n` characters.\n *\n * @param {Editor} editor\n * @param {Number} n (optional)\n */\n\nCommands.deleteBackward = (editor, n = 1) => {\n const { value } = editor\n const { selection } = value\n\n if (selection.isExpanded) {\n editor.delete()\n } else {\n editor.deleteBackwardAtRange(selection, n)\n }\n}\n\n/**\n * Delete backward one character.\n *\n * @param {Editor} editor\n */\n\nCommands.deleteCharBackward = editor => {\n const { value } = editor\n const { selection } = value\n\n if (selection.isExpanded) {\n editor.delete()\n } else {\n editor.deleteCharBackwardAtRange(selection)\n }\n}\n\n/**\n * Delete backward one line.\n *\n * @param {Editor} editor\n */\n\nCommands.deleteLineBackward = editor => {\n const { value } = editor\n const { selection } = value\n\n if (selection.isExpanded) {\n editor.delete()\n } else {\n editor.deleteLineBackwardAtRange(selection)\n }\n}\n\n/**\n * Delete backward one word.\n *\n * @param {Editor} editor\n */\n\nCommands.deleteWordBackward = editor => {\n const { value } = editor\n const { selection } = value\n\n if (selection.isExpanded) {\n editor.delete()\n } else {\n editor.deleteWordBackwardAtRange(selection)\n }\n}\n\n/**\n * Delete backward `n` characters.\n *\n * @param {Editor} editor\n * @param {Number} n (optional)\n */\n\nCommands.deleteForward = (editor, n = 1) => {\n const { value } = editor\n const { selection } = value\n\n if (selection.isExpanded) {\n editor.delete()\n } else {\n editor.deleteForwardAtRange(selection, n)\n }\n}\n\n/**\n * Delete backward one character.\n *\n * @param {Editor} editor\n */\n\nCommands.deleteCharForward = editor => {\n const { value } = editor\n const { selection } = value\n\n if (selection.isExpanded) {\n editor.delete()\n } else {\n editor.deleteCharForwardAtRange(selection)\n }\n}\n\n/**\n * Delete backward one line.\n *\n * @param {Editor} editor\n */\n\nCommands.deleteLineForward = editor => {\n const { value } = editor\n const { selection } = value\n\n if (selection.isExpanded) {\n editor.delete()\n } else {\n editor.deleteLineForwardAtRange(selection)\n }\n}\n\n/**\n * Delete backward one word.\n *\n * @param {Editor} editor\n */\n\nCommands.deleteWordForward = editor => {\n const { value } = editor\n const { selection } = value\n\n if (selection.isExpanded) {\n editor.delete()\n } else {\n editor.deleteWordForwardAtRange(selection)\n }\n}\n\n/**\n * Insert a `block` at the current selection.\n *\n * @param {Editor} editor\n * @param {String|Object|Block} block\n */\n\nCommands.insertBlock = (editor, block) => {\n deleteExpanded(editor)\n\n block = Block.create(block)\n const { value } = editor\n const { selection } = value\n editor.insertBlockAtRange(selection, block)\n\n // If the node was successfully inserted, update the selection.\n const node = editor.value.document.getNode(block.key)\n if (node) editor.moveToEndOfNode(node)\n}\n\n/**\n * Insert a `fragment` at the current selection.\n *\n * @param {Editor} editor\n * @param {Document} fragment\n */\n\nCommands.insertFragment = (editor, fragment) => {\n if (!fragment.nodes.size) return\n\n deleteExpanded(editor)\n\n let { value } = editor\n let { document, selection } = value\n const { start } = selection\n const keys = Array.from(document.texts(), ([text]) => text.key)\n\n editor.insertFragmentAtRange(selection, fragment)\n value = editor.value\n document = value.document\n\n const newTexts = document.getTexts().filter(n => !keys.includes(n.key))\n if (newTexts.size === 0) return\n const fragmentLength = fragment.text.length\n\n // Either startText is still here, or we want the first un-previously known text\n const startText = document.getNode(start.key) || newTexts.first()\n // We want the last un-previously known text\n let endText = newTexts.last() || startText\n\n if (startText === endText) {\n editor.moveTo(endText.key, fragmentLength)\n return\n }\n\n // Everything will be calculated relative to the first common ancestor to optimize speed\n const parent = document.getCommonAncestor(startText.key, endText.key)\n\n const startOffset =\n parent.getOffset(startText.key) +\n (start.key === startText.key ? start.offset : 0)\n\n // endText might not be the last un-previously known text node, so we precisely pick it by offset\n endText = parent.getTextAtOffset(startOffset + fragmentLength - 1) || endText\n\n editor.moveTo(\n endText.key,\n startOffset + fragmentLength - parent.getOffset(endText.key)\n )\n}\n\n/**\n * Insert an `inline` at the current selection.\n *\n * @param {Editor} editor\n * @param {String|Object|Inline} inline\n */\n\nCommands.insertInline = (editor, inline) => {\n deleteExpanded(editor)\n\n inline = Inline.create(inline)\n const { value } = editor\n const { selection } = value\n editor.insertInlineAtRange(selection, inline)\n\n // If the node was successfully inserted, update the selection.\n const node = editor.value.document.getNode(inline.key)\n if (node) editor.moveToEndOfNode(node)\n}\n\n/**\n * Insert a string of `text` with optional `marks` at the current selection.\n *\n * @param {Editor} editor\n * @param {String} text\n * @param {Set} marks (optional)\n */\n\nCommands.insertText = (editor, text, marks) => {\n deleteExpanded(editor)\n\n const { value } = editor\n const { document, selection } = value\n marks = marks || selection.marks || document.getInsertMarksAtRange(selection)\n\n editor.withoutNormalizing(() => {\n editor.insertTextAtRange(selection, text, marks)\n\n // If the text was successfully inserted, and the selection had marks on it,\n // unset the selection's marks.\n if (selection.marks && document !== editor.value.document) {\n editor.select({ marks: null })\n }\n })\n}\n\n/**\n * Remove a `mark` from the characters in the current selection.\n *\n * @param {Editor} editor\n * @param {Mark} mark\n */\n\nCommands.removeMark = (editor, mark) => {\n mark = Mark.create(mark)\n const { value } = editor\n const { document, selection } = value\n\n if (selection.isExpanded) {\n editor.removeMarkAtRange(selection, mark)\n } else if (selection.marks) {\n const marks = selection.marks.remove(mark)\n const sel = selection.set('marks', marks)\n editor.select(sel)\n } else {\n const marks = document.getActiveMarksAtRange(selection).remove(mark)\n const sel = selection.set('marks', marks)\n editor.select(sel)\n }\n}\n\n/**\n * Replace an `oldMark` with a `newMark` in the characters in the current selection.\n *\n * @param {Editor} editor\n * @param {Mark} oldMark\n * @param {Mark} newMark\n */\n\nCommands.replaceMark = (editor, oldMark, newMark) => {\n editor.removeMark(oldMark)\n editor.addMark(newMark)\n}\n\n/**\n * Set the `properties` of block nodes.\n *\n * @param {Editor} editor\n * @param {Object|String} properties\n */\n\nCommands.setBlocks = (editor, properties) => {\n const { value } = editor\n const { selection } = value\n editor.setBlocksAtRange(selection, properties)\n}\n\n/**\n * Set the `properties` of inline nodes.\n *\n * @param {Editor} editor\n * @param {Object|String} properties\n */\n\nCommands.setInlines = (editor, properties) => {\n const { value } = editor\n const { selection } = value\n editor.setInlinesAtRange(selection, properties)\n}\n\n/**\n * Split the block node at the current selection, to optional `depth`.\n *\n * @param {Editor} editor\n * @param {Number} depth (optional)\n */\n\nCommands.splitBlock = (editor, depth = 1) => {\n deleteExpanded(editor)\n\n const { value } = editor\n const { selection, document } = value\n const marks = selection.marks || document.getInsertMarksAtRange(selection)\n editor.splitBlockAtRange(selection, depth).moveToEnd()\n\n if (marks && marks.size !== 0) {\n editor.select({ marks })\n }\n}\n\n/**\n * Split the inline nodes to optional `height`.\n *\n * @param {Editor} editor\n * @param {Number} height (optional)\n */\n\nCommands.splitInline = (editor, height) => {\n deleteExpanded(editor)\n const { value } = editor\n const { selection } = value\n editor.splitInlineAtRange(selection, height)\n}\n\n/**\n * Add or remove a `mark` from the characters in the current selection,\n * depending on whether it's already there.\n *\n * @param {Editor} editor\n * @param {Mark} mark\n */\n\nCommands.toggleMark = (editor, mark) => {\n mark = Mark.create(mark)\n const { value } = editor\n const exists = value.activeMarks.has(mark)\n\n if (exists) {\n editor.removeMark(mark)\n } else {\n editor.addMark(mark)\n }\n}\n\n/**\n * Unwrap nodes from a block with `properties`.\n *\n * @param {Editor} editor\n * @param {String|Object} properties\n */\n\nCommands.unwrapBlock = (editor, properties) => {\n const { value } = editor\n const { selection } = value\n editor.unwrapBlockAtRange(selection, properties)\n}\n\n/**\n * Unwrap nodes from an inline with `properties`.\n *\n * @param {Editor} editor\n * @param {String|Object} properties\n */\n\nCommands.unwrapInline = (editor, properties) => {\n const { value } = editor\n const { selection } = value\n editor.unwrapInlineAtRange(selection, properties)\n}\n\n/**\n * Wrap nodes in a new `block`.\n *\n * @param {Editor} editor\n * @param {Block|Object|String} block\n */\n\nCommands.wrapBlock = (editor, block) => {\n const { value } = editor\n const { selection } = value\n editor.wrapBlockAtRange(selection, block)\n}\n\n/**\n * Wrap nodes in a new `inline`.\n *\n * @param {Editor} editor\n * @param {Inline|Object|String} inline\n */\n\nCommands.wrapInline = (editor, inline) => {\n const { value } = editor\n const { selection } = value\n editor.wrapInlineAtRange(selection, inline)\n}\n\n/**\n * Wrap the current selection with prefix/suffix.\n *\n * @param {Editor} editor\n * @param {String} prefix\n * @param {String} suffix\n */\n\nCommands.wrapText = (editor, prefix, suffix = prefix) => {\n const { value } = editor\n const { selection } = value\n editor.wrapTextAtRange(selection, prefix, suffix)\n\n // If the selection was collapsed, it will have moved the start offset too.\n if (selection.isCollapsed) {\n editor.moveStartBackward(prefix.length)\n }\n\n // Adding the suffix will have pushed the end of the selection further on, so\n // we need to move it back to account for this.\n editor.moveEndBackward(suffix.length)\n\n // There's a chance that the selection points moved \"through\" each other,\n // resulting in a now-incorrect selection direction.\n if (selection.isForward !== editor.value.selection.isForward) {\n editor.flip()\n }\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default Commands\n","import AtRange from '../commands/at-range'\nimport ByPath from '../commands/by-path'\nimport Commands from './commands'\nimport OnHistory from '../commands/on-history'\nimport OnSelection from '../commands/on-selection'\nimport OnValue from '../commands/on-value'\nimport Queries from './queries'\nimport Schema from './schema'\nimport Text from '../models/text'\nimport WithIntent from '../commands/with-intent'\n\n/**\n * A plugin that defines the core Slate logic.\n *\n * @param {Object} options\n * @return {Object}\n */\n\nfunction CorePlugin(options = {}) {\n const { plugins = [] } = options\n\n /**\n * The core Slate commands.\n *\n * @type {Object}\n */\n\n const commands = Commands({\n ...AtRange,\n ...ByPath,\n ...OnHistory,\n ...OnSelection,\n ...OnValue,\n ...WithIntent,\n })\n\n /**\n * The core Slate queries.\n *\n * @type {Object}\n */\n\n const queries = Queries({\n isAtomic: () => false,\n isVoid: () => false,\n })\n\n /**\n * The core Slate schema.\n *\n * @type {Object}\n */\n\n const schema = Schema({\n rules: [\n // Only allow block nodes in documents.\n {\n match: { object: 'document' },\n nodes: [\n {\n match: { object: 'block' },\n },\n ],\n },\n\n // Only allow block nodes or inline and text nodes in blocks.\n {\n match: {\n object: 'block',\n first: { object: 'block' },\n },\n nodes: [\n {\n match: { object: 'block' },\n },\n ],\n },\n {\n match: {\n object: 'block',\n first: [{ object: 'inline' }, { object: 'text' }],\n },\n nodes: [\n {\n match: [{ object: 'inline' }, { object: 'text' }],\n },\n ],\n },\n\n // Only allow inline and text nodes in inlines.\n {\n match: { object: 'inline' },\n nodes: [{ match: [{ object: 'inline' }, { object: 'text' }] }],\n },\n\n // Ensure that block and inline nodes have at least one text child.\n {\n match: [{ object: 'block' }, { object: 'inline' }],\n nodes: [{ min: 1 }],\n normalize: (editor, error) => {\n const { code, node } = error\n\n if (code === 'child_min_invalid' && node.nodes.isEmpty()) {\n editor.insertNodeByKey(node.key, 0, Text.create())\n }\n },\n },\n\n // Ensure that inline nodes are surrounded by text nodes.\n {\n match: { object: 'block' },\n first: [{ object: 'block' }, { object: 'text' }],\n last: [{ object: 'block' }, { object: 'text' }],\n normalize: (editor, error) => {\n const { code, node } = error\n const text = Text.create()\n let i\n\n if (code === 'first_child_object_invalid') {\n i = 0\n } else if (code === 'last_child_object_invalid') {\n i = node.nodes.size\n } else {\n return\n }\n\n editor.insertNodeByKey(node.key, i, text)\n },\n },\n {\n match: { object: 'inline' },\n first: [{ object: 'block' }, { object: 'text' }],\n last: [{ object: 'block' }, { object: 'text' }],\n previous: [{ object: 'block' }, { object: 'text' }],\n next: [{ object: 'block' }, { object: 'text' }],\n normalize: (editor, error) => {\n const { code, node, index } = error\n const text = Text.create()\n let i\n\n if (code === 'first_child_object_invalid') {\n i = 0\n } else if (code === 'last_child_object_invalid') {\n i = node.nodes.size\n } else if (code === 'previous_sibling_object_invalid') {\n i = index\n } else if (code === 'next_sibling_object_invalid') {\n i = index + 1\n } else {\n return\n }\n\n editor.insertNodeByKey(node.key, i, text)\n },\n },\n\n // Merge adjacent text nodes with the same marks.\n {\n match: { object: 'text' },\n next: (next, match) => {\n return next.object !== 'text' || !match.marks.equals(next.marks)\n },\n normalize: (editor, error) => {\n const { code, next } = error\n\n if (code === 'next_sibling_invalid') {\n editor.mergeNodeByKey(next.key)\n }\n },\n },\n\n // Remove extra adjacent empty text nodes.\n {\n match: { object: 'text' },\n previous: prev => {\n return prev.object !== 'text' || prev.text !== ''\n },\n next: next => {\n return next.object !== 'text' || next.text !== ''\n },\n normalize: (editor, error) => {\n const { code, next, previous } = error\n\n if (code === 'next_sibling_invalid') {\n editor.removeNodeByKey(next.key)\n } else if (code === 'previous_sibling_invalid') {\n editor.removeNodeByKey(previous.key)\n }\n },\n },\n ],\n })\n\n /**\n * Return the plugins.\n *\n * @type {Array}\n */\n\n return [schema, ...plugins, commands, queries]\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default CorePlugin\n","import Debug from 'debug'\nimport invariant from 'tiny-invariant'\nimport isPlainObject from 'is-plain-object'\nimport warning from 'tiny-warning'\nimport { List } from 'immutable'\n\nimport CommandsPlugin from '../plugins/commands'\nimport CorePlugin from '../plugins/core'\nimport Operation from '../models/operation'\nimport PathUtils from '../utils/path-utils'\nimport QueriesPlugin from '../plugins/queries'\nimport SchemaPlugin from '../plugins/schema'\nimport Value from '../models/value'\n\n/**\n * Debug.\n *\n * @type {Function}\n */\n\nconst debug = Debug('slate:editor')\n\n/**\n * Editor.\n *\n * @type {Editor}\n */\n\nclass Editor {\n /**\n * Create a new `Editor` with `attrs`.\n *\n * @param {Object} attrs\n * @param {Object} options\n */\n\n constructor(attrs = {}, options = {}) {\n const { controller = this, construct = true } = options\n const {\n onChange = () => {},\n plugins = [],\n readOnly = false,\n value = Value.create(),\n } = attrs\n\n this.controller = controller\n this.middleware = {}\n this.onChange = onChange\n this.operations = List()\n this.readOnly = null\n this.value = null\n\n this.tmp = {\n dirty: [],\n flushing: false,\n merge: null,\n normalize: true,\n save: true,\n }\n\n const core = CorePlugin({ plugins })\n registerPlugin(this, core)\n\n if (construct) {\n this.run('onConstruct')\n this.setReadOnly(readOnly)\n this.setValue(value, options)\n }\n }\n\n /**\n * Apply an `operation` to the editor, updating its value.\n *\n * @param {Operation|Object} operation\n * @return {Editor}\n */\n\n applyOperation(operation) {\n const { operations, controller } = this\n let value = this.value\n\n // Add in the current `value` in case the operation was serialized.\n if (isPlainObject(operation)) {\n operation = { ...operation, value }\n }\n\n operation = Operation.create(operation)\n\n // Save the operation into the history. Since `save` is a command, we need\n // to do it without normalizing, since it would have side effects.\n this.withoutNormalizing(() => {\n controller.save(operation)\n value = this.value\n })\n\n // Apply the operation to the value.\n debug('apply', { operation })\n this.value = operation.apply(value)\n this.operations = operations.push(operation)\n\n // Get the paths of the affected nodes, and mark them as dirty.\n const newDirtyPaths = getDirtyPaths(operation)\n\n const dirty = this.tmp.dirty.map(path => {\n path = PathUtils.create(path)\n const transformed = PathUtils.transform(path, operation)\n return transformed.toArray()\n })\n\n const pathIndex = {}\n const dirtyPaths = Array.prototype.concat.apply(newDirtyPaths, dirty)\n this.tmp.dirty = []\n\n // PERF: De-dupe the paths so we don't do extra normalization.\n dirtyPaths.forEach(dirtyPath => {\n const key = dirtyPath.join(',')\n\n if (!pathIndex[key]) {\n this.tmp.dirty.push(dirtyPath)\n }\n\n pathIndex[key] = true\n })\n\n // If we're not already, queue the flushing process on the next tick.\n if (!this.tmp.flushing) {\n this.tmp.flushing = true\n Promise.resolve().then(() => this.flush())\n }\n\n return controller\n }\n\n /**\n * Flush the editor's current change.\n *\n * @return {Editor}\n */\n\n flush() {\n this.run('onChange')\n const { value, operations, controller } = this\n const change = { value, operations }\n this.operations = List()\n this.tmp.flushing = false\n this.onChange(change)\n return controller\n }\n\n /**\n * Trigger a command by `type` with `...args`.\n *\n * @param {String|Function} type\n * @param {Any} ...args\n * @return {Editor}\n */\n\n command(type, ...args) {\n const { controller } = this\n\n if (typeof type === 'function') {\n type(controller, ...args)\n normalizeDirtyPaths(this)\n return controller\n }\n\n debug('command', { type, args })\n const obj = { type, args }\n this.run('onCommand', obj)\n normalizeDirtyPaths(this)\n return controller\n }\n\n /**\n * Checks if a command by `type` has been registered.\n *\n * @param {String} type\n * @return {Boolean}\n */\n\n hasCommand(type) {\n const { controller } = this\n const has = type in controller && controller[type].__command\n\n return has\n }\n\n /**\n * Checks if a query by `type` has been registered.\n *\n * @param {String} type\n * @return {Boolean}\n */\n\n hasQuery(type) {\n const { controller } = this\n const has = type in controller && controller[type].__query\n\n return has\n }\n\n /**\n * Normalize all of the nodes in the document from scratch.\n *\n * @return {Editor}\n */\n\n normalize() {\n const { value, controller } = this\n let { document } = value\n const table = document.getKeysToPathsTable()\n const paths = Object.values(table).map(PathUtils.create)\n this.tmp.dirty = this.tmp.dirty.concat(paths)\n normalizeDirtyPaths(this)\n\n const { selection } = value\n document = value.document\n\n if (selection.isUnset && document.nodes.size) {\n controller.moveToStartOfDocument()\n }\n\n return controller\n }\n\n /**\n * Ask a query by `type` with `...args`.\n *\n * @param {String|Function} type\n * @param {Any} ...args\n * @return {Any}\n */\n\n query(type, ...args) {\n const { controller } = this\n\n if (typeof type === 'function') {\n return type(controller, ...args)\n }\n\n debug('query', { type, args })\n const obj = { type, args }\n return this.run('onQuery', obj)\n }\n\n /**\n * Register a command `type` with the editor.\n *\n * @param {String} type\n * @return {Editor}\n */\n\n registerCommand(type) {\n const { controller } = this\n\n if (type in controller && controller[type].__command) {\n return controller\n }\n\n invariant(\n !(type in controller),\n `You cannot register a \\`${type}\\` command because it would overwrite an existing property of the \\`Editor\\`.`\n )\n\n const method = (...args) => this.command(type, ...args)\n controller[type] = method\n method.__command = true\n return controller\n }\n\n /**\n * Register a query `type` with the editor.\n *\n * @param {String} type\n * @return {Editor}\n */\n\n registerQuery(type) {\n const { controller } = this\n\n if (type in controller && controller[type].__query) {\n return controller\n }\n\n invariant(\n !(type in controller),\n `You cannot register a \\`${type}\\` query because it would overwrite an existing property of the \\`Editor\\`.`\n )\n\n const method = (...args) => this.query(type, ...args)\n controller[type] = method\n method.__query = true\n return controller\n }\n\n /**\n * Run through the middleware stack by `key` with `args`.\n *\n * @param {String} key\n * @param {Any} ...args\n * @return {Any}\n */\n\n run(key, ...args) {\n const { controller, middleware } = this\n const fns = middleware[key] || []\n let i = 0\n\n function next(...overrides) {\n const fn = fns[i++]\n if (!fn) return\n\n if (overrides.length) {\n args = overrides\n }\n\n const ret = fn(...args, controller, next)\n return ret\n }\n\n Object.defineProperty(next, 'change', {\n get() {\n invariant(\n false,\n 'As of Slate 0.42, the `editor` is no longer passed as the third argument to event handlers. You can access it via `change.editor` instead.'\n )\n },\n })\n\n Object.defineProperty(next, 'onChange', {\n get() {\n invariant(\n false,\n 'As of Slate 0.42, the `editor` is no longer passed as the third argument to event handlers. You can access it via `change.editor` instead.'\n )\n },\n })\n\n Object.defineProperty(next, 'props', {\n get() {\n invariant(\n false,\n 'As of Slate 0.42, the `editor` is no longer passed as the third argument to event handlers. You can access it via `change.editor` instead.'\n )\n },\n })\n\n Object.defineProperty(next, 'schema', {\n get() {\n invariant(\n false,\n 'As of Slate 0.42, the `editor` is no longer passed as the third argument to event handlers. You can access it via `change.editor` instead.'\n )\n },\n })\n\n Object.defineProperty(next, 'stack', {\n get() {\n invariant(\n false,\n 'As of Slate 0.42, the `editor` is no longer passed as the third argument to event handlers. You can access it via `change.editor` instead.'\n )\n },\n })\n\n return next()\n }\n\n /**\n * Set the `readOnly` flag.\n *\n * @param {Boolean} readOnly\n * @return {Editor}\n */\n\n setReadOnly(readOnly) {\n this.readOnly = readOnly\n return this\n }\n\n /**\n * Set the editor's `value`.\n *\n * @param {Value} value\n * @param {Options} options\n * @return {Editor}\n */\n\n setValue(value, options = {}) {\n const { normalize = value !== this.value } = options\n this.value = value\n\n if (normalize) {\n this.normalize()\n }\n\n return this\n }\n\n /**\n * Apply a series of changes inside a synchronous `fn`, deferring\n * normalization until after the function has finished executing.\n *\n * @param {Function} fn\n * @return {Editor}\n */\n\n withoutNormalizing(fn) {\n const { controller } = this\n const value = this.tmp.normalize\n this.tmp.normalize = false\n fn(controller)\n this.tmp.normalize = value\n normalizeDirtyPaths(this)\n return controller\n }\n\n /**\n * Deprecated.\n */\n\n get editor() {\n warning(\n false,\n \"As of Slate 0.43 the `change` object has been replaced with `editor`, so you don't need to access `change.editor`.\"\n )\n\n return this.controller\n }\n\n change(fn, ...args) {\n warning(\n false,\n 'As of Slate 0.43 the `change` object has been replaced with `editor`, so the `editor.change()` method is deprecated.`'\n )\n\n fn(this.controller, ...args)\n }\n\n call(fn, ...args) {\n warning(\n false,\n 'As of Slate 0.43 the `editor.call(fn)` method has been deprecated, please use `editor.command(fn)` instead.'\n )\n\n fn(this.controller, ...args)\n return this.controller\n }\n\n applyOperations(operations) {\n warning(\n false,\n 'As of Slate 0.43 the `applyOperations` method is deprecated, please apply each operation in a loop instead.'\n )\n\n operations.forEach(op => this.applyOperation(op))\n return this.controller\n }\n\n setOperationFlag(key, value) {\n warning(\n false,\n 'As of slate@0.41 the `change.setOperationFlag` method has been deprecated.'\n )\n\n this.tmp[key] = value\n return this\n }\n\n getFlag(key, options = {}) {\n warning(\n false,\n 'As of slate@0.41 the `change.getFlag` method has been deprecated.'\n )\n\n return options[key] !== undefined ? options[key] : this.tmp[key]\n }\n\n unsetOperationFlag(key) {\n warning(\n false,\n 'As of slate@0.41 the `change.unsetOperationFlag` method has been deprecated.'\n )\n\n delete this.tmp[key]\n return this\n }\n\n withoutNormalization(fn) {\n warning(\n false,\n 'As of slate@0.41 the `change.withoutNormalization` helper has been renamed to `change.withoutNormalizing`.'\n )\n\n return this.withoutNormalizing(fn)\n }\n}\n\n/**\n * Get the \"dirty\" paths for a given `operation`.\n *\n * @param {Operation} operation\n * @return {Array}\n */\n\nfunction getDirtyPaths(operation) {\n const { type, node, path, newPath } = operation\n\n switch (type) {\n case 'add_mark':\n case 'insert_text':\n case 'remove_mark':\n case 'remove_text':\n case 'set_mark':\n case 'set_node': {\n const ancestors = PathUtils.getAncestors(path).toArray()\n return [...ancestors, path]\n }\n\n case 'insert_node': {\n const table = node.getKeysToPathsTable()\n const paths = Object.values(table).map(p => path.concat(p))\n const ancestors = PathUtils.getAncestors(path).toArray()\n return [...ancestors, path, ...paths]\n }\n\n case 'split_node': {\n const ancestors = PathUtils.getAncestors(path).toArray()\n const nextPath = PathUtils.increment(path)\n return [...ancestors, path, nextPath]\n }\n\n case 'merge_node': {\n const ancestors = PathUtils.getAncestors(path).toArray()\n const previousPath = PathUtils.decrement(path)\n return [...ancestors, previousPath]\n }\n\n case 'move_node': {\n if (PathUtils.isEqual(path, newPath)) {\n return []\n }\n\n const oldAncestors = PathUtils.getAncestors(path).reduce((arr, p) => {\n arr.push(...PathUtils.transform(p, operation).toArray())\n return arr\n }, [])\n\n const newAncestors = PathUtils.getAncestors(newPath).reduce((arr, p) => {\n arr.push(...PathUtils.transform(p, operation).toArray())\n return arr\n }, [])\n\n return [...oldAncestors, ...newAncestors]\n }\n\n case 'remove_node': {\n const ancestors = PathUtils.getAncestors(path).toArray()\n return [...ancestors]\n }\n\n default: {\n return []\n }\n }\n}\n\n/**\n * Normalize any new \"dirty\" paths that have been added to the change.\n *\n * @param {Editor}\n */\n\nfunction normalizeDirtyPaths(editor) {\n if (!editor.tmp.normalize) {\n return\n }\n\n if (!editor.tmp.dirty.length) {\n return\n }\n\n editor.withoutNormalizing(() => {\n while (editor.tmp.dirty.length) {\n const path = editor.tmp.dirty.pop()\n normalizeNodeByPath(editor, path)\n }\n })\n}\n\n/**\n * Normalize the node at a specific `path`.\n *\n * @param {Editor} editor\n * @param {Array} path\n */\n\nfunction normalizeNodeByPath(editor, path) {\n const { controller } = editor\n let { value } = editor\n let { document } = value\n let node = document.assertNode(path)\n let iterations = 0\n const max = 100 + (node.object === 'text' ? 1 : node.nodes.size)\n\n while (node) {\n const fn = node.normalize(controller)\n\n if (!fn) {\n break\n }\n\n // Run the normalize `fn` to fix the node.\n fn(controller)\n\n // Attempt to re-find the node by path, or by key if it has changed\n // locations in the tree continue iterating.\n value = editor.value\n document = value.document\n const { key } = node\n let found = document.getDescendant(path)\n\n if (found && found.key === key) {\n node = found\n } else {\n found = document.getDescendant(key)\n\n if (found) {\n node = found\n path = document.getPath(key)\n } else {\n // If it no longer exists by key, it was removed, so we're done.\n break\n }\n }\n\n // Increment the iterations counter, and check to make sure that we haven't\n // exceeded the max. Without this check, it's easy for the `normalize`\n // function of a schema rule to be written incorrectly and for an infinite\n // invalid loop to occur.\n iterations++\n\n if (iterations > max) {\n throw new Error(\n 'A schema rule could not be normalized after sufficient iterations. This is usually due to a `rule.normalize` or `plugin.normalizeNode` function of a schema being incorrectly written, causing an infinite loop.'\n )\n }\n }\n}\n\n/**\n * Register a `plugin` with the editor.\n *\n * @param {Editor} editor\n * @param {Object|Array|Null} plugin\n */\n\nfunction registerPlugin(editor, plugin) {\n if (Array.isArray(plugin)) {\n plugin.forEach(p => registerPlugin(editor, p))\n return\n }\n\n if (plugin == null) {\n return\n }\n\n const { commands, queries, schema, ...rest } = plugin\n\n if (commands) {\n const commandsPlugin = CommandsPlugin(commands)\n registerPlugin(editor, commandsPlugin)\n }\n\n if (queries) {\n const queriesPlugin = QueriesPlugin(queries)\n registerPlugin(editor, queriesPlugin)\n }\n\n if (schema) {\n const schemaPlugin = SchemaPlugin(schema)\n registerPlugin(editor, schemaPlugin)\n }\n\n for (const key in rest) {\n const fn = rest[key]\n const middleware = (editor.middleware[key] = editor.middleware[key] || [])\n middleware.push(fn)\n }\n}\n\n/**\n * Export.\n *\n * @type {Editor}\n */\n\nexport default Editor\n","import isPlainObject from 'is-plain-object'\nimport warning from 'tiny-warning'\nimport { List, Record, Set } from 'immutable'\n\nimport Mark from './mark'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n marks: undefined,\n text: undefined,\n}\n\n/**\n * Leaf.\n *\n * @type {Leaf}\n */\n\nclass Leaf extends Record(DEFAULTS) {\n /**\n * Create a new `Leaf` with `attrs`.\n *\n * @param {Object|Leaf} attrs\n * @return {Leaf}\n */\n\n static create(attrs = {}) {\n warning(false, 'As of slate@0.47 the `Leaf` model is deprecated.')\n\n if (Leaf.isLeaf(attrs)) {\n return attrs\n }\n\n if (typeof attrs === 'string') {\n attrs = { text: attrs }\n }\n\n if (isPlainObject(attrs)) {\n return Leaf.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Leaf.create\\` only accepts objects, strings or leaves, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a valid List of `Leaf` from `leaves`\n *\n * @param {List} leaves\n * @return {List}\n */\n\n static createLeaves(leaves) {\n if (leaves.size <= 1) return leaves\n\n let invalid = false\n\n // TODO: we can make this faster with [List] and then flatten\n const result = List().withMutations(cache => {\n // Search from the leaves left end to find invalid node;\n leaves.findLast((leaf, index) => {\n const firstLeaf = cache.first()\n\n // If the first leaf of cache exist, check whether the first leaf is connectable with the current leaf\n if (firstLeaf) {\n // If marks equals, then the two leaves can be connected\n if (firstLeaf.marks.equals(leaf.marks)) {\n invalid = true\n cache.set(0, firstLeaf.set('text', `${leaf.text}${firstLeaf.text}`))\n return\n }\n\n // If the cached leaf is empty, drop the empty leaf with the upcoming leaf\n if (firstLeaf.text === '') {\n invalid = true\n cache.set(0, leaf)\n return\n }\n\n // If the current leaf is empty, drop the leaf\n if (leaf.text === '') {\n invalid = true\n return\n }\n }\n\n cache.unshift(leaf)\n })\n })\n\n if (!invalid) return leaves\n return result\n }\n\n /**\n * Split a list of leaves to two lists; if the leaves are valid leaves, the returned leaves are also valid\n * Corner Cases:\n * 1. if offset is smaller than 0, then return [List(), leaves]\n * 2. if offset is bigger than the text length, then return [leaves, List()]\n *\n * @param {List leaves\n * @return {Array>}\n */\n\n static splitLeaves(leaves, offset) {\n if (offset < 0) return [List(), leaves]\n\n if (leaves.size === 0) {\n return [List(), List()]\n }\n\n let endOffset = 0\n let index = -1\n let left, right\n\n leaves.find(leaf => {\n index++\n const startOffset = endOffset\n const { text } = leaf\n endOffset += text.length\n\n if (endOffset < offset) return false\n if (startOffset > offset) return false\n\n const length = offset - startOffset\n left = leaf.set('text', text.slice(0, length))\n right = leaf.set('text', text.slice(length))\n return true\n })\n\n if (!left) return [leaves, List()]\n\n if (left.text === '') {\n if (index === 0) {\n return [List.of(left), leaves]\n }\n\n return [leaves.take(index), leaves.skip(index)]\n }\n\n if (right.text === '') {\n if (index === leaves.size - 1) {\n return [leaves, List.of(right)]\n }\n\n return [leaves.take(index + 1), leaves.skip(index + 1)]\n }\n\n return [\n leaves.take(index).push(left),\n leaves.skip(index + 1).unshift(right),\n ]\n }\n\n /**\n * Create a `Leaf` list from `attrs`.\n *\n * @param {Array|List} attrs\n * @return {List}\n */\n\n static createList(attrs = []) {\n if (List.isList(attrs) || Array.isArray(attrs)) {\n const list = new List(attrs.map(Leaf.create))\n return list\n }\n\n throw new Error(\n `\\`Leaf.createList\\` only accepts arrays or lists, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `Leaf` from a JSON `object`.\n *\n * @param {Object} object\n * @return {Leaf}\n */\n\n static fromJSON(object) {\n const { text = '', marks = [] } = object\n\n const leaf = new Leaf({\n text,\n marks: Set(marks.map(Mark.fromJSON)),\n })\n\n return leaf\n }\n\n /**\n * Check if `any` is a list of leaves.\n *\n * @param {Any} any\n * @return {Boolean}\n */\n\n static isLeafList(any) {\n return List.isList(any) && any.every(item => Leaf.isLeaf(item))\n }\n\n /**\n * Update a `mark` at leaf, replace with newMark\n *\n * @param {Mark} mark\n * @param {Mark} newMark\n * @returns {Leaf}\n */\n\n updateMark(mark, newMark) {\n const { marks } = this\n if (newMark.equals(mark)) return this\n if (!marks.has(mark)) return this\n const newMarks = marks.withMutations(collection => {\n collection.remove(mark).add(newMark)\n })\n return this.set('marks', newMarks)\n }\n\n /**\n * Add a `mark` to the leaf.\n *\n * @param {Mark} mark\n * @returns {Text}\n */\n\n addMark(mark) {\n const { marks } = this\n return this.set('marks', marks.add(mark))\n }\n\n /**\n * Add a `set` of marks to the leaf.\n *\n * @param {Set} set\n * @returns {Text}\n */\n\n addMarks(set) {\n const { marks } = this\n return this.set('marks', marks.union(set))\n }\n\n /**\n * Insert a text `string` into the leaf at `offset`.\n *\n * @param {Number} offset\n * @param {String} string\n * @return {Leaf}\n */\n\n insertText(offset, string) {\n const { text } = this\n const next = text.slice(0, offset) + string + text.slice(offset)\n return this.set('text', next)\n }\n\n /**\n * Remove a `mark` from the leaf.\n *\n * @param {Mark} mark\n * @returns {Text}\n */\n\n removeMark(mark) {\n const { marks } = this\n return this.set('marks', marks.remove(mark))\n }\n\n /**\n * Return a JSON representation of the leaf.\n *\n * @return {Object}\n */\n\n toJSON() {\n const object = {\n object: this.object,\n text: this.text,\n marks: this.marks.toArray().map(m => m.toJSON()),\n }\n\n return object\n }\n}\n\n/**\n * Export.\n *\n * @type {Leaf}\n */\n\nexport default Leaf\n","/**\n * Mix in an `Interface` to a `Class`.\n *\n * @param {Class} Interface\n * @param {Class} Class\n */\n\nexport default function mixin(Interface, Classes) {\n for (const Class of Classes) {\n // Copy static properties from the interface.\n for (const name of Object.getOwnPropertyNames(Interface)) {\n if (Class.hasOwnProperty(name)) continue\n const desc = Object.getOwnPropertyDescriptor(Interface, name)\n Object.defineProperty(Class, name, desc)\n }\n\n // Copy instance properties from the interface.\n for (const name of Object.getOwnPropertyNames(Interface.prototype)) {\n if (Class.prototype.hasOwnProperty(name)) continue\n const desc = Object.getOwnPropertyDescriptor(Interface.prototype, name)\n Object.defineProperty(Class.prototype, name, desc)\n }\n }\n}\n","import Annotation from '../models/annotation'\nimport Block from '../models/block'\nimport Change from '../models/change'\nimport Decoration from '../models/decoration'\nimport Document from '../models/document'\nimport Editor from '../controllers/editor'\nimport Inline from '../models/inline'\nimport Leaf from '../models/leaf'\nimport Mark from '../models/mark'\nimport Node from '../models/node'\nimport Operation from '../models/operation'\nimport Point from '../models/point'\nimport Range from '../models/range'\nimport Selection from '../models/selection'\nimport Text from '../models/text'\nimport Value from '../models/value'\nimport isObject, { TYPES } from '../utils/is-object'\nimport mixin from '../utils/mixin'\n\n/**\n * A factory for the interface that all Slate objects implement.\n *\n * @type {Function}\n */\n\nfunction create(type) {\n const TYPE = TYPES[type]\n const camel = `${type.charAt(0).toUpperCase()}${type.slice(1)}`\n const is = `is${camel}`\n\n class ObjectInterface {\n /**\n * Return the type of the object.\n *\n * @return {String}\n */\n\n get object() {\n return type\n }\n }\n\n ObjectInterface[is] = isObject.bind(null, type)\n ObjectInterface.prototype[TYPE] = true\n return ObjectInterface\n}\n\n/**\n * Mix in the object interfaces.\n */\n\nObject.entries({\n Annotation,\n Block,\n Change,\n Decoration,\n Document,\n Editor,\n Inline,\n Leaf,\n Mark,\n Node,\n Operation,\n Point,\n Range,\n Selection,\n Text,\n Value,\n}).forEach(([camel, obj]) => mixin(create(camel.toLowerCase()), [obj]))\n","import mixin from '../utils/mixin'\nimport Annotation from '../models/annotation'\nimport Block from '../models/block'\nimport Decoration from '../models/decoration'\nimport Document from '../models/document'\nimport Inline from '../models/inline'\nimport Leaf from '../models/leaf'\nimport Mark from '../models/mark'\nimport Node from '../models/node'\nimport Operation from '../models/operation'\nimport Point from '../models/point'\nimport Range from '../models/range'\nimport Selection from '../models/selection'\nimport Text from '../models/text'\nimport Value from '../models/value'\n\n/**\n * The interface that all Slate models implement.\n *\n * @type {Class}\n */\n\nclass ModelInterface {\n /**\n * Alias `fromJS`.\n */\n\n static fromJS(...args) {\n return this.fromJSON(...args)\n }\n\n /**\n * Alias `toJS`.\n */\n\n toJS(...args) {\n return this.toJSON(...args)\n }\n}\n\n/**\n * Mix in the common interface.\n *\n * @param {Record}\n */\n\nmixin(ModelInterface, [\n Annotation,\n Block,\n Decoration,\n Document,\n Inline,\n Leaf,\n Mark,\n Node,\n Operation,\n Point,\n Range,\n Selection,\n Text,\n Value,\n])\n","/* global WeakMap, Map, Symbol */\n\n/**\n * GLOBAL: True if memoization should is enabled.\n *\n * @type {Boolean}\n */\n\nlet ENABLED = true\n\n/**\n * The leaf node of a cache tree. Used to support variable argument length. A\n * unique object, so that native Maps will key it by reference.\n *\n * @type {Symbol}\n */\n\nconst LEAF = Symbol('LEAF')\n\n/**\n * The node of a cache tree for a WeakMap to store cache visited by objects\n *\n * @type {Symbol}\n */\n\nconst STORE_KEY = Symbol('STORE_KEY')\n\n/**\n * Values to represent a memoized undefined and null value. Allows efficient value\n * retrieval using Map.get only.\n *\n * @type {Symbol}\n */\n\nconst UNDEFINED = Symbol('undefined')\nconst NULL = Symbol('null')\n\n/**\n * Default value for unset keys in native Maps\n *\n * @type {Undefined}\n */\n\nconst UNSET = undefined\n\n/**\n * Global Store for all cached values\n *\n * @type {WeakMap}\n */\n\nlet memoizeStore = new WeakMap()\n\n/**\n * Memoize all of the `properties` on a `object`.\n *\n * @param {Object} object\n * @param {Array} properties\n * @return {Record}\n */\n\nfunction memoize(object, properties) {\n for (const property of properties) {\n const original = object[property]\n\n if (!original) {\n throw new Error(`Object does not have a property named \"${property}\".`)\n }\n\n object[property] = function(...args) {\n // If memoization is disabled, call into the original method.\n if (!ENABLED) return original.apply(this, args)\n\n if (!memoizeStore.has(this)) {\n memoizeStore.set(this, {\n noArgs: {},\n hasArgs: {},\n })\n }\n\n const { noArgs, hasArgs } = memoizeStore.get(this)\n\n const takesArguments = args.length !== 0\n\n let cachedValue\n let keys\n\n if (takesArguments) {\n keys = [property, ...args]\n cachedValue = getIn(hasArgs, keys)\n } else {\n cachedValue = noArgs[property]\n }\n\n // If we've got a result already, return it.\n if (cachedValue !== UNSET) {\n return cachedValue === UNDEFINED ? undefined : cachedValue\n }\n\n // Otherwise calculate what it should be once and cache it.\n const value = original.apply(this, args)\n const v = value === undefined ? UNDEFINED : value\n\n if (takesArguments) {\n setIn(hasArgs, keys, v)\n } else {\n noArgs[property] = v\n }\n\n return value\n }\n }\n}\n\n/**\n * Get a value at a key path in a tree of Map.\n *\n * If not set, returns UNSET.\n * If the set value is undefined, returns UNDEFINED.\n *\n * @param {Map} map\n * @param {Array} keys\n * @return {Any|UNSET|UNDEFINED}\n */\n\nfunction getIn(map, keys) {\n for (let key of keys) {\n if (key === undefined) {\n key = UNDEFINED\n } else if (key == null) {\n key = NULL\n }\n\n if (typeof key === 'object') {\n map = map[STORE_KEY] && map[STORE_KEY].get(key)\n } else {\n map = map[key]\n }\n\n if (map === UNSET) return UNSET\n }\n\n return map[LEAF]\n}\n\n/**\n * Set a value at a key path in a tree of Map, creating Maps on the go.\n *\n * @param {Map} map\n * @param {Array} keys\n * @param {Any} value\n * @return {Map}\n */\n\nfunction setIn(map, keys, value) {\n let child = map\n\n for (let key of keys) {\n if (key === undefined) {\n key = UNDEFINED\n } else if (key == null) {\n key = NULL\n }\n\n if (typeof key !== 'object') {\n if (!child[key]) {\n child[key] = {}\n }\n\n child = child[key]\n continue\n }\n\n if (!child[STORE_KEY]) {\n child[STORE_KEY] = new WeakMap()\n }\n\n if (!child[STORE_KEY].has(key)) {\n const newChild = {}\n child[STORE_KEY].set(key, newChild)\n child = newChild\n continue\n }\n\n child = child[STORE_KEY].get(key)\n }\n\n // The whole path has been created, so set the value to the bottom most map.\n child[LEAF] = value\n return map\n}\n\n/**\n * In DEV mode, clears the previously memoized values, globally.\n *\n * @return {Void}\n */\n\nfunction resetMemoization() {\n memoizeStore = new WeakMap()\n}\n\n/**\n * In DEV mode, enable or disable the use of memoize values, globally.\n *\n * @param {Boolean} enabled\n * @return {Void}\n */\n\nfunction useMemoization(enabled) {\n ENABLED = enabled\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default memoize\nexport { resetMemoization, useMemoization }\n","import warning from 'tiny-warning'\nimport { List } from 'immutable'\n\nimport mixin from '../utils/mixin'\nimport Block from '../models/block'\nimport Document from '../models/document'\nimport Inline from '../models/inline'\nimport Node from '../models/node'\nimport KeyUtils from '../utils/key-utils'\nimport memoize from '../utils/memoize'\nimport PathUtils from '../utils/path-utils'\nimport Text from '../models/text'\n\n/**\n * The interface that `Document`, `Block` and `Inline` all implement, to make\n * working with the recursive node tree easier.\n *\n * @type {Class}\n */\n\nclass NodeInterface {\n /**\n * Get the first text node of a node, or the node itself.\n *\n * @return {Node|Null}\n */\n\n getFirstText() {\n if (this.object === 'text') {\n return this\n }\n\n let descendant = null\n\n const found = this.nodes.find(node => {\n if (node.object === 'text') return true\n descendant = node.getFirstText()\n return !!descendant\n })\n\n return descendant || found\n }\n\n /**\n * Get an object mapping all the keys in the node to their paths.\n *\n * @return {Object}\n */\n\n getKeysToPathsTable() {\n const ret = {\n [this.key]: [],\n }\n\n if (this.nodes) {\n this.nodes.forEach((node, i) => {\n const nested = node.getKeysToPathsTable()\n\n for (const key in nested) {\n const path = nested[key]\n\n warning(\n !(key in ret),\n `A node with a duplicate key of \"${key}\" was found! Duplicate keys are not allowed, you should use \\`node.regenerateKey\\` before inserting if you are reusing an existing node.`\n )\n\n ret[key] = [i, ...path]\n }\n })\n }\n\n return ret\n }\n\n /**\n * Get the last text node of a node, or the node itself.\n *\n * @return {Node|Null}\n */\n\n getLastText() {\n if (this.object === 'text') {\n return this\n }\n\n let descendant = null\n\n const found = this.nodes.findLast(node => {\n if (node.object === 'text') return true\n descendant = node.getLastText()\n return descendant\n })\n\n return descendant || found\n }\n\n /**\n * Get a node in the tree, or the node itself.\n *\n * @param {List|String} path\n * @return {Node|Null}\n */\n\n getNode(path) {\n path = this.resolvePath(path)\n if (!path) return null\n if (this.object === 'text' && path.size) return null\n const node = path.size ? this.getDescendant(path) : this\n return node\n }\n\n /**\n * Find the path to a node.\n *\n * @param {String|List} key\n * @return {List}\n */\n\n getPath(key) {\n // COMPAT: Handle passing in a path, to match other methods.\n if (List.isList(key)) {\n return key\n }\n\n // COMPAT: Handle a node object by iterating the descendants tree, so that\n // we avoid using keys for the future.\n if (Node.isNode(key) && this.descendants) {\n for (const [node, path] of this.descendants()) {\n if (key === node) return path\n }\n }\n\n const dict = this.getKeysToPathsTable()\n const path = dict[key]\n return path ? List(path) : null\n }\n\n /**\n * Get the concatenated text string of a node.\n *\n * @return {String}\n */\n\n getText() {\n if (this.object === 'text') {\n return this.text\n }\n\n const text = this.nodes.reduce((memo, c) => memo + c.text, '')\n return text\n }\n\n /**\n * Check if a node exists.\n *\n * @param {List|String} path\n * @return {Boolean}\n */\n\n hasNode(path) {\n const node = this.getNode(path)\n return !!node\n }\n\n /**\n * Normalize the text node with an `editor`.\n *\n * @param {Editor} editor\n * @return {Function|Void}\n */\n\n normalize(editor) {\n const normalizer = editor.run('normalizeNode', this)\n return normalizer\n }\n\n /**\n * Regenerate the node's key.\n *\n * @return {Node}\n */\n\n regenerateKey() {\n const key = KeyUtils.create()\n const node = this.set('key', key)\n return node\n }\n\n /**\n * Resolve a path from a path list or key string.\n *\n * An `index` can be provided, in which case paths created from a key string\n * will have the index pushed onto them. This is helpful in cases where you\n * want to accept either a `path` or a `key, index` combination for targeting\n * a location in the tree that doesn't exist yet, like when inserting.\n *\n * @param {List|String} value\n * @param {Number} index\n * @return {List}\n */\n\n resolvePath(path, index) {\n if (typeof path === 'string') {\n path = this.getPath(path)\n\n if (index != null) {\n path = path.concat(index)\n }\n } else {\n path = PathUtils.create(path)\n }\n\n return path\n }\n\n /**\n * Validate the node with an `editor`.\n *\n * @param {Editor} editor\n * @return {Error|Void}\n */\n\n validate(editor) {\n const error = editor.run('validateNode', this)\n return error\n }\n}\n\n/**\n * Memoize read methods.\n */\n\nmemoize(NodeInterface.prototype, [\n 'getFirstText',\n 'getKeysToPathsTable',\n 'getLastText',\n 'getText',\n 'normalize',\n 'validate',\n])\n\n/**\n * Mix in the node interface.\n */\n\nmixin(NodeInterface, [Block, Document, Inline, Text])\n","export default typeof global !== \"undefined\" ? global :\n typeof self !== \"undefined\" ? self :\n typeof window !== \"undefined\" ? window : {}\n","export default function identity() {\n return true\n}\n","import getDirection from 'direction'\nimport invariant from 'tiny-invariant'\nimport warning from 'tiny-warning'\nimport { List, OrderedSet, Set } from 'immutable'\n\nimport Annotation from '../models/annotation'\nimport Block from '../models/block'\nimport Decoration from '../models/decoration'\nimport Document from '../models/document'\nimport Inline from '../models/inline'\nimport Operation from '../models/operation'\nimport PathUtils from '../utils/path-utils'\nimport Point from '../models/point'\nimport Range from '../models/range'\nimport Selection from '../models/selection'\nimport Value from '../models/value'\nimport identity from '../utils/identity'\nimport memoize from '../utils/memoize'\nimport mixin from '../utils/mixin'\n\n/**\n * The interface that `Document`, `Block` and `Inline` all implement, to make\n * working with the recursive node tree easier.\n *\n * @type {Class}\n */\n\nclass ElementInterface {\n /**\n * Get the concatenated text of the node.\n *\n * @return {String}\n */\n\n get text() {\n return this.getText()\n }\n\n /**\n * Add `mark` to text at `path`.\n *\n * @param {List|String} path\n * @param {Mark} mark\n * @return {Node}\n */\n\n addMark(path, mark) {\n path = this.resolvePath(path)\n let node = this.assertDescendant(path)\n node = node.addMark(mark)\n const ret = this.replaceNode(path, node)\n return ret\n }\n\n /**\n * Create an iteratable for all of the ancestors of the node.\n *\n * @return {Iterable}\n */\n\n ancestors(path) {\n const iterable = this.createIterable({\n path,\n direction: null,\n downward: false,\n includeTargetAncestors: true,\n includeRoot: true,\n })\n\n return iterable\n }\n\n /**\n * Create an iteratable for all of the blocks of a node with `options`.\n *\n * @param {Options}\n * @return {Iterable}\n */\n\n blocks(options = {}) {\n const { onlyLeaves, onlyRoots, onlyTypes, match, ...rest } = options\n const iterable = this.descendants({\n includeDocument: false,\n includeInlines: false,\n includeTexts: false,\n ...rest,\n match: (node, path) => {\n if (onlyTypes && !onlyTypes.includes(node.type)) {\n return false\n } else if (onlyRoots && path.size !== 1) {\n return false\n } else if (onlyLeaves && !node.isLeafBlock()) {\n return false\n } else if (match && !match(node, path)) {\n return false\n } else {\n return true\n }\n },\n })\n\n return iterable\n }\n\n /**\n * Create an annotation with `properties` relative to the node.\n *\n * @param {Object|Annotation} properties\n * @return {Annotation}\n */\n\n createAnnotation(properties) {\n properties = Annotation.createProperties(properties)\n const annotation = this.resolveAnnotation(properties)\n return annotation\n }\n\n /**\n * Create a decoration with `properties` relative to the node.\n *\n * @param {Object|Decoration} properties\n * @return {Decoration}\n */\n\n createDecoration(properties) {\n properties = Decoration.createProperties(properties)\n const decoration = this.resolveDecoration(properties)\n return decoration\n }\n\n /**\n * Create an iteratable function starting at `target` path with `options`.\n *\n * @param {Object} options (optional)\n * @return {Function}\n */\n\n createIterable(options = {}) {\n const {\n direction = 'forward',\n downward = true,\n upward = true,\n includeBlocks = true,\n includeDocument = true,\n includeInlines = true,\n includeRoot = false,\n includeTarget = !!options.range,\n includeTargetAncestors = false,\n includeTexts = true,\n match = null,\n } = options\n\n const root = this\n let targetPath = null\n let targetRange = null\n\n // You can iterate over either a range or a path, but not both.\n if (options.range) {\n targetRange = root.resolveRange(options.range)\n targetPath = root.resolvePath(targetRange.start.path)\n } else if (options.path) {\n targetPath = root.resolvePath(options.path)\n }\n\n const targetNode = targetPath && root.assertNode(targetPath)\n const NativeSet = typeof window === 'undefined' ? global.Set : window.Set\n\n // Return an object that implements the iterable interface.\n return {\n [Symbol.iterator]() {\n const visited = new NativeSet()\n const startPath = targetRange && targetRange.start.path\n const endPath = targetRange && targetRange.end.path\n let path = targetPath\n let node = targetNode\n let includedTarget = false\n let includedStart = false\n let includingStart = false\n\n const result = () => {\n // When these are nulled out we've finished iterating.\n if (!path || !node) {\n return { done: true }\n }\n\n // We often don't want to include the root node itself.\n if (!includeRoot && node === root) {\n return next()\n }\n\n if (!includeBlocks && node.object === 'block') {\n return next()\n }\n\n if (!includeDocument && node.object === 'document') {\n return next()\n }\n\n if (!includeInlines && node.object === 'inline') {\n return next()\n }\n\n if (!includeTexts && node.object === 'text') {\n return next()\n }\n\n if (match && !match(node, path)) {\n return next()\n }\n\n return { value: [node, path], done: false }\n }\n\n const next = () => {\n if (!path || !node) {\n return result()\n }\n\n // When iterating over a range, we need to include the specific\n // ancestors in the start path of the range manually.\n if (startPath && !includedStart) {\n if (!includingStart) {\n includingStart = true\n path = PathUtils.create([])\n node = root\n return result()\n }\n\n if (path.size === startPath.size - 1) {\n includedStart = true\n path = targetPath\n node = targetNode\n return next()\n }\n\n path = startPath.slice(0, path.size + 1)\n node = root.assertNode(path)\n return result()\n }\n\n // Sometimes we want to include the target itself.\n if (includeTarget && !includedTarget) {\n includedTarget = true\n return result()\n }\n\n // When iterating over a range, if we get to the end path then exit.\n if (endPath && path.equals(endPath)) {\n node = null\n path = null\n return next()\n }\n\n // If we're allowed to go downward, and we haven't decsended yet, do so.\n if (downward && node.nodes && node.nodes.size && !visited.has(node)) {\n visited.add(node)\n const nextIndex = direction === 'forward' ? 0 : node.nodes.size - 1\n path = path.push(nextIndex)\n node = root.assertNode(path)\n return result()\n }\n\n // If we're going forward...\n if (direction === 'forward') {\n const newPath = PathUtils.increment(path)\n const newNode = root.getNode(newPath)\n\n if (newNode) {\n path = newPath\n node = newNode\n return result()\n }\n }\n\n // If we're going backward...\n if (direction === 'backward' && path.last() !== 0) {\n const newPath = PathUtils.decrement(path)\n const newNode = root.getNode(newPath)\n\n if (newNode) {\n path = newPath\n node = newNode\n return result()\n }\n }\n\n // If we're going upward...\n if (upward && path.size) {\n path = PathUtils.lift(path)\n node = root.assertNode(path)\n\n // Sometimes we'll have already visited the node on the way down\n // so we don't want to double count it.\n if (visited.has(node)) {\n return next()\n }\n\n visited.add(node)\n\n // If ancestors of the target node shouldn't be included, skip them.\n if (!includeTargetAncestors) {\n return next()\n } else {\n return result()\n }\n }\n\n path = null\n node = null\n return next()\n }\n\n return { next }\n },\n }\n }\n\n /**\n * Create a point with `properties` relative to the node.\n *\n * @param {Object|Point} properties\n * @return {Range}\n */\n\n createPoint(properties) {\n properties = Point.createProperties(properties)\n const point = this.resolvePoint(properties)\n return point\n }\n\n /**\n * Create a range with `properties` relative to the node.\n *\n * @param {Object|Range} properties\n * @return {Range}\n */\n\n createRange(properties) {\n properties = Range.createProperties(properties)\n const range = this.resolveRange(properties)\n return range\n }\n\n /**\n * Create a selection with `properties` relative to the node.\n *\n * @param {Object|Selection} properties\n * @return {Selection}\n */\n\n createSelection(properties) {\n properties = Selection.createProperties(properties)\n const selection = this.resolveSelection(properties)\n return selection\n }\n\n /**\n * Create an iteratable for all of the descendants of the node.\n *\n * @param {Object} options\n * @return {Iterable}\n */\n\n descendants(options) {\n const iterable = this.createIterable({ path: [], ...options })\n return iterable\n }\n\n /**\n * Find all of the descendants that match a `predicate`.\n *\n * @param {Function} predicate\n * @return {List}\n */\n\n filterDescendants(predicate = identity) {\n const matches = []\n\n for (const [node, path] of this.descendants()) {\n if (predicate(node, path)) {\n matches.push(node)\n }\n }\n\n return List(matches)\n }\n\n /**\n * Find the first descendant that matches a `predicate`.\n *\n * @param {Function} predicate\n * @return {Node|Null}\n */\n\n findDescendant(predicate = identity) {\n for (const [node, path] of this.descendants()) {\n if (predicate(node, path)) {\n return node\n }\n }\n\n return null\n }\n\n /**\n * Iterate over all descendants, breaking if `predicate` returns false.\n *\n * @param {Function} predicate\n */\n\n forEachDescendant(predicate = identity) {\n for (const next of this.descendants()) {\n const ret = predicate(...next)\n\n if (ret === false) {\n return\n }\n }\n }\n\n /**\n * Get a set of the active marks in a `range`. Active marks are marks that are\n * on every text node in a given range. This is a common distinction for\n * highlighting toolbar buttons for example.\n *\n * TODO: this method needs to be cleaned up, it's very hard to follow and\n * probably doing unnecessary work.\n *\n * @param {Range} range\n * @return {Set}\n */\n\n getActiveMarksAtRange(range) {\n range = this.resolveRange(range)\n\n if (range.isUnset) {\n return Set()\n }\n\n if (range.isCollapsed) {\n const { start } = range\n return this.getInsertMarksAtPoint(start)\n }\n\n const { start, end } = range\n let startPath = start.path\n let startOffset = start.offset\n let endPath = end.path\n let endOffset = end.offset\n let startText = this.getDescendant(startPath)\n let endText = this.getDescendant(endPath)\n\n if (!startPath.equals(endPath)) {\n while (!startPath.equals(endPath) && endOffset === 0) {\n ;[[endText, endPath]] = this.texts({\n path: endPath,\n direction: 'backward',\n })\n\n endOffset = endText.text.length\n }\n\n while (\n !startPath.equals(endPath) &&\n startOffset === startText.text.length\n ) {\n ;[[startText, startPath]] = this.texts({ path: startPath })\n startOffset = 0\n }\n }\n\n if (startPath.equals(endPath)) {\n return startText.marks\n }\n\n const startMarks = startText.marks\n\n // PERF: if start marks is empty we can return early.\n if (startMarks.size === 0) {\n return Set()\n }\n\n const endMarks = endText.marks\n let marks = startMarks.intersect(endMarks)\n\n // If marks is already empty, the active marks is empty\n if (marks.size === 0) {\n return marks\n }\n\n ;[[startText, startPath]] = this.texts({ path: startPath })\n\n while (!startPath.equals(endPath)) {\n if (startText.text.length !== 0) {\n marks = marks.intersect(startText.marks)\n\n if (marks.size === 0) {\n return Set()\n }\n }\n\n ;[[startText, startPath]] = this.texts({ path: startPath })\n }\n\n return marks\n }\n\n /**\n * Get a list of the ancestors of a descendant.\n *\n * @param {List|String} path\n * @return {List|Null}\n */\n\n getAncestors(path) {\n const iterable = this.ancestors(path)\n const array = Array.from(iterable, ([node]) => node).reverse()\n const list = List(array)\n return list\n }\n\n /**\n * Get the leaf block descendants of the node.\n *\n * @return {List}\n */\n\n getBlocks() {\n const iterable = this.blocks({ onlyLeaves: true })\n const array = Array.from(iterable, ([node]) => node)\n const list = List(array)\n return list\n }\n\n /**\n * Get all of the leaf blocks that match a `type`.\n *\n * @param {String} type\n * @return {List}\n */\n\n getBlocksByType(type) {\n const iterable = this.blocks({ onlyLeaves: true, onlyTypes: [type] })\n const array = Array.from(iterable, ([node]) => node)\n const list = List(array)\n return list\n }\n\n /**\n * Get a child node.\n *\n * @param {List|String} path\n * @return {Node|Null}\n */\n\n getChild(path) {\n path = this.resolvePath(path)\n\n if (!path || path.size > 1) {\n return null\n }\n\n const child = this.nodes.get(path.first())\n return child\n }\n\n /**\n * Get closest parent of node that matches a `predicate`.\n *\n * @param {List|String} path\n * @param {Function} predicate\n * @return {Node|Null}\n */\n\n getClosest(path, predicate) {\n for (const [n, p] of this.ancestors(path)) {\n if (predicate(n, p)) {\n return n\n }\n }\n\n return null\n }\n\n /**\n * Get the closest block parent of a node.\n *\n * @param {List|String} path\n * @return {Node|Null}\n */\n\n getClosestBlock(path) {\n const closest = this.getClosest(path, n => n.object === 'block')\n return closest\n }\n\n /**\n * Get the closest inline parent of a node by `path`.\n *\n * @param {List|String} path\n * @return {Node|Null}\n */\n\n getClosestInline(path) {\n const closest = this.getClosest(path, n => n.object === 'inline')\n return closest\n }\n\n /**\n * Get the closest void parent of a node by `path`.\n *\n * @param {List|String} path\n * @param {Editor} editor\n * @return {Node|Null}\n */\n\n getClosestVoid(path, editor) {\n invariant(\n !Value.isValue(editor),\n 'As of Slate 0.42.0, the `node.getClosestVoid` method takes an `editor` instead of a `value`.'\n )\n\n const closest = this.getClosest(path, n => editor.isVoid(n))\n return closest\n }\n\n /**\n * Get the common ancestor of nodes `a` and `b`.\n *\n * @param {List} a\n * @param {List} b\n * @return {Node}\n */\n\n getCommonAncestor(a, b) {\n a = this.resolvePath(a)\n b = this.resolvePath(b)\n\n if (!a || !b) {\n return null\n }\n\n const path = PathUtils.relate(a, b)\n const node = this.getNode(path)\n return node\n }\n\n /**\n * Get the decorations for the node from an `editor`.\n *\n * @param {Editor} editor\n * @return {List}\n */\n\n getDecorations(editor) {\n let decorations = editor.run('decorateNode', this)\n decorations = Decoration.createList(decorations)\n return decorations\n }\n\n /**\n * Get the depth of a descendant, with optional `startAt`.\n *\n * @param {List|String} path\n * @param {Number} startAt\n * @return {Number|Null}\n */\n\n getDepth(path, startAt = 1) {\n path = this.resolvePath(path)\n\n if (!path) {\n return null\n }\n\n const node = this.getNode(path)\n const depth = node ? path.size - 1 + startAt : null\n return depth\n }\n\n /**\n * Get a descendant node.\n *\n * @param {List|String} path\n * @return {Node|Null}\n */\n\n getDescendant(path) {\n path = this.resolvePath(path)\n\n if (!path || !path.size) {\n return null\n }\n\n let node = this\n\n path.forEach(index => {\n node = node.getIn(['nodes', index])\n return !!node\n })\n\n return node\n }\n\n /**\n * Get all of the descendant nodes in a `range`.\n *\n * @param {Range} range\n * @return {List}\n */\n\n getDescendantsAtRange(range) {\n const iterable = this.descendants({ range })\n const array = Array.from(iterable, ([node]) => node)\n const list = List(array)\n return list\n }\n\n /**\n * Get a fragment of the node at a `range`.\n *\n * @param {Range} range\n * @return {Document}\n */\n\n getFragmentAtRange(range) {\n range = this.resolveRange(range)\n\n if (range.isUnset) {\n return Document.create()\n }\n\n const { start, end } = range\n let node = this\n let targetPath = end.path\n let targetPosition = end.offset\n let side = 'end'\n\n while (targetPath.size) {\n const index = targetPath.last()\n node = node.splitNode(targetPath, targetPosition)\n targetPosition = index + 1\n targetPath = PathUtils.lift(targetPath)\n\n if (!targetPath.size && side === 'end') {\n targetPath = start.path\n targetPosition = start.offset\n side = 'start'\n }\n }\n\n const startIndex = start.path.first() + 1\n const endIndex = end.path.first() + 2\n const nodes = node.nodes.slice(startIndex, endIndex)\n const fragment = Document.create({ nodes })\n return fragment\n }\n\n /**\n * Get the furthest ancestors of a node that matches a `predicate`.\n *\n * @param {Path} path\n * @param {Function} predicate\n * @return {Node|Null}\n */\n\n getFurthest(path, predicate = identity) {\n const iterable = this.ancestors(path)\n const results = Array.from(iterable).reverse()\n\n for (const [n, p] of results) {\n if (predicate(n, p)) {\n return n\n }\n }\n\n return null\n }\n\n /**\n * Get the furthest block parent of a node.\n *\n * @param {Path} path\n * @return {Node|Null}\n */\n\n getFurthestBlock(path) {\n const furthest = this.getFurthest(path, n => n.object === 'block')\n return furthest\n }\n\n /**\n * Get the furthest child ancestor of a node at `path`.\n *\n * @param {List|String} path\n * @return {Node|Null}\n */\n\n getFurthestChild(path) {\n path = this.resolvePath(path)\n\n if (!path || !path.size) {\n return null\n }\n\n const furthest = this.nodes.get(path.first())\n return furthest\n }\n\n /**\n * Get the furthest inline parent of a node.\n *\n * @param {Path} path\n * @return {Node|Null}\n */\n\n getFurthestInline(path) {\n const furthest = this.getFurthest(path, n => n.object === 'inline')\n return furthest\n }\n\n /**\n * Get the closest inline nodes for each text node in the node.\n *\n * @return {List}\n */\n\n getInlines() {\n const iterable = this.inlines({ onlyLeaves: true })\n const array = Array.from(iterable, ([node]) => node)\n const list = List(array)\n return list\n }\n\n /**\n * Get all of the leaf inline nodes that match a `type`.\n *\n * @param {String} type\n * @return {List}\n */\n\n getInlinesByType(type) {\n const iterable = this.inlines({ onlyLeaves: true, onlyTypes: [type] })\n const array = Array.from(iterable, ([node]) => node)\n const list = List(array)\n return list\n }\n\n /**\n * Get a set of marks that would occur on the next insert at a `point` in the\n * node. This mimics expected rich text editing behaviors of mark contiuation.\n *\n * @param {Point} point\n * @return {Set}\n */\n\n getInsertMarksAtPoint(point) {\n point = this.resolvePoint(point)\n const { path, offset } = point\n const text = this.getDescendant(path)\n\n // PERF: we can exit early if the offset isn't at the start of the node.\n if (offset !== 0) {\n return text.marks\n }\n\n let blockNode\n let blockPath\n\n for (const entry of this.ancestors(path)) {\n const [n, p] = entry\n\n if (n.object === 'block') {\n blockNode = n\n blockPath = p\n }\n }\n\n const relativePath = PathUtils.drop(path, blockPath.size)\n const [previous] = blockNode.texts({\n path: relativePath,\n direction: 'backward',\n })\n\n // If there's no previous text, we're at the start of the block, so use\n // the current text nodes marks.\n if (!previous) {\n return text.marks\n }\n\n // Otherwise, continue with the previous text node's marks instead.\n const [previousText] = previous\n return previousText.marks\n }\n\n /**\n * Get a set of marks that would occur on the next insert at a `range`.\n * This mimics expected rich text editing behaviors of mark contiuation.\n *\n * @param {Range} range\n * @return {Set}\n */\n\n getInsertMarksAtRange(range) {\n range = this.resolveRange(range)\n const { start } = range\n\n if (range.isUnset) {\n return Set()\n }\n\n if (range.isCollapsed) {\n return this.getInsertMarksAtPoint(start)\n }\n\n const text = this.getDescendant(start.path)\n return text.marks\n }\n\n /**\n * Get the bottom-most block descendants in a `range`.\n *\n * @param {Range} range\n * @return {List}\n */\n\n getLeafBlocksAtRange(range) {\n const iterable = this.blocks({ range, onlyLeaves: true })\n const array = Array.from(iterable, ([node]) => node)\n const list = List(array)\n return list\n }\n\n /**\n * Get the bottom-most inline nodes for each text node in a `range`.\n *\n * @param {Range} range\n * @return {List}\n */\n\n getLeafInlinesAtRange(range) {\n const iterable = this.inlines({ range, onlyLeaves: true })\n const array = Array.from(iterable, ([node]) => node)\n const list = List(array)\n return list\n }\n\n /**\n * Get an object mapping all the keys in the node to their paths.\n *\n * @return {Map}\n */\n\n getNodesToPathsMap() {\n const root = this\n const map =\n typeof window === 'undefined' ? new global.Map() : new window.Map()\n\n map.set(root, PathUtils.create([]))\n\n root.forEachDescendant((node, path) => {\n map.set(node, path)\n })\n\n return map\n }\n\n /**\n * Get all of the marks for all of the characters of every text node.\n *\n * @return {OrderedSet}\n */\n\n getMarks() {\n const iterable = this.marks()\n const array = Array.from(iterable, ([mark]) => mark)\n return OrderedSet(array)\n }\n\n /**\n * Get a set of the marks in a `range`.\n *\n * @param {Range} range\n * @return {OrderedSet}\n */\n\n getMarksAtRange(range) {\n const iterable = this.marks({ range })\n const array = Array.from(iterable, ([mark]) => mark)\n return OrderedSet(array)\n }\n\n /**\n * Get all of the marks that match a `type`.\n *\n * @param {String} type\n * @return {OrderedSet}\n */\n\n getMarksByType(type) {\n const iterable = this.marks({ onlyTypes: [type] })\n const array = Array.from(iterable, ([mark]) => mark)\n return OrderedSet(array)\n }\n\n /**\n * Get the block node after a descendant text node by `path`.\n *\n * @param {List|String} path\n * @return {Node|Null}\n */\n\n getNextBlock(path) {\n const [entry] = this.blocks({ path, onlyLeaves: true })\n const block = entry ? entry[0] : null\n return block\n }\n\n /**\n * Get the next node in the tree, returning siblings or ancestor siblings.\n *\n * @param {List|String} path\n * @return {Node|Null}\n */\n\n getNextNode(path) {\n const iterable = this.createIterable({ path, downward: false })\n const [entry] = iterable\n const node = entry ? entry[0] : null\n return node\n }\n\n /**\n * Get the next sibling of a node.\n *\n * @param {List|String} path\n * @return {Node|Null}\n */\n\n getNextSibling(path) {\n const [entry] = this.siblings(path)\n const node = entry ? entry[0] : null\n return node\n }\n\n /**\n * Get the text node after a descendant text node.\n *\n * @param {List|String} path\n * @return {Node|Null}\n */\n\n getNextText(path) {\n const [entry] = this.texts({ path })\n const node = entry ? entry[0] : null\n return node\n }\n\n /**\n * Get the offset for a descendant text node by `path` or `key`.\n *\n * @param {List|string} path\n * @return {Number}\n */\n\n getOffset(path) {\n path = this.resolvePath(path)\n this.assertDescendant(path)\n\n // Calculate the offset of the nodes before the highest child.\n const index = path.first()\n\n const offset = this.nodes\n .slice(0, index)\n .reduce((memo, n) => memo + n.text.length, 0)\n\n // Recurse if need be.\n const ret =\n path.size === 1\n ? offset\n : offset + this.nodes.get(index).getOffset(PathUtils.drop(path))\n\n return ret\n }\n\n /**\n * Get the offset from a `range`.\n *\n * @param {Range} range\n * @return {Number}\n */\n\n getOffsetAtRange(range) {\n range = this.resolveRange(range)\n\n if (range.isUnset) {\n throw new Error('The range cannot be unset to calculcate its offset.')\n }\n\n if (range.isExpanded) {\n throw new Error('The range must be collapsed to calculcate its offset.')\n }\n\n const { start } = range\n const offset = this.getOffset(start.path) + start.offset\n return offset\n }\n\n /**\n * Get the parent of a descendant node.\n *\n * @param {List|String} path\n * @return {Node|Null}\n */\n\n getParent(path) {\n path = this.resolvePath(path)\n if (!path) return null\n if (!path.size) return null\n const parentPath = PathUtils.lift(path)\n const parent = this.getNode(parentPath)\n return parent\n }\n\n /**\n * Get the block node before a descendant text node by `path`.\n *\n * @param {List|String} path\n * @return {Node|Null}\n */\n\n getPreviousBlock(path) {\n const [entry] = this.blocks({\n path,\n onlyLeaves: true,\n direction: 'backward',\n })\n const block = entry ? entry[0] : null\n return block\n }\n\n /**\n * Get the previous node from a node in the tree.\n *\n * This will not only check for siblings but instead move up the tree\n * returning the previous ancestor if no sibling is found.\n *\n * @param {List|String} path\n * @return {Node|Null}\n */\n\n getPreviousNode(path) {\n const iterable = this.createIterable({\n path,\n downward: false,\n direction: 'backward',\n })\n\n const [entry] = iterable\n const node = entry ? entry[0] : null\n return node\n }\n\n /**\n * Get the previous sibling of a node.\n *\n * @param {List|String} path\n * @return {Node|Null}\n */\n\n getPreviousSibling(path) {\n const [entry] = this.siblings(path, { direction: 'backward' })\n const node = entry ? entry[0] : null\n return node\n }\n\n /**\n * Get the text node before a descendant text node.\n *\n * @param {List|String} path\n * @return {Node|Null}\n */\n\n getPreviousText(path) {\n const [entry] = this.texts({ path, direction: 'backward' })\n const node = entry ? entry[0] : null\n return node\n }\n\n /**\n * Get only the root block nodes in a `range`.\n *\n * @param {Range} range\n * @return {List}\n */\n\n getRootBlocksAtRange(range) {\n const iterable = this.blocks({ range, onlyRoots: true })\n const array = Array.from(iterable, ([node]) => node)\n const list = List(array)\n return list\n }\n\n /**\n * Get only the root inline nodes in a `range`.\n *\n * @param {Range} range\n * @return {List}\n */\n\n getRootInlinesAtRange(range) {\n const iterable = this.inlines({ range, onlyRoots: true })\n const array = Array.from(iterable, ([node]) => node)\n const list = List(array)\n return list\n }\n\n /**\n * Get the descendent text node at an `offset`.\n *\n * @param {String} offset\n * @return {Node|Null}\n */\n\n getTextAtOffset(offset) {\n // PERF: Add a few shortcuts for the obvious cases.\n if (offset === 0) return this.getFirstText()\n if (offset === this.text.length) return this.getLastText()\n if (offset < 0 || offset > this.text.length) return null\n\n let length = 0\n\n for (const [node] of this.texts()) {\n length += node.text.length\n\n if (length > offset) {\n return node\n }\n }\n\n return null\n }\n\n /**\n * Get the direction of the node's text.\n *\n * @return {String}\n */\n\n getTextDirection() {\n const dir = getDirection(this.text)\n return dir === 'neutral' ? null : dir\n }\n\n /**\n * Recursively get all of the child text nodes in order of appearance.\n *\n * @return {List}\n */\n\n getTexts() {\n const iterable = this.texts()\n const array = Array.from(iterable, ([node]) => node)\n const list = List(array)\n return list\n }\n\n /**\n * Get all of the text nodes in a `range` as a List.\n *\n * @param {Range} range\n * @return {List}\n */\n\n getTextsAtRange(range) {\n const iterable = this.texts({ range })\n const array = Array.from(iterable, ([node]) => node)\n const list = List(array)\n return list\n }\n\n /**\n * Check if the node has block children.\n *\n * @return {Boolean}\n */\n\n hasBlockChildren() {\n return !!(this.nodes && this.nodes.find(n => n.object === 'block'))\n }\n\n /**\n * Check if a child node exists.\n *\n * @param {List|String} path\n * @return {Boolean}\n */\n\n hasChild(path) {\n const child = this.getChild(path)\n return !!child\n }\n\n /**\n * Check if a node has inline children.\n *\n * @return {Boolean}\n */\n\n hasInlineChildren() {\n return !!(\n this.nodes &&\n this.nodes.find(n => n.object === 'inline' || n.object === 'text')\n )\n }\n\n /**\n * Recursively check if a child node exists.\n *\n * @param {List|String} path\n * @return {Boolean}\n */\n\n hasDescendant(path) {\n const descendant = this.getDescendant(path)\n return !!descendant\n }\n\n /**\n * Check if a node has a void parent.\n *\n * @param {List|String} path\n * @param {Editor} editor\n * @return {Boolean}\n */\n\n hasVoidParent(path, editor) {\n invariant(\n !Value.isValue(editor),\n 'As of Slate 0.42.0, the `node.hasVoidParent` method takes an `editor` instead of a `value`.'\n )\n\n const closest = this.getClosestVoid(path, editor)\n return !!closest\n }\n\n /**\n * Create an iteratable for all of the inlines of a node with `options`.\n *\n * @param {Options}\n * @return {Iterable}\n */\n\n inlines(options = {}) {\n const { onlyLeaves, onlyRoots, onlyTypes, match, ...rest } = options\n const iterable = this.descendants({\n includeBlocks: false,\n includeTexts: false,\n includeDocument: false,\n ...rest,\n match: (node, path) => {\n if (onlyTypes && !onlyTypes.includes(node.type)) {\n return false\n } else if (onlyLeaves && !node.isLeafInline()) {\n return false\n } else if (onlyRoots && this.getParent(path).object !== 'block') {\n return false\n } else if (match && !match(node, path)) {\n return false\n } else {\n return true\n }\n },\n })\n\n return iterable\n }\n\n /**\n * Insert a `node`.\n *\n * @param {List|String} path\n * @param {Node} node\n * @return {Node}\n */\n\n insertNode(path, node) {\n path = this.resolvePath(path)\n const index = path.last()\n const parentPath = PathUtils.lift(path)\n let parent = this.assertNode(parentPath)\n const nodes = parent.nodes.splice(index, 0, node)\n parent = parent.set('nodes', nodes)\n const ret = this.replaceNode(parentPath, parent)\n return ret\n }\n\n /**\n * Insert `text` at `offset` in node by `path`.\n *\n * @param {List|String} path\n * @param {Number} offset\n * @param {String} text\n * @return {Node}\n */\n\n insertText(path, offset, text) {\n path = this.resolvePath(path)\n let node = this.assertDescendant(path)\n node = node.insertText(offset, text)\n const ret = this.replaceNode(path, node)\n return ret\n }\n\n /**\n * Check whether the node is a leaf block.\n *\n * @return {Boolean}\n */\n\n isLeafBlock() {\n if (this.object !== 'block') {\n return false\n }\n\n if (this.nodes.some(n => n.object === 'block')) {\n return false\n }\n\n return true\n }\n\n /**\n * Check whether the node is a leaf inline.\n *\n * @return {Boolean}\n */\n\n isLeafInline() {\n if (this.object !== 'inline') {\n return false\n }\n\n if (this.nodes.some(n => n.object === 'inline')) {\n return false\n }\n\n return true\n }\n\n /**\n * Check whether a descendant node is inside a `range` by `path`.\n *\n * @param {List|String} path\n * @param {Range} range\n * @return {Node}\n */\n\n isInRange(path, range) {\n path = this.resolvePath(path)\n range = this.resolveRange(range)\n\n if (range.isUnset) {\n return false\n }\n\n const toStart = PathUtils.compare(path, range.start.path)\n const toEnd = PathUtils.compare(path, range.end.path)\n const isInRange = toStart !== -1 && toEnd !== 1\n return isInRange\n }\n\n /**\n * Map all child nodes, updating them in their parents. This method is\n * optimized to not return a new node if no changes are made.\n *\n * @param {Function} predicate\n * @return {Node}\n */\n\n mapChildren(predicate = identity) {\n let { nodes } = this\n\n nodes.forEach((node, i) => {\n const ret = predicate(node, i, this.nodes)\n if (ret !== node) nodes = nodes.set(ret.key, ret)\n })\n\n const ret = this.set('nodes', nodes)\n return ret\n }\n\n /**\n * Map all descendant nodes, updating them in their parents. This method is\n * optimized to not return a new node if no changes are made.\n *\n * @param {Function} predicate\n * @return {Node}\n */\n\n mapDescendants(predicate = identity) {\n let { nodes } = this\n\n nodes.forEach((node, index) => {\n let ret = node\n if (ret.object !== 'text') ret = ret.mapDescendants(predicate)\n ret = predicate(ret, index, this.nodes)\n if (ret === node) return\n\n nodes = nodes.set(index, ret)\n })\n\n const ret = this.set('nodes', nodes)\n return ret\n }\n\n /**\n * Create an iteratable for all the marks in text nodes with `options`.\n *\n * @param {Options}\n * @return {Iterable}\n */\n\n marks(options = {}) {\n const { onlyTypes = null, match, ...rest } = options\n const texts = this.texts(rest)\n\n return {\n [Symbol.iterator]() {\n const iterator = texts[Symbol.iterator]()\n let node = null\n let path = null\n let remaining = []\n\n const next = () => {\n if (remaining.length) {\n const mark = remaining.shift()\n\n if (onlyTypes && !onlyTypes.includes(mark.type)) {\n return next()\n } else if (match && !match(mark, node, path)) {\n return next()\n }\n\n return { value: [mark, node, path], done: false }\n }\n\n const { value, done } = iterator.next()\n\n if (done) {\n return { done: true }\n }\n\n ;[node, path] = value\n remaining = node.marks.toArray()\n return next()\n }\n\n return { next }\n },\n }\n }\n\n /**\n * Merge a node backwards its previous sibling.\n *\n * @param {List|Key} path\n * @return {Node}\n */\n\n mergeNode(path) {\n const b = this.assertNode(path)\n path = this.resolvePath(path)\n\n if (path.last() === 0) {\n throw new Error(\n `Unable to merge node because it has no previous sibling: ${b}`\n )\n }\n\n const withPath = PathUtils.decrement(path)\n const a = this.assertNode(withPath)\n\n if (a.object !== b.object) {\n throw new Error(\n `Unable to merge two different kinds of nodes: ${a} and ${b}`\n )\n }\n\n const newNode =\n a.object === 'text'\n ? a.mergeText(b)\n : a.set('nodes', a.nodes.concat(b.nodes))\n\n let ret = this\n ret = ret.removeNode(path)\n ret = ret.removeNode(withPath)\n ret = ret.insertNode(withPath, newNode)\n return ret\n }\n\n /**\n * Move a node by `path` to `newPath`.\n *\n * A `newIndex` can be provided when move nodes by `key`, to account for not\n * being able to have a key for a location in the tree that doesn't exist yet.\n *\n * @param {List|Key} path\n * @param {List|Key} newPath\n * @param {Number} newIndex\n * @return {Node}\n */\n\n moveNode(path, newPath, newIndex = 0) {\n const node = this.assertNode(path)\n path = this.resolvePath(path)\n newPath = this.resolvePath(newPath, newIndex)\n\n const newParentPath = PathUtils.lift(newPath)\n this.assertNode(newParentPath)\n\n // TODO: this is a bit hacky, re-creating the operation that led to this method being called\n // Alternative 1: pass the operation through from apply -> value.moveNode\n // Alternative 2: add a third property to the operation called \"transformedNewPath\", pass that through\n const op = Operation.create({\n type: 'move_node',\n path,\n newPath,\n })\n newPath = PathUtils.transform(path, op).first()\n\n let ret = this\n ret = ret.removeNode(path)\n ret = ret.insertNode(newPath, node)\n return ret\n }\n\n /**\n * Remove `mark` from text at `path`.\n *\n * @param {List} path\n * @param {Mark} mark\n * @return {Node}\n */\n\n removeMark(path, mark) {\n path = this.resolvePath(path)\n let node = this.assertDescendant(path)\n node = node.removeMark(mark)\n const ret = this.replaceNode(path, node)\n return ret\n }\n\n /**\n * Remove a node.\n *\n * @param {List|String} path\n * @return {Node}\n */\n\n removeNode(path) {\n this.assertDescendant(path)\n path = this.resolvePath(path)\n const deep = path.flatMap(x => ['nodes', x])\n const ret = this.deleteIn(deep)\n return ret\n }\n\n /**\n * Remove `text` at `offset` in node.\n *\n * @param {List|Key} path\n * @param {Number} offset\n * @param {String} text\n * @return {Node}\n */\n\n removeText(path, offset, text) {\n let node = this.assertDescendant(path)\n node = node.removeText(offset, text.length)\n const ret = this.replaceNode(path, node)\n return ret\n }\n\n /**\n * Replace a `node` in the tree.\n *\n * @param {List|Key} path\n * @param {Node} node\n * @return {Node}\n */\n\n replaceNode(path, node) {\n path = this.resolvePath(path)\n\n if (!path) {\n throw new Error(\n `Unable to replace a node because it could not be found in the first place: ${path}`\n )\n }\n\n if (!path.size) return node\n this.assertNode(path)\n const deep = path.flatMap(x => ['nodes', x])\n const ret = this.setIn(deep, node)\n return ret\n }\n\n /**\n * Resolve a `annotation`, relative to the node, ensuring that the keys and\n * offsets in the annotation exist and that they are synced with the paths.\n *\n * @param {Annotation|Object} annotation\n * @return {Annotation}\n */\n\n resolveAnnotation(annotation) {\n annotation = Annotation.create(annotation)\n annotation = annotation.normalize(this)\n return annotation\n }\n\n /**\n * Resolve a `decoration`, relative to the node, ensuring that the keys and\n * offsets in the decoration exist and that they are synced with the paths.\n *\n * @param {Decoration|Object} decoration\n * @return {Decoration}\n */\n\n resolveDecoration(decoration) {\n decoration = Decoration.create(decoration)\n decoration = decoration.normalize(this)\n return decoration\n }\n\n /**\n * Resolve a `point`, relative to the node, ensuring that the keys and\n * offsets in the point exist and that they are synced with the paths.\n *\n * @param {Point|Object} point\n * @return {Point}\n */\n\n resolvePoint(point) {\n point = Point.create(point)\n point = point.normalize(this)\n return point\n }\n\n /**\n * Resolve a `range`, relative to the node, ensuring that the keys and\n * offsets in the range exist and that they are synced with the paths.\n *\n * @param {Range|Object} range\n * @return {Range}\n */\n\n resolveRange(range) {\n range = Range.create(range)\n range = range.normalize(this)\n return range\n }\n\n /**\n * Resolve a `selection`, relative to the node, ensuring that the keys and\n * offsets in the selection exist and that they are synced with the paths.\n *\n * @param {Selection|Object} selection\n * @return {Selection}\n */\n\n resolveSelection(selection) {\n selection = Selection.create(selection)\n selection = selection.normalize(this)\n return selection\n }\n\n /**\n * Set `properties` on a node.\n *\n * @param {List|String} path\n * @param {Object} properties\n * @return {Node}\n */\n\n setNode(path, properties) {\n let node = this.assertNode(path)\n node = node.merge(properties)\n const ret = this.replaceNode(path, node)\n return ret\n }\n\n /**\n * Set `properties` on `mark` on text at `offset` and `length` in node.\n *\n * @param {List|String} path\n * @param {Number} offset\n * @param {Number} length\n * @param {Mark} mark\n * @param {Object} properties\n * @return {Node}\n */\n\n setMark(path, properties, newProperties) {\n path = this.resolvePath(path)\n let node = this.assertDescendant(path)\n node = node.setMark(properties, newProperties)\n const ret = this.replaceNode(path, node)\n return ret\n }\n\n /**\n * Create an iteratable for the siblings in the tree at `path`.\n *\n * @param {List|Array} path\n * @return {Iterable}\n */\n\n siblings(path, options) {\n const iterable = this.createIterable({\n path,\n upward: false,\n downward: false,\n ...options,\n })\n\n return iterable\n }\n\n /**\n * Split a node by `path` at `position` with optional `properties` to apply\n * to the newly split node.\n *\n * @param {List|String} path\n * @param {Number} position\n * @param {Object} properties\n * @return {Node}\n */\n\n splitNode(path, position, properties) {\n const child = this.assertNode(path)\n path = this.resolvePath(path)\n let a\n let b\n\n if (child.object === 'text') {\n ;[a, b] = child.splitText(position)\n } else {\n const befores = child.nodes.take(position)\n const afters = child.nodes.skip(position)\n a = child.set('nodes', befores)\n b = child.set('nodes', afters).regenerateKey()\n }\n\n if (properties && child.object !== 'text') {\n b = b.merge(properties)\n }\n\n let ret = this\n ret = ret.removeNode(path)\n ret = ret.insertNode(path, b)\n ret = ret.insertNode(path, a)\n return ret\n }\n\n /**\n * Create an iteratable for all the text node descendants.\n *\n * @param {Object} options\n * @return {Iterable}\n */\n\n texts(options) {\n const iterable = this.descendants({\n includeBlocks: false,\n includeInlines: false,\n includeDocument: false,\n ...options,\n })\n\n return iterable\n }\n\n /**\n * Deprecated.\n */\n\n getBlocksAtRange(range) {\n warning(\n false,\n 'As of slate@0.44 the `node.getBlocksAtRange` method has been renamed to `getLeafBlocksAtRange`.'\n )\n\n return this.getLeafBlocksAtRange(range)\n }\n\n getBlocksAtRangeAsArray(range) {\n warning(\n false,\n 'As of slate@0.44 the `node.getBlocksAtRangeAsArray` method has been renamed to `getLeafBlocksAtRangeAsArray`.'\n )\n\n return this.getLeafBlocksAtRangeAsArray(range)\n }\n\n getInlinesAtRange(range) {\n warning(\n false,\n 'As of slate@0.44 the `node.getInlinesAtRange` method has been renamed to `getLeafInlinesAtRange`.'\n )\n\n return this.getLeafInlinesAtRange(range)\n }\n\n getInlinesAtRangeAsArray(range) {\n warning(\n false,\n 'As of slate@0.44 the `node.getInlinesAtRangeAsArray` method has been renamed to `getLeafInlinesAtRangeAsArray`.'\n )\n\n return this.getLeafInlinesAtRangeAsArray(range)\n }\n\n getNextTextAndPath(path) {\n warning(\n false,\n 'As of slate@0.47, the `getNextTextAndPath` method has been renamed to `getNextTextEntry`.'\n )\n\n return this.getNextTextEntry(path)\n }\n\n getNextDeepMatchingNodeAndPath(path, iterator = () => true) {\n warning(\n false,\n 'As of slate@0.47, the `getNextDeepMatchingNodeAndPath` method is deprecated.'\n )\n\n const match = this.getNextMatchingNodeAndPath(path)\n\n if (!match) return null\n\n let [nextNode, nextPath] = match\n\n let childMatch\n\n const assign = () => {\n childMatch =\n nextNode.object !== 'text' &&\n nextNode.findFirstDescendantAndPath(iterator, nextPath)\n return childMatch\n }\n\n while (assign(childMatch)) {\n ;[nextNode, nextPath] = childMatch\n }\n\n if (!nextNode) return null\n\n return iterator(nextNode)\n ? [nextNode, nextPath]\n : this.getNextDeepMatchingNodeAndPath(match[1], iterator)\n }\n\n getPreviousTextAndPath(path) {\n warning(\n false,\n 'As of slate@0.47, the `getPreviousTextAndPath` method has been renamed to `getPreviousTextEntry`.'\n )\n\n return this.getPreviousTextEntry(path)\n }\n\n findFirstDescendantAndPath(iterator, pathToThisNode) {\n warning(\n false,\n 'As of slate@0.47, the `findFirstDescendantAndPath` method is deprecated.'\n )\n\n return this.findDescendantAndPath(iterator, pathToThisNode, false)\n }\n\n getPreviousMatchingNodeAndPath(path, iterator = () => true) {\n warning(\n false,\n 'As of slate@0.47, the `getPreviousMatchingNodeAndPath` method is deprecated.'\n )\n\n if (!path) return null\n\n for (let i = path.size; i > 0; i--) {\n const p = path.slice(0, i)\n if (p.last() === 0) continue\n\n let previousPath = PathUtils.decrement(p)\n let previousNode = this.getNode(previousPath)\n\n while (previousNode && !iterator(previousNode)) {\n previousPath = PathUtils.decrement(previousPath)\n previousNode = this.getNode(previousPath)\n }\n\n if (previousNode) return [previousNode, previousPath]\n }\n\n return null\n }\n\n getPreviousDeepMatchingNodeAndPath(path, iterator = () => true) {\n warning(\n false,\n 'As of slate@0.47, the `getPreviousDeepMatchingNodeAndPath` method is deprecated.'\n )\n\n const match = this.getPreviousMatchingNodeAndPath(path)\n\n if (!match) return null\n\n let [previousNode, previousPath] = match\n\n let childMatch\n\n const assign = () => {\n childMatch =\n previousNode.object !== 'text' &&\n previousNode.findLastDescendantAndPath(iterator, previousPath)\n return childMatch\n }\n\n while (assign(childMatch)) {\n ;[previousNode, previousPath] = childMatch\n }\n\n if (!previousNode) return null\n\n return iterator(previousNode)\n ? [previousNode, previousPath]\n : this.getPreviousDeepMatchingNodeAndPath(match[1], iterator)\n }\n\n findLastDescendantAndPath(iterator, pathToThisNode) {\n warning(\n false,\n 'As of slate@0.47, the `findLastDescendantAndPath` method is deprecated.'\n )\n\n return this.findDescendantAndPath(iterator, pathToThisNode, true)\n }\n\n findDescendantAndPath(\n iterator,\n pathToThisNode = PathUtils.create([]),\n findLast = false\n ) {\n warning(\n false,\n 'As of slate@0.47, the `findDescendantAndPath` method is deprecated.'\n )\n\n let found\n let foundPath\n\n this.forEachDescendantWithPath(\n (node, path, nodes) => {\n if (iterator(node, path, nodes)) {\n found = node\n foundPath = path\n return false\n }\n },\n pathToThisNode,\n findLast\n )\n\n return found ? [found, foundPath] : null\n }\n\n forEachDescendantWithPath(iterator, path = PathUtils.create([]), findLast) {\n warning(\n false,\n 'As of slate@0.47, the `forEachDescendantWithPath` method is deprecated.'\n )\n\n let nodes = this.nodes\n let ret\n\n if (findLast) nodes = nodes.reverse()\n\n nodes.forEach((child, i) => {\n const childPath = path.concat(i)\n\n if (iterator(child, childPath, nodes) === false) {\n ret = false\n return false\n }\n\n if (child.object !== 'text') {\n ret = child.forEachDescendantWithPath(iterator, childPath, findLast)\n return ret\n }\n })\n\n return ret\n }\n\n getNextMatchingNodeAndPath(path, iterator = () => true) {\n warning(\n false,\n 'As of slate@0.47, the `getNextMatchingNodeAndPath` method is deprecated.'\n )\n\n if (!path) return null\n\n for (let i = path.size; i > 0; i--) {\n const p = path.slice(0, i)\n\n let nextPath = PathUtils.increment(p)\n let nextNode = this.getNode(nextPath)\n\n while (nextNode && !iterator(nextNode)) {\n nextPath = PathUtils.increment(nextPath)\n nextNode = this.getNode(nextPath)\n }\n\n if (nextNode) return [nextNode, nextPath]\n }\n\n return null\n }\n\n getSelectionIndexes(range, isSelected = true) {\n warning(\n false,\n 'As of slate@0.47, the `getSelectionIndexes` method is deprecated.'\n )\n\n const { start, end } = range\n\n // PERF: if we're not selected, we can exit early.\n if (!isSelected) {\n return null\n }\n\n // PERF: if we've been given an invalid selection we can exit early.\n if (range.isUnset) {\n return null\n }\n\n // PERF: if the start and end keys are the same, just check for the child\n // that contains that single key.\n if (start.path.equals(end.path)) {\n const child = this.getFurthestAncestor(start.path)\n const index = child ? this.nodes.indexOf(child) : null\n return { start: index, end: index + 1 }\n }\n\n // Otherwise, check all of the children...\n let startIndex = null\n let endIndex = null\n\n this.nodes.forEach((child, i) => {\n if (child.object === 'text') {\n if (startIndex == null && child.key === start.key) startIndex = i\n if (endIndex == null && child.key === end.key) endIndex = i + 1\n } else {\n if (startIndex == null && child.hasDescendant(start.key)) startIndex = i\n if (endIndex == null && child.hasDescendant(end.key)) endIndex = i + 1\n }\n\n // PERF: exit early if both start and end have been found.\n return startIndex == null || endIndex == null\n })\n\n if (isSelected && startIndex == null) {\n startIndex = 0\n }\n\n if (isSelected && endIndex == null) {\n endIndex = this.nodes.size\n }\n\n if (startIndex == null) {\n return null\n }\n\n return { start: startIndex, end: endIndex }\n }\n\n getTextsBetweenPositionsAsArray(startPath, endPath) {\n warning(\n false,\n 'As of slate@0.47, the `getTextsBetweenPositionsAsArray` method is deprecated.'\n )\n\n startPath = this.resolvePath(startPath)\n endPath = this.resolvePath(endPath)\n\n return this.getTextsBetweenPathPositionsAsArray(startPath, endPath)\n }\n\n getOrderedMarksBetweenPositions(startPath, startOffset, endPath, endOffset) {\n warning(\n false,\n 'As of slate@0.47, the `getOrderedMarksBetweenPositions` method is deprecated.'\n )\n\n startPath = this.resolvePath(startPath)\n endPath = this.resolvePath(endPath)\n const startText = this.getDescendant(startPath)\n\n // PERF: if the paths are equal, we can just use the start.\n if (PathUtils.isEqual(startPath, endPath)) {\n return startText.marks\n }\n\n const texts = this.getTextsBetweenPathPositionsAsArray(startPath, endPath)\n\n return OrderedSet().withMutations(result => {\n texts.forEach(text => {\n result.union(text.marks)\n })\n })\n }\n\n getTextsBetweenPathPositionsAsArray(startPath, endPath) {\n warning(\n false,\n 'As of slate@0.47, the `getTextsBetweenPathPositionsAsArray` method is deprecated.'\n )\n\n // PERF: the most common case is when the range is in a single text node,\n // where we can avoid a lot of iterating of the tree.\n if (startPath && endPath && PathUtils.isEqual(startPath, endPath)) {\n return [this.getDescendant(startPath)]\n } else if (!startPath && !endPath) {\n return this.getTextsAsArray()\n }\n\n const startIndex = startPath ? startPath.get(0, 0) : 0\n const endIndex = endPath\n ? endPath.get(0, this.nodes.size - 1)\n : this.nodes.size - 1\n\n let array = []\n\n this.nodes.slice(startIndex, endIndex + 1).forEach((node, i) => {\n if (node.object === 'text') {\n array.push(node)\n } else {\n // For the node at start and end of this list, we want to provide a start and end path\n // For other nodes, we can just get all their text nodes, they are between the paths\n const childStartPath =\n startPath && i === 0 ? PathUtils.drop(startPath) : null\n const childEndPath =\n endPath && i === endIndex - startIndex\n ? PathUtils.drop(endPath)\n : null\n\n array = array.concat(\n node.getTextsBetweenPathPositionsAsArray(childStartPath, childEndPath)\n )\n }\n })\n\n return array\n }\n\n getFurthestAncestor(path) {\n warning(\n false,\n 'As of slate@0.47, the `getFurthestAncestor` method has been renamed to `getFurthestChild`.'\n )\n\n return this.getFurthestChild(path)\n }\n\n getLeafBlocksAtRangeAsArray(range) {\n warning(\n false,\n 'As of slate@0.47, the `getLeafBlocksAtRangeAsArray` method is deprecated.'\n )\n\n range = this.resolveRange(range)\n if (range.isUnset) return []\n\n const { start, end } = range\n\n return this.getLeafBlocksBetweenPathPositionsAsArray(start.path, end.path)\n }\n\n getLeafBlocksBetweenPathPositionsAsArray(startPath, endPath) {\n warning(\n false,\n 'As of slate@0.47, the `getLeafBlocksBetweenPathPositionsAsArray` method is deprecated.'\n )\n\n // PERF: the most common case is when the range is in a single block node,\n // where we can avoid a lot of iterating of the tree.\n if (startPath && endPath && PathUtils.isEqual(startPath, endPath)) {\n return [this.getClosestBlock(startPath)]\n } else if (!startPath && !endPath) {\n return this.getBlocksAsArray()\n }\n\n const startIndex = startPath ? startPath.get(0, 0) : 0\n const endIndex = endPath\n ? endPath.get(0, this.nodes.size - 1)\n : this.nodes.size - 1\n\n let array = []\n\n this.nodes.slice(startIndex, endIndex + 1).forEach((node, i) => {\n if (node.object !== 'block') {\n return\n } else if (node.isLeafBlock()) {\n array.push(node)\n } else {\n const childStartPath =\n startPath && i === 0 ? PathUtils.drop(startPath) : null\n const childEndPath =\n endPath && i === endIndex - startIndex\n ? PathUtils.drop(endPath)\n : null\n\n array = array.concat(\n node.getLeafBlocksBetweenPathPositionsAsArray(\n childStartPath,\n childEndPath\n )\n )\n }\n })\n\n return array\n }\n\n getBlocksAsArray() {\n warning(\n false,\n 'As of slate@0.47, the `getBlocksAsArray` method is deprecated.'\n )\n\n const iterable = this.blocks({ onlyLeaves: true })\n const array = Array.from(iterable, ([node]) => node)\n return array\n }\n\n getBlocksByTypeAsArray(type) {\n warning(\n false,\n 'As of slate@0.47, the `getBlocksByTypeAsArray` method is deprecated.'\n )\n\n const iterable = this.blocks({ onlyLeaves: true, onlyTypes: [type] })\n const array = Array.from(iterable, ([node]) => node)\n return array\n }\n\n getFurthestOnlyChildAncestor(path) {\n warning(\n false,\n 'As of slate@0.47, the `getFurthestOnlyChildAncestor` method is deprecated.'\n )\n\n const ancestors = this.getAncestors(path)\n if (!ancestors) return null\n\n const furthest = ancestors\n .rest()\n .reverse()\n .takeUntil(p => p.nodes.size > 1)\n .last()\n\n return furthest || null\n }\n\n getInlinesAsArray() {\n warning(\n false,\n 'As of slate@0.47, the `getInlinesAsArray` method is deprecated.'\n )\n\n const array = Array.from(\n this.inlines({ onlyLeaves: true }),\n ([node]) => node\n )\n return array\n }\n\n getInlinesByTypeAsArray(type) {\n warning(\n false,\n 'As of slate@0.47, the `getInlinesByTypeAsArray` method is deprecated.'\n )\n\n const array = Array.from(\n this.inlines({ onlyLeaves: true, onlyTypes: [type] }),\n ([node]) => node\n )\n return array\n }\n\n getLeafInlinesAtRangeAsArray(range) {\n warning(\n false,\n 'As of slate@0.47, the `getLeafInlinesAtRangeAsArray` method is deprecated.'\n )\n\n range = this.resolveRange(range)\n if (range.isUnset) return []\n\n const array = this.getTextsAtRangeAsArray(range)\n .map(text => this.getClosestInline(text.key))\n .filter(exists => exists)\n\n return array\n }\n\n getOrderedMarks() {\n warning(\n false,\n 'As of slate@0.47, the `getOrderedMarks` method has been folded into `getMarks`, which will now return an ordered set.'\n )\n return this.getMarks()\n }\n\n getOrderedMarksAtRange(range) {\n warning(\n false,\n 'As of slate@0.47, the `getOrderedMarksAtRange` method has been folded into `getMarksAtRange`, which will now return an ordered set.'\n )\n return this.getMarksAtRange(range)\n }\n\n getOrderedMarksByType(type) {\n warning(\n false,\n 'As of slate@0.47, the `getOrderedMarksByType` method has been folded into `getMarksByType`, which will now return an ordered set.'\n )\n return this.getMarksByType(type)\n }\n\n getMarksByTypeAsArray(type) {\n warning(\n false,\n 'As of slate@0.47, the `getMarksByTypeAsArray` method is deprecated.'\n )\n\n const array = this.nodes.reduce((memo, node) => {\n return node.object === 'text'\n ? memo.concat(node.marks.filter(m => m.type === type))\n : memo.concat(node.getMarksByTypeAsArray(type))\n }, [])\n\n return array\n }\n\n getMarksAsArray() {\n warning(\n false,\n 'As of slate@0.47, the `getMarksAsArray` method is deprecated.'\n )\n\n const result = []\n\n for (const [node] of this.texts()) {\n result.push(node.marks.toArray())\n }\n\n // PERF: use only one concat rather than multiple for speed.\n const array = [].concat(...result)\n return array\n }\n\n getRootInlinesAtRangeAsArray(range) {\n warning(\n false,\n 'As of slate@0.47, the `getRootInlinesAtRangeAsArray` method is deprecated.'\n )\n\n range = this.resolveRange(range)\n if (range.isUnset) return List()\n\n const array = this.getTextsAtRangeAsArray(range)\n .map(text => this.getFurthestInline(text.key))\n .filter(exists => exists)\n\n return array\n }\n\n getTextsAsArray() {\n warning(\n false,\n 'As of slate@0.47, the `getTextsAsArray` method is deprecated.'\n )\n\n const iterable = this.texts()\n const array = Array.from(iterable, ([node]) => node)\n return array\n }\n\n getTextsAtRangeAsArray(range) {\n warning(\n false,\n 'As of slate@0.47, the `getTextsAtRangeAsArray` method is deprecated.'\n )\n\n const iterable = this.texts({ range })\n const array = Array.from(iterable, ([node]) => node)\n return array\n }\n\n getMarksAtPosition(path, offset) {\n warning(\n false,\n 'As of slate@0.47, the `getMarksAtPosition` method is deprecated.'\n )\n\n path = this.resolvePath(path)\n const text = this.getDescendant(path)\n const currentMarks = text.marks\n\n if (offset !== 0) {\n return OrderedSet(currentMarks)\n }\n\n const closestBlock = this.getClosestBlock(path)\n\n // insert mark for empty block; the empty block are often created by split node or add marks in a range including empty blocks\n if (closestBlock.text === '') {\n return OrderedSet(currentMarks)\n }\n\n const [previous] = this.texts({ path, direction: 'backward' })\n\n if (!previous) {\n return OrderedSet()\n }\n\n const [previousText, previousPath] = previous\n\n if (closestBlock.hasDescendant(previousPath)) {\n return OrderedSet(previousText.marks)\n }\n\n return OrderedSet(currentMarks)\n }\n\n getNodesAtRange(range) {\n warning(\n false,\n 'As of slate@0.47, the `getNodesAtRange` method has been renamed to `getDescendantsAtRange`.'\n )\n\n const iterable = this.descendants({ range })\n const array = Array.from(iterable, ([node]) => node)\n const list = List(array)\n return list\n }\n\n isNodeInRange(path, range) {\n warning(\n false,\n 'As of slate@0.47, the `isNodeInRange` method has been renamed to `isInRange`.'\n )\n\n return this.isInRange(path, range)\n }\n}\n\n/**\n * Mix in assertion variants.\n */\n\nconst ASSERTS = ['Child', 'Depth', 'Descendant', 'Node', 'Parent', 'Path']\n\nfor (const method of ASSERTS) {\n ElementInterface.prototype[`assert${method}`] = function(path, ...args) {\n const ret = this[`get${method}`](path, ...args)\n\n if (ret == null) {\n throw new Error(\n `\\`Node.assert${method}\\` could not find node with path or key: ${path}`\n )\n }\n\n return ret\n }\n}\n\n/**\n * Memoize read methods.\n */\n\nmemoize(ElementInterface.prototype, [\n 'getBlocksAsArray',\n 'getBlocksByTypeAsArray',\n 'getDecorations',\n 'getFragmentAtRange',\n 'getInlinesAsArray',\n 'getInlinesByTypeAsArray',\n 'getInsertMarksAtRange',\n 'getLeafBlocksAtRangeAsArray',\n 'getLeafBlocksAtRangeAsArray',\n 'getLeafInlinesAtRangeAsArray',\n 'getMarksAsArray',\n 'getMarksAtPosition',\n 'getMarksByTypeAsArray',\n 'getNextBlock',\n 'getNodesAtRange',\n 'getNodesToPathsMap',\n 'getOffset',\n 'getOffsetAtRange',\n 'getOrderedMarksBetweenPositions',\n 'getPreviousBlock',\n 'getRootBlocksAtRange',\n 'getRootInlinesAtRangeAsArray',\n 'getTextAtOffset',\n 'getTextDirection',\n 'getTextsAsArray',\n 'getTextsBetweenPathPositionsAsArray',\n])\n\n/**\n * Mix in the element interface.\n */\n\nmixin(ElementInterface, [Block, Document, Inline])\n","import mixin from '../utils/mixin'\nimport Annotation from '../models/annotation'\nimport Decoration from '../models/decoration'\nimport PathUtils from '../utils/path-utils'\nimport Point from '../models/point'\nimport Range from '../models/range'\nimport Selection from '../models/selection'\n\n/**\n * The interface that `Decoration`, `Range` and `Selection` all implement, to make\n * working anchor and focus points easier.\n *\n * @type {Class}\n */\n\nclass RangeInterface {\n /**\n * Check whether the range is collapsed.\n *\n * @return {Boolean}\n */\n\n get isCollapsed() {\n return (\n this.anchor === this.focus ||\n (this.anchor.key === this.focus.key &&\n this.anchor.offset === this.focus.offset)\n )\n }\n\n /**\n * Check whether the range is expanded.\n *\n * @return {Boolean}\n */\n\n get isExpanded() {\n return !this.isCollapsed\n }\n\n /**\n * Check whether the range is backward.\n *\n * @return {Boolean}\n */\n\n get isBackward() {\n const { isUnset, anchor, focus } = this\n\n if (isUnset) {\n return null\n }\n\n if (anchor.key === focus.key) {\n return anchor.offset > focus.offset\n }\n\n const isBackward = PathUtils.isBefore(focus.path, anchor.path)\n return isBackward\n }\n\n /**\n * Check whether the range is forward.\n *\n * @return {Boolean}\n */\n\n get isForward() {\n const { isBackward } = this\n const isForward = isBackward == null ? null : !isBackward\n return isForward\n }\n\n /**\n * Check whether the range isn't set.\n *\n * @return {Boolean}\n */\n\n get isUnset() {\n const { anchor, focus } = this\n const isUnset = anchor.isUnset || focus.isUnset\n return isUnset\n }\n\n /**\n * Check whether the range is set.\n *\n * @return {Boolean}\n */\n\n get isSet() {\n return !this.isUnset\n }\n\n /**\n * Get the start point.\n *\n * @return {String}\n */\n\n get start() {\n return this.isBackward ? this.focus : this.anchor\n }\n\n /**\n * Get the end point.\n *\n * @return {String}\n */\n\n get end() {\n return this.isBackward ? this.anchor : this.focus\n }\n\n /**\n * Flip the range.\n *\n * @return {Range}\n */\n\n flip() {\n const range = this.setPoints([this.focus, this.anchor])\n return range\n }\n\n /**\n * Move the anchor and focus offsets forward `n` characters.\n *\n * @param {Number} n\n * @return {Range}\n */\n\n moveForward(n) {\n return this.updatePoints(point => point.moveForward(n))\n }\n\n /**\n * Move the anchor and focus offsets backward `n` characters.\n *\n * @param {Number} n\n * @return {Range}\n */\n\n moveBackward(n) {\n return this.updatePoints(point => point.moveBackward(n))\n }\n\n /**\n * Move the anchor offset backward `n` characters.\n *\n * @param {Number} n\n * @return {Range}\n */\n\n moveAnchorBackward(n) {\n const range = this.setAnchor(this.anchor.moveBackward(n))\n return range\n }\n\n /**\n * Move the anchor offset forward `n` characters.\n *\n * @param {Number} n\n * @return {Range}\n */\n\n moveAnchorForward(n) {\n const range = this.setAnchor(this.anchor.moveForward(n))\n return range\n }\n\n /**\n * Move the range's anchor point to a new `path` and `offset`.\n *\n * Optionally, the `path` can be a key string, or omitted entirely in which\n * case it would be the offset number.\n *\n * @param {List|String} path\n * @param {Number} offset\n * @return {Range}\n */\n\n moveAnchorTo(path, offset) {\n const range = this.setAnchor(this.anchor.moveTo(path, offset))\n return range\n }\n\n /**\n * Move the range's anchor point to the start of a `node`.\n *\n * @param {Node} node\n * @return {Range}\n */\n\n moveAnchorToStartOfNode(node) {\n const range = this.setAnchor(this.anchor.moveToStartOfNode(node))\n return range\n }\n\n /**\n * Move the range's anchor point to the end of a `node`.\n *\n * @param {Node} node\n * @return {Range}\n */\n\n moveAnchorToEndOfNode(node) {\n const range = this.setAnchor(this.anchor.moveToEndOfNode(node))\n return range\n }\n\n /**\n * Move the end offset backward `n` characters.\n *\n * @param {Number} n\n * @return {Range}\n */\n\n moveEndBackward(n) {\n const range = this.setEnd(this.end.moveBackward(n))\n return range\n }\n\n /**\n * Move the end offset forward `n` characters.\n *\n * @param {Number} n\n * @return {Range}\n */\n\n moveEndForward(n) {\n const range = this.setEnd(this.end.moveForward(n))\n return range\n }\n\n /**\n * Move the range's end point to a new `path` and `offset`.\n *\n * Optionally, the `path` can be a key string, or omitted entirely in which\n * case it would be the offset number.\n *\n * @param {List|String} path\n * @param {Number} offset\n * @return {Range}\n */\n\n moveEndTo(path, offset) {\n const range = this.setEnd(this.end.moveTo(path, offset))\n return range\n }\n\n /**\n * Move the range's end point to the start of a `node`.\n *\n * @param {Node} node\n * @return {Range}\n */\n\n moveEndToStartOfNode(node) {\n const range = this.setEnd(this.end.moveToStartOfNode(node))\n return range\n }\n\n /**\n * Move the range's end point to the end of a `node`.\n *\n * @param {Node} node\n * @return {Range}\n */\n\n moveEndToEndOfNode(node) {\n const range = this.setEnd(this.end.moveToEndOfNode(node))\n return range\n }\n\n /**\n * Move the focus offset backward `n` characters.\n *\n * @param {Number} n\n * @return {Range}\n */\n\n moveFocusBackward(n) {\n const range = this.setFocus(this.focus.moveBackward(n))\n return range\n }\n\n /**\n * Move the focus offset forward `n` characters.\n *\n * @param {Number} n\n * @return {Range}\n */\n\n moveFocusForward(n) {\n const range = this.setFocus(this.focus.moveForward(n))\n return range\n }\n\n /**\n * Move the range's focus point to a new `path` and `offset`.\n *\n * Optionally, the `path` can be a key string, or omitted entirely in which\n * case it would be the offset number.\n *\n * @param {List|String} path\n * @param {Number} offset\n * @return {Range}\n */\n\n moveFocusTo(path, offset) {\n const range = this.setFocus(this.focus.moveTo(path, offset))\n return range\n }\n\n /**\n * Move the range's focus point to the start of a `node`.\n *\n * @param {Node} node\n * @return {Range}\n */\n\n moveFocusToStartOfNode(node) {\n const range = this.setFocus(this.focus.moveToStartOfNode(node))\n return range\n }\n\n /**\n * Move the range's focus point to the end of a `node`.\n *\n * @param {Node} node\n * @return {Range}\n */\n\n moveFocusToEndOfNode(node) {\n const range = this.setFocus(this.focus.moveToEndOfNode(node))\n return range\n }\n\n /**\n * Move the start offset backward `n` characters.\n *\n * @param {Number} n\n * @return {Range}\n */\n\n moveStartBackward(n) {\n const range = this.setStart(this.start.moveBackward(n))\n return range\n }\n\n /**\n * Move the start offset forward `n` characters.\n *\n * @param {Number} n\n * @return {Range}\n */\n\n moveStartForward(n) {\n const range = this.setStart(this.start.moveForward(n))\n return range\n }\n\n /**\n * Move the range's start point to a new `path` and `offset`.\n *\n * Optionally, the `path` can be a key string, or omitted entirely in which\n * case it would be the offset number.\n *\n * @param {List|String} path\n * @param {Number} offset\n * @return {Range}\n */\n\n moveStartTo(path, offset) {\n const range = this.setStart(this.start.moveTo(path, offset))\n return range\n }\n\n /**\n * Move the range's start point to the start of a `node`.\n *\n * @param {Node} node\n * @return {Range}\n */\n\n moveStartToStartOfNode(node) {\n const range = this.setStart(this.start.moveToStartOfNode(node))\n return range\n }\n\n /**\n * Move the range's start point to the end of a `node`.\n *\n * @param {Node} node\n * @return {Range}\n */\n\n moveStartToEndOfNode(node) {\n const range = this.setStart(this.start.moveToEndOfNode(node))\n return range\n }\n\n /**\n * Move range's points to a new `path` and `offset`.\n *\n * @param {Number} n\n * @return {Range}\n */\n\n moveTo(path, offset) {\n return this.updatePoints(point => point.moveTo(path, offset))\n }\n\n /**\n * Move the focus point to the anchor point.\n *\n * @return {Range}\n */\n\n moveToAnchor() {\n const range = this.setFocus(this.anchor)\n return range\n }\n\n /**\n * Move the start point to the end point.\n *\n * @return {Range}\n */\n\n moveToEnd() {\n const range = this.setStart(this.end)\n return range\n }\n\n /**\n * Move the range's points to the end of a `node`.\n *\n * @param {Node} node\n * @return {Range}\n */\n\n moveToEndOfNode(node) {\n return this.updatePoints(point => point.moveToEndOfNode(node))\n }\n\n /**\n * Move the anchor point to the focus point.\n *\n * @return {Range}\n */\n\n moveToFocus() {\n const range = this.setAnchor(this.focus)\n return range\n }\n\n /**\n * Move to the entire range of `start` and `end` nodes.\n *\n * @param {Node} start\n * @param {Node} end (optional)\n * @return {Range}\n */\n\n moveToRangeOfNode(start, end = start) {\n const range = this.setPoints([\n this.anchor.moveToStartOfNode(start),\n this.focus.moveToEndOfNode(end),\n ])\n\n return range\n }\n\n /**\n * Move the end point to the start point.\n *\n * @return {Range}\n */\n\n moveToStart() {\n const range = this.setEnd(this.start)\n return range\n }\n\n /**\n * Move the range's points to the start of a `node`.\n *\n * @param {Node} node\n * @return {Range}\n */\n\n moveToStartOfNode(node) {\n return this.updatePoints(point => point.moveToStartOfNode(node))\n }\n\n /**\n * Normalize the range, relative to a `node`, ensuring that the anchor\n * and focus nodes of the range always refer to leaf text nodes.\n *\n * @param {Node} node\n * @return {Range}\n */\n\n normalize(node) {\n return this.updatePoints(point => point.normalize(node))\n }\n\n /**\n * Set the anchor point to a new `anchor`.\n *\n * @param {Point} anchor\n * @return {Range}\n */\n\n setAnchor(anchor) {\n const range = this.set('anchor', anchor)\n return range\n }\n\n /**\n * Set the end point to a new `point`.\n *\n * @param {Point} point\n * @return {Range}\n */\n\n setEnd(point) {\n const range = this.isBackward ? this.setAnchor(point) : this.setFocus(point)\n return range\n }\n\n /**\n * Set the focus point to a new `focus`.\n *\n * @param {Point} focus\n * @return {Range}\n */\n\n setFocus(focus) {\n const range = this.set('focus', focus)\n return range\n }\n\n /**\n * Set the anchor and focus points to new `values`.\n *\n * @param {Array} values\n * @return {Range}\n */\n\n setPoints(values) {\n const [anchor, focus] = values\n const range = this.set('anchor', anchor).set('focus', focus)\n return range\n }\n\n /**\n * Set the anchor and focus points with `updater` callback\n *\n * @param {Function} updater\n * @return {Range}\n */\n\n updatePoints(updater) {\n let { anchor, focus } = this\n anchor = updater(anchor)\n focus = updater(focus)\n return this.merge({ anchor, focus })\n }\n\n /**\n * Set the start point to a new `point`.\n *\n * @param {Point} point\n * @return {Range}\n */\n\n setStart(point) {\n const range = this.isBackward ? this.setFocus(point) : this.setAnchor(point)\n return range\n }\n\n /**\n * Set new `properties` on the range.\n *\n * @param {Object|Range} properties\n * @return {Range}\n */\n\n setProperties(properties) {\n properties = Range.createProperties(properties)\n const { anchor, focus, ...props } = properties\n\n if (anchor) {\n props.anchor = Point.create(anchor)\n }\n\n if (focus) {\n props.focus = Point.create(focus)\n }\n\n const range = this.merge(props)\n return range\n }\n\n /**\n * Return a JSON representation of the range.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const object = {\n object: this.object,\n anchor: this.anchor.toJSON(options),\n focus: this.focus.toJSON(options),\n }\n\n return object\n }\n\n /**\n * Return a `Range` instance from any range-like instance.\n *\n * @return {Range}\n */\n\n toRange() {\n const properties = Range.createProperties(this)\n const range = Range.create(properties)\n return range\n }\n\n /**\n * Unset the range.\n *\n * @return {Range}\n */\n\n unset() {\n const range = this.updatePoints(p => p.unset())\n return range\n }\n}\n\n/**\n * Mix in the range interface.\n *\n * @param {Record}\n */\n\nmixin(RangeInterface, [Annotation, Decoration, Range, Selection])\n","import StyledComponents__default, { ThemeContext as ThemeContext$1, ThemeProvider as ThemeProvider$1 } from 'styled-components';\nimport { mergeDeepRight, pick } from 'ramda';\nimport { useContext, createElement, useMemo } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nexport { faFileDownload } from '@fortawesome/free-solid-svg-icons/faFileDownload';\nexport { faFileArchive } from '@fortawesome/free-solid-svg-icons/faFileArchive';\nexport { faFileAudio } from '@fortawesome/free-solid-svg-icons/faFileAudio';\nexport { faCheckCircle } from '@fortawesome/free-solid-svg-icons/faCheckCircle';\nexport { faFileExcel } from '@fortawesome/free-solid-svg-icons/faFileExcel';\nexport { faFileImage } from '@fortawesome/free-solid-svg-icons/faFileImage';\nexport { faFilePdf } from '@fortawesome/free-solid-svg-icons/faFilePdf';\nexport { faSmile } from '@fortawesome/free-solid-svg-icons/faSmile';\nexport { faFileWord } from '@fortawesome/free-solid-svg-icons/faFileWord';\nexport { faFileVideo } from '@fortawesome/free-solid-svg-icons/faFileVideo';\nexport { faFilePowerpoint } from '@fortawesome/free-solid-svg-icons/faFilePowerpoint';\nexport { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';\nexport { faCut } from '@fortawesome/free-solid-svg-icons/faCut';\nexport { faCog } from '@fortawesome/free-solid-svg-icons/faCog';\nexport { faCopy } from '@fortawesome/free-solid-svg-icons/faCopy';\nexport { faFileAlt } from '@fortawesome/free-solid-svg-icons/faFileAlt';\nexport { faImages } from '@fortawesome/free-solid-svg-icons/faImages';\nexport { faPhotoVideo } from '@fortawesome/free-solid-svg-icons/faPhotoVideo';\nexport { faLink } from '@fortawesome/free-solid-svg-icons/faLink';\nexport { faMinus } from '@fortawesome/free-solid-svg-icons/faMinus';\nexport { faPaste } from '@fortawesome/free-solid-svg-icons/faPaste';\nexport { faPencilAlt } from '@fortawesome/free-solid-svg-icons/faPencilAlt';\nexport { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';\nexport { faSpinner } from '@fortawesome/free-solid-svg-icons/faSpinner';\nexport { faTable } from '@fortawesome/free-solid-svg-icons/faTable';\nexport { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';\nexport { faTrashAlt } from '@fortawesome/free-solid-svg-icons/faTrashAlt';\nexport { faFilm } from '@fortawesome/free-solid-svg-icons/faFilm';\nexport { faCaretSquareUp } from '@fortawesome/free-solid-svg-icons/faCaretSquareUp';\nexport { faCaretSquareDown } from '@fortawesome/free-solid-svg-icons/faCaretSquareDown';\nexport { faSortUp } from '@fortawesome/free-solid-svg-icons/faSortUp';\nexport { faSortDown } from '@fortawesome/free-solid-svg-icons/faSortDown';\nexport { faToolbox } from '@fortawesome/free-solid-svg-icons/faToolbox';\nexport { faEllipsisH } from '@fortawesome/free-solid-svg-icons/faEllipsisH';\nexport { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';\nexport { faCloudUploadAlt } from '@fortawesome/free-solid-svg-icons/faCloudUploadAlt';\nexport { faQuestionCircle } from '@fortawesome/free-solid-svg-icons/faQuestionCircle';\nexport { faAnchor } from '@fortawesome/free-solid-svg-icons/faAnchor';\nexport { faQuoteRight } from '@fortawesome/free-solid-svg-icons/faQuoteRight';\nexport { faEquals } from '@fortawesome/free-solid-svg-icons/faEquals';\nexport { faCubes } from '@fortawesome/free-solid-svg-icons/faCubes';\nexport { faCode } from '@fortawesome/free-solid-svg-icons/faCode';\nexport { faLightbulb } from '@fortawesome/free-solid-svg-icons/faLightbulb';\nexport { faKeyboard } from '@fortawesome/free-solid-svg-icons/faKeyboard';\nexport { faDotCircle } from '@fortawesome/free-solid-svg-icons/faDotCircle';\nexport { faCheckSquare } from '@fortawesome/free-solid-svg-icons/faCheckSquare';\nexport { faParagraph } from '@fortawesome/free-solid-svg-icons/faParagraph';\nexport { faRedoAlt } from '@fortawesome/free-solid-svg-icons/faRedoAlt';\nexport { faRandom } from '@fortawesome/free-solid-svg-icons/faRandom';\nexport { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons/faExternalLinkAlt';\nexport { faNewspaper } from '@fortawesome/free-solid-svg-icons/faNewspaper';\n\n/** @public */\n\nvar defaultEditorTheme = {\n primary: {\n color: '#ffffff',\n background: 'rgb(70, 155, 255)'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n },\n color: '#EEEEEE',\n backgroundColor: 'rgba(51,51,51,0.95)'\n};\n/**\r\n * React Hook for the editor theming\r\n *\r\n * @returns An object containing the current {@link EditorTheme | editor theme} and {@link EditorUiTheme | editor UI theme}\r\n * @public\r\n */\n\nfunction useEditorTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link EditorThemeProps} to the current theme of the specified editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link EditorThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createEditorUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.editor), theme.editorUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of an editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useEditorUiTheme(key, createDefaultTheme) {\n var theme = useEditorTheme();\n return createEditorUiTheme(key, createDefaultTheme)(theme);\n}\n\n/**\r\n * Font Awesome Icon component\r\n *\r\n * @param props - Most of {@link https://github.com/FortAwesome/react-fontawesome | FontAwesomeIconProps}\r\n * @public\r\n */\n\nfunction Icon(props) {\n var allowedProps = pick(['icon', 'mask', 'className', 'color', 'spin', 'pulse', 'border', 'fixedWidth', 'inverse', 'listItem', 'flip', 'size', 'pull', 'rotation', 'transform', 'symbol', 'style', 'tabIndex', 'title'], props);\n return createElement(FontAwesomeIcon, Object.assign({}, allowedProps));\n}\n/**\r\n * Creates an icon component\r\n *\r\n * @param i - The icon to use\r\n * @returns A component for the specified icon\r\n * @public\r\n */\n\nfunction createIcon(i) {\n return function I() {\n return createElement(Icon, {\n icon: i,\n size: \"4x\"\n });\n };\n}\nvar EdtrSVG = /*#__PURE__*/StyledComponents__default.svg({\n display: 'inline-block',\n verticalAlign: 'middle',\n overflow: 'hidden'\n});\n/**\r\n * Edtr.io icon component\r\n *\r\n * @param props - An Edtr.io icon definition and an optional className\r\n * @returns The icon\r\n * @public\r\n */\n\nfunction EdtrIcon(props) {\n return createElement(EdtrSVG, {\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n className: props.className\n }, createElement(\"path\", {\n fill: \"currentcolor\",\n d: props.icon\n }));\n}\n/** @public */\n\nvar edtrAlignBlock = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignCenter = 'M7 16c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zm-3 5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm3-5c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignRight = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zm-6-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignLeft = 'M14 15H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zm0-8H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zM4 13h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0 8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrClose = 'M18.3,5.71 C17.91,5.32 17.28,5.32 16.89,5.71 L12,10.59 L7.11,5.7 C6.72,5.31 6.09,5.31 5.7,5.7 C5.31,6.09 5.31,6.72 5.7,7.11 L10.59,12 L5.7,16.89 C5.31,17.28 5.31,17.91 5.7,18.3 C6.09,18.69 6.72,18.69 7.11,18.3 L12,13.41 L16.89,18.3 C17.28,18.69 17.91,18.69 18.3,18.3 C18.69,17.91 18.69,17.28 18.3,16.89 L13.41,12 L18.3,7.11 C18.68,6.73 18.68,6.09 18.3,5.71 Z';\n/** @public */\n\nvar edtrFormula = 'M9.796061,6.84358189 L9.546061,9.73358189 L11.366061,9.73358189 C11.9183457,9.73358189 12.366061,10.1812971 12.366061,10.7335819 L12.366061,10.7335819 C12.366061,11.2858666 11.9183457,11.7335819 11.366061,11.7335819 L9.366061,11.7335819 L8.926061,16.8035819 C8.726061,19.0035819 6.786061,20.6335819 4.586061,20.4335819 C3.95133688,20.3777262 3.21218763,20.0027937 2.36861326,19.3087844 L2.3686112,19.3087869 C1.93754177,18.9541458 1.8755844,18.3172015 2.23022554,17.8861321 C2.25098506,17.8608987 2.27295601,17.8366869 2.296061,17.8135819 L2.296061,17.8135819 C2.68943711,17.4202058 3.31879167,17.3943638 3.74309403,17.7541652 C4.42335978,18.3310001 5.0243456,18.5341427 5.546061,18.3635819 C6.326061,18.1235819 6.876061,17.4335819 6.946061,16.6235819 L7.366061,11.7335819 L5.366061,11.7335819 C4.81377625,11.7335819 4.366061,11.2858666 4.366061,10.7335819 L4.366061,10.7335819 C4.366061,10.1812971 4.81377625,9.73358189 5.366061,9.73358189 L7.546061,9.73358189 L7.816061,6.66358189 C8.006061,4.46358189 9.936061,2.83358189 12.146061,3.01358189 C12.7876823,3.06959645 13.5343235,3.45039469 14.3859845,4.15597662 L14.3859731,4.15599041 C14.8171452,4.51320676 14.8770982,5.1523219 14.5198819,5.58349402 C14.4997127,5.60783893 14.4784158,5.63122712 14.456061,5.65358189 L14.456061,5.65358189 C14.077745,6.03189793 13.4644763,6.03223098 13.0857495,5.65432608 C12.6951429,5.26458609 12.3219165,5.05433484 11.966061,5.02358189 C10.866061,4.92358189 9.896061,5.73358189 9.796061,6.84358189 Z M20.841061,12.6785819 L20.841061,12.6785819 C20.4517003,12.2892211 19.8204217,12.2892211 19.431061,12.6785819 L17.306061,14.8035819 L15.1860786,12.6835995 C14.7931405,12.2906614 14.1567565,12.2884206 13.761061,12.6785819 L13.761061,12.6785819 C13.3689485,13.0652103 13.3645027,13.6965046 13.7511312,14.0886171 C13.7527745,14.0902837 13.7544236,14.0919445 13.7560786,14.0935995 L15.896061,16.2335819 L13.7610785,18.3385997 C13.3717179,18.7224956 13.3672879,19.3493438 13.7511838,19.7387045 C13.7544529,19.7420201 13.7577454,19.7453127 13.761061,19.7485819 L13.761061,19.7485819 C14.1567565,20.1387432 14.7931405,20.1365024 15.1860786,19.7435643 L17.306061,17.6235819 L19.431061,19.7485819 C19.8204217,20.1379426 20.4517003,20.1379426 20.841061,19.7485819 L20.841061,19.7485819 C21.2290435,19.3605994 21.2290435,18.7315555 20.841061,18.343573 C20.8402306,18.3427426 20.8393988,18.3419137 20.8385654,18.3410863 L18.716061,16.2335819 L20.8435477,14.0910599 C21.2319346,13.6999283 21.2308227,13.0683435 20.841061,12.6785819 Z';\n/** @public */\n\nvar edtrText = 'M2.5 5.5C2.5 6.33 3.17 7 4 7h3.5v10.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V7H14c.83 0 1.5-.67 1.5-1.5S14.83 4 14 4H4c-.83 0-1.5.67-1.5 1.5zM20 9h-6c-.83 0-1.5.67-1.5 1.5S13.17 12 14 12h1.5v5.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V12H20c.83 0 1.5-.67 1.5-1.5S20.83 9 20 9z';\n/** @public */\n\nvar edtrLink = 'M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1zm2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1z';\n/** @public */\n\nvar edtrQuote = 'M7.17 17c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94zm10 0c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94z';\n/** @public */\n\nvar edtrListNumbered = 'M8 7h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm12 10H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zm0-6H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zM4.5 16h-2c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5h-.5c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h2c.28 0 .5-.22.5-.5v-3c0-.28-.22-.5-.5-.5zm-2-11H3v2.5c0 .28.22.5.5.5s.5-.22.5-.5v-3c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5s.22.5.5.5zm2 5h-2c-.28 0-.5.22-.5.5s.22.5.5.5h1.3l-1.68 1.96c-.08.09-.12.21-.12.32v.22c0 .28.22.5.5.5h2c.28 0 .5-.22.5-.5s-.22-.5-.5-.5H3.2l1.68-1.96c.08-.09.12-.21.12-.32v-.22c0-.28-.22-.5-.5-.5z';\n/** @public */\n\nvar edtrListBullets = 'M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM8 19h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm0-6h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zM7 6c0 .55.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrItalic = 'M10 5.5c0 .83.67 1.5 1.5 1.5h.71l-3.42 8H7.5c-.83 0-1.5.67-1.5 1.5S6.67 18 7.5 18h5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5h-.71l3.42-8h1.29c.83 0 1.5-.67 1.5-1.5S17.33 4 16.5 4h-5c-.83 0-1.5.67-1.5 1.5z';\n/** @public */\n\nvar edtrColorText = 'M10.63 3.93L6.06 15.58c-.27.68.23 1.42.97 1.42.43 0 .82-.27.98-.68L8.87 14h6.25l.87 2.32c.15.41.54.68.98.68.73 0 1.24-.74.97-1.42L13.37 3.93C13.14 3.37 12.6 3 12 3c-.6 0-1.15.37-1.37.93zM9.62 12L12 5.67 14.38 12H9.62z';\n/** @public */\n\nvar edtrFill = 'M16.56 8.94L8.32.7C7.93.31 7.3.31 6.91.7c-.39.39-.39 1.02 0 1.41l1.68 1.68-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z';\n/** @public */\n\nvar edtrBold = 'M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H8c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h5.78c2.07 0 3.96-1.69 3.97-3.77.01-1.53-.85-2.84-2.15-3.44zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z';\n/** @public */\n\nvar edtrPlus = 'M12,2 C6.48,2 2,6.48 2,12 C2,17.52 6.48,22 12,22 C17.52,22 22,17.52 22,12 C22,6.48 17.52,2 12,2 Z M16,13 L13,13 L13,16 C13,16.55 12.55,17 12,17 C11.45,17 11,16.55 11,16 L11,13 L8,13 C7.45,13 7,12.55 7,12 C7,11.45 7.45,11 8,11 L11,11 L11,8 C11,7.45 11.45,7 12,7 C12.55,7 13,7.45 13,8 L13,11 L16,11 C16.55,11 17,11.45 17,12 C17,12.55 16.55,13 16,13 Z';\n/** @public */\n\nvar edtrSearch = 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z';\n/** @public */\n\nvar edtrDefaultPlugin = 'M20.6190476,11.5238095 L19.1904762,11.5238095 L19.1904762,7.71428571 C19.1904762,6.65714286 18.3333333,5.80952381 17.2857143,5.80952381 L13.4761905,5.80952381 L13.4761905,4.38095238 C13.4761905,3.06598869 12.4102018,2 11.0952381,2 C9.78027441,2 8.71428571,3.06598869 8.71428571,4.38095238 L8.71428571,5.80952381 L4.9047619,5.80952381 C3.85279095,5.80952381 3,6.66231476 3,7.71428571 L3,11.3333333 L4.42857143,11.3333333 C5.85714286,11.3333333 7,12.4761905 7,13.9047619 C7,15.3333333 5.85714286,16.4761905 4.42857143,16.4761905 L3,16.4761905 L3,20.0952381 C3,21.147209 3.85279095,22 4.9047619,22 L8.52380952,22 L8.52380952,20.5714286 C8.52380952,19.1428571 9.66666667,18 11.0952381,18 C12.5238095,18 13.6666667,19.1428571 13.6666667,20.5714286 L13.6666667,22 L17.2857143,22 C18.3376852,22 19.1904762,21.147209 19.1904762,20.0952381 L19.1904762,16.2857143 L20.6190476,16.2857143 C21.9340113,16.2857143 23,15.2197256 23,13.9047619 C23,12.5897982 21.9340113,11.5238095 20.6190476,11.5238095 Z';\n/** @public */\n\nvar edtrDragHandle = 'M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z';\n\n/** @public */\n\nvar defaultRendererTheme = {\n backgroundColor: '#ffffff',\n color: '#333333',\n primary: {\n color: '#ffffff',\n background: '#337ab7'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n }\n};\n/**\r\n * React Hook for the renderer theming\r\n *\r\n * @returns An object containing the current {@link RendererTheme | renderer theme} and {@link RendererUiTheme | renderer UI theme}\r\n * @public\r\n */\n\nfunction useRendererTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link RendererThemeProps} to the current theme of the specified renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link RendererThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createRendererUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.renderer), theme.rendererUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of a renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useRendererUiTheme(key, createDefaultTheme) {\n var theme = useRendererTheme();\n return createRendererUiTheme(key, createDefaultTheme)(theme);\n}\n\nvar defaultTheme = {\n editor: defaultEditorTheme,\n editorUi: {},\n renderer: defaultRendererTheme,\n rendererUi: {}\n}; // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to hydrate the context for the {@link Theme | Theme}\r\n *\r\n * @remarks\r\n * You probably don't want to use this component directly since it is already used by the core.\r\n * If you want to override the theme in some plugin, you probably want to use {@link ThemeProvider | ThemeProvider} instead.\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | default Theme}, and children\r\n * @public\r\n */\n\nfunction RootThemeProvider(props) {\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n/**\r\n * Context used for the {@link Theme | Theme}, see also {@link https://styled-components.com/docs/advanced#theming | Theming }\r\n *\r\n * @public\r\n */\n\nvar ThemeContext = ThemeContext$1;\n/**\r\n * React Hook to get the current {@link Theme | Theme}\r\n *\r\n * @returns The current {@link Theme | Theme}\r\n * @public\r\n */\n\nfunction useTheme() {\n return useContext(ThemeContext);\n} // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to override the current {@link Theme | theme}\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | current Theme}, and children\r\n * @public\r\n */\n\nfunction ThemeProvider(props) {\n var defaultTheme = useTheme();\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [defaultTheme, props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n\n/**\r\n * Provides utils for the User Interface\r\n *\r\n * @packageDocumentation\r\n */\n/**\r\n * Re-export of {@link https://styled-components.com/docs/api#primary | `styled` in `styled-components` }\r\n *\r\n * @public\r\n */\n\nvar styled = StyledComponents__default;\n\nexport { EdtrIcon, Icon, RootThemeProvider, ThemeContext, ThemeProvider, createEditorUiTheme, createIcon, createRendererUiTheme, defaultEditorTheme, defaultRendererTheme, edtrAlignBlock, edtrAlignCenter, edtrAlignLeft, edtrAlignRight, edtrBold, edtrClose, edtrColorText, edtrDefaultPlugin, edtrDragHandle, edtrFill, edtrFormula, edtrItalic, edtrLink, edtrListBullets, edtrListNumbered, edtrPlus, edtrQuote, edtrSearch, edtrText, styled, useEditorTheme, useEditorUiTheme, useRendererTheme, useRendererUiTheme, useTheme };\n\n","/** @license React v16.13.0\n * react-dom-server.browser.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var k=require(\"object-assign\"),l=require(\"react\");function q(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cH;H++)F[H]=H+1;F[15]=0;\nvar qa=/^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$/,ra=Object.prototype.hasOwnProperty,sa={},ta={};\nfunction ua(a){if(ra.call(ta,a))return!0;if(ra.call(sa,a))return!1;if(qa.test(a))return ta[a]=!0;sa[a]=!0;return!1}function va(a,b,c,d){if(null!==c&&0===c.type)return!1;switch(typeof b){case \"function\":case \"symbol\":return!0;case \"boolean\":if(d)return!1;if(null!==c)return!c.acceptsBooleans;a=a.toLowerCase().slice(0,5);return\"data-\"!==a&&\"aria-\"!==a;default:return!1}}\nfunction wa(a,b,c,d){if(null===b||\"undefined\"===typeof b||va(a,b,c,d))return!0;if(d)return!1;if(null!==c)switch(c.type){case 3:return!b;case 4:return!1===b;case 5:return isNaN(b);case 6:return isNaN(b)||1>b}return!1}function J(a,b,c,d,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=f;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=g}var K={};\n\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(a){K[a]=new J(a,0,!1,a,null,!1)});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(a){var b=a[0];K[b]=new J(b,1,!1,a[1],null,!1)});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(a){K[a]=new J(a,2,!1,a.toLowerCase(),null,!1)});\n[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(a){K[a]=new J(a,2,!1,a,null,!1)});\"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope\".split(\" \").forEach(function(a){K[a]=new J(a,3,!1,a.toLowerCase(),null,!1)});\n[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(a){K[a]=new J(a,3,!0,a,null,!1)});[\"capture\",\"download\"].forEach(function(a){K[a]=new J(a,4,!1,a,null,!1)});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(a){K[a]=new J(a,6,!1,a,null,!1)});[\"rowSpan\",\"start\"].forEach(function(a){K[a]=new J(a,5,!1,a.toLowerCase(),null,!1)});var L=/[\\-:]([a-z])/g;function M(a){return a[1].toUpperCase()}\n\"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height\".split(\" \").forEach(function(a){var b=a.replace(L,\nM);K[b]=new J(b,1,!1,a,null,!1)});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(a){var b=a.replace(L,M);K[b]=new J(b,1,!1,a,\"http://www.w3.org/1999/xlink\",!1)});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(a){var b=a.replace(L,M);K[b]=new J(b,1,!1,a,\"http://www.w3.org/XML/1998/namespace\",!1)});[\"tabIndex\",\"crossOrigin\"].forEach(function(a){K[a]=new J(a,1,!1,a.toLowerCase(),null,!1)});\nK.xlinkHref=new J(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(a){K[a]=new J(a,1,!1,a.toLowerCase(),null,!0)});var xa=/[\"'&<>]/;\nfunction N(a){if(\"boolean\"===typeof a||\"number\"===typeof a)return\"\"+a;a=\"\"+a;var b=xa.exec(a);if(b){var c=\"\",d,f=0;for(d=b.index;dV))throw Error(q(301));if(a===O)if(S=!0,a={action:c,next:null},null===U&&(U=new Map),c=U.get(b),void 0===c)U.set(b,a);else{for(b=c;null!==b.next;)b=b.next;b.next=a}}function Ha(){}\nvar X=0,Ia={readContext:function(a){var b=X;E(a,b);return a[b]},useContext:function(a){W();var b=X;E(a,b);return a[b]},useMemo:function(a,b){O=W();Q=Ca();b=void 0===b?null:b;if(null!==Q){var c=Q.memoizedState;if(null!==c&&null!==b){a:{var d=c[1];if(null===d)d=!1;else{for(var f=0;f=d))throw Error(q(304));var h=new Uint16Array(d);h.set(g);F=h;F[0]=c+1;for(g=c;g=\ne.children.length){var I=e.footer;\"\"!==I&&(this.previousWasTextNode=!1);this.stack.pop();if(\"select\"===e.type)this.currentSelectValue=null;else if(null!=e.type&&null!=e.type.type&&e.type.type.$$typeof===v)this.popProvider(e.type);else if(e.type===B){this.suspenseDepth--;var G=g.pop();if(x){x=!1;var n=e.fallbackFrame;if(!n)throw Error(q(303));this.stack.push(n);g[this.suspenseDepth]+=\"\\x3c!--$!--\\x3e\";continue}else g[this.suspenseDepth]+=G}g[this.suspenseDepth]+=I}else{var m=e.children[e.childIndex++],\nw=\"\";try{w+=this.render(m,e.context,e.domNamespace)}catch(r){if(null!=r&&\"function\"===typeof r.then)throw Error(q(294));throw r;}finally{}g.length<=this.suspenseDepth&&g.push(\"\");g[this.suspenseDepth]+=w}}return g[0]}finally{Qa.current=c,X=b}};b.render=function(a,b,f){if(\"string\"===typeof a||\"number\"===typeof a){f=\"\"+a;if(\"\"===f)return\"\";if(this.makeStaticMarkup)return N(f);if(this.previousWasTextNode)return\"\\x3c!-- --\\x3e\"+N(f);this.previousWasTextNode=!0;return N(f)}b=Za(a,b,this.threadID);a=b.child;\nb=b.context;if(null===a||!1===a)return\"\";if(!l.isValidElement(a)){if(null!=a&&null!=a.$$typeof){f=a.$$typeof;if(f===aa)throw Error(q(257));throw Error(q(258,f.toString()));}a=Z(a);this.stack.push({type:null,domNamespace:f,children:a,childIndex:0,context:b,footer:\"\"});return\"\"}var c=a.type;if(\"string\"===typeof c)return this.renderDOM(a,b,f);switch(c){case ba:case ea:case ca:case ha:case u:return a=Z(a.props.children),this.stack.push({type:null,domNamespace:f,children:a,childIndex:0,context:b,footer:\"\"}),\n\"\";case B:throw Error(q(294));}if(\"object\"===typeof c&&null!==c)switch(c.$$typeof){case fa:O={};var d=c.render(a.props,a.ref);d=Da(c.render,a.props,d,a.ref);d=Z(d);this.stack.push({type:null,domNamespace:f,children:d,childIndex:0,context:b,footer:\"\"});return\"\";case ia:return a=[l.createElement(c.type,k({ref:a.ref},a.props))],this.stack.push({type:null,domNamespace:f,children:a,childIndex:0,context:b,footer:\"\"}),\"\";case v:return c=Z(a.props.children),f={type:a,domNamespace:f,children:c,childIndex:0,\ncontext:b,footer:\"\"},this.pushProvider(a),this.stack.push(f),\"\";case da:c=a.type;d=a.props;var h=this.threadID;E(c,h);c=Z(d.children(c[h]));this.stack.push({type:a,domNamespace:f,children:c,childIndex:0,context:b,footer:\"\"});return\"\";case la:throw Error(q(338));case ja:switch(c=a.type,na(c),c._status){case 1:return a=[l.createElement(c._result,k({ref:a.ref},a.props))],this.stack.push({type:null,domNamespace:f,children:a,childIndex:0,context:b,footer:\"\"}),\"\";case 2:throw c._result;default:throw Error(q(295));\n}case ma:throw Error(q(343));}throw Error(q(130,null==c?c:typeof c,\"\"));};b.renderDOM=function(a,b,f){var c=a.type.toLowerCase();f===Ja.html&&Ka(c);if(!Ta.hasOwnProperty(c)){if(!Sa.test(c))throw Error(q(65,c));Ta[c]=!0}var d=a.props;if(\"input\"===c)d=k({type:void 0},d,{defaultChecked:void 0,defaultValue:void 0,value:null!=d.value?d.value:d.defaultValue,checked:null!=d.checked?d.checked:d.defaultChecked});else if(\"textarea\"===c){var h=d.value;if(null==h){h=d.defaultValue;var e=d.children;if(null!=e){if(null!=\nh)throw Error(q(92));if(Array.isArray(e)){if(!(1>=e.length))throw Error(q(93));e=e[0]}h=\"\"+e}null==h&&(h=\"\")}d=k({},d,{value:void 0,children:\"\"+h})}else if(\"select\"===c)this.currentSelectValue=null!=d.value?d.value:d.defaultValue,d=k({},d,{value:void 0});else if(\"option\"===c){e=this.currentSelectValue;var I=Va(d.children);if(null!=e){var G=null!=d.value?d.value+\"\":I;h=!1;if(Array.isArray(e))for(var n=0;n\":(z+=\">\",h=\"\");a:{e=d.dangerouslySetInnerHTML;if(null!=e){if(null!=e.__html){e=e.__html;break a}}else if(e=d.children,\"string\"===typeof e||\"number\"===typeof e){e=N(e);break a}e=null}null!=e?(d=[],Ra.hasOwnProperty(c)&&\"\\n\"===e.charAt(0)&&(z+=\"\\n\"),z+=e):d=Z(d.children);a=a.type;f=null==f||\"http://www.w3.org/1999/xhtml\"===\nf?Ka(a):\"http://www.w3.org/2000/svg\"===f&&\"foreignObject\"===a?\"http://www.w3.org/1999/xhtml\":f;this.stack.push({domNamespace:f,type:c,children:d,childIndex:0,context:b,footer:h});this.previousWasTextNode=!1;return z};return a}(),ab={renderToString:function(a){a=new $a(a,!1);try{return a.read(Infinity)}finally{a.destroy()}},renderToStaticMarkup:function(a){a=new $a(a,!0);try{return a.read(Infinity)}finally{a.destroy()}},renderToNodeStream:function(){throw Error(q(207));},renderToStaticNodeStream:function(){throw Error(q(208));\n},version:\"16.13.0\"};module.exports=ab.default||ab;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-dom-server.browser.production.min.js');\n} else {\n module.exports = require('./cjs/react-dom-server.browser.development.js');\n}\n","var toString = Object.prototype.toString\r\n\r\nmodule.exports = function(val){\r\n switch (toString.call(val)) {\r\n case '[object Function]': return 'function'\r\n case '[object Date]': return 'date'\r\n case '[object RegExp]': return 'regexp'\r\n case '[object Arguments]': return 'arguments'\r\n case '[object Array]': return 'array'\r\n case '[object String]': return 'string'\r\n }\r\n\r\n if (typeof val == 'object' && val && typeof val.length == 'number') {\r\n try {\r\n if (typeof val.callee == 'function') return 'arguments';\r\n } catch (ex) {\r\n if (ex instanceof TypeError) {\r\n return 'arguments';\r\n }\r\n }\r\n }\r\n\r\n if (val === null) return 'null'\r\n if (val === undefined) return 'undefined'\r\n if (val && val.nodeType === 1) return 'element'\r\n if (val === Object(val)) return 'object'\r\n\r\n return typeof val\r\n}\r\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\n/**\n * Constants.\n */\n\nvar IS_MAC = typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);\n\nvar MODIFIERS = {\n alt: 'altKey',\n control: 'ctrlKey',\n meta: 'metaKey',\n shift: 'shiftKey'\n};\n\nvar ALIASES = {\n add: '+',\n break: 'pause',\n cmd: 'meta',\n command: 'meta',\n ctl: 'control',\n ctrl: 'control',\n del: 'delete',\n down: 'arrowdown',\n esc: 'escape',\n ins: 'insert',\n left: 'arrowleft',\n mod: IS_MAC ? 'meta' : 'control',\n opt: 'alt',\n option: 'alt',\n return: 'enter',\n right: 'arrowright',\n space: ' ',\n spacebar: ' ',\n up: 'arrowup',\n win: 'meta',\n windows: 'meta'\n};\n\nvar CODES = {\n backspace: 8,\n tab: 9,\n enter: 13,\n shift: 16,\n control: 17,\n alt: 18,\n pause: 19,\n capslock: 20,\n escape: 27,\n ' ': 32,\n pageup: 33,\n pagedown: 34,\n end: 35,\n home: 36,\n arrowleft: 37,\n arrowup: 38,\n arrowright: 39,\n arrowdown: 40,\n insert: 45,\n delete: 46,\n meta: 91,\n numlock: 144,\n scrolllock: 145,\n ';': 186,\n '=': 187,\n ',': 188,\n '-': 189,\n '.': 190,\n '/': 191,\n '`': 192,\n '[': 219,\n '\\\\': 220,\n ']': 221,\n '\\'': 222\n};\n\nfor (var f = 1; f < 20; f++) {\n CODES['f' + f] = 111 + f;\n}\n\n/**\n * Is hotkey?\n */\n\nfunction isHotkey(hotkey, options, event) {\n if (options && !('byKey' in options)) {\n event = options;\n options = null;\n }\n\n if (!Array.isArray(hotkey)) {\n hotkey = [hotkey];\n }\n\n var array = hotkey.map(function (string) {\n return parseHotkey(string, options);\n });\n var check = function check(e) {\n return array.some(function (object) {\n return compareHotkey(object, e);\n });\n };\n var ret = event == null ? check : check(event);\n return ret;\n}\n\nfunction isCodeHotkey(hotkey, event) {\n return isHotkey(hotkey, event);\n}\n\nfunction isKeyHotkey(hotkey, event) {\n return isHotkey(hotkey, { byKey: true }, event);\n}\n\n/**\n * Parse.\n */\n\nfunction parseHotkey(hotkey, options) {\n var byKey = options && options.byKey;\n var ret = {};\n\n // Special case to handle the `+` key since we use it as a separator.\n hotkey = hotkey.replace('++', '+add');\n var values = hotkey.split('+');\n var length = values.length;\n\n // Ensure that all the modifiers are set to false unless the hotkey has them.\n\n for (var k in MODIFIERS) {\n ret[MODIFIERS[k]] = false;\n }\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var value = _step.value;\n\n var optional = value.endsWith('?') && value.length > 1;\n\n if (optional) {\n value = value.slice(0, -1);\n }\n\n var name = toKeyName(value);\n var modifier = MODIFIERS[name];\n\n if (length === 1 || !modifier) {\n if (byKey) {\n ret.key = name;\n } else {\n ret.which = toKeyCode(value);\n }\n }\n\n if (modifier) {\n ret[modifier] = optional ? null : true;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return ret;\n}\n\n/**\n * Compare.\n */\n\nfunction compareHotkey(object, event) {\n for (var key in object) {\n var expected = object[key];\n var actual = void 0;\n\n if (expected == null) {\n continue;\n }\n\n if (key === 'key' && event.key != null) {\n actual = event.key.toLowerCase();\n } else if (key === 'which') {\n actual = expected === 91 && event.which === 93 ? 91 : event.which;\n } else {\n actual = event[key];\n }\n\n if (actual == null && expected === false) {\n continue;\n }\n\n if (actual !== expected) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Utils.\n */\n\nfunction toKeyCode(name) {\n name = toKeyName(name);\n var code = CODES[name] || name.toUpperCase().charCodeAt(0);\n return code;\n}\n\nfunction toKeyName(name) {\n name = name.toLowerCase();\n name = ALIASES[name] || name;\n return name;\n}\n\n/**\n * Export.\n */\n\nexports.default = isHotkey;\nexports.isHotkey = isHotkey;\nexports.isCodeHotkey = isCodeHotkey;\nexports.isKeyHotkey = isKeyHotkey;\nexports.parseHotkey = parseHotkey;\nexports.compareHotkey = compareHotkey;\nexports.toKeyCode = toKeyCode;\nexports.toKeyName = toKeyName;","import { Block, Text } from 'slate';\nimport React from 'react';\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nfunction _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nfunction _iterableToArrayLimit(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n}\n\nfunction _defineProperty$1(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _objectSpread$1(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n _defineProperty$1(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nfunction unwrapExports (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x.default : x;\n}\n\nfunction createCommonjsModule(fn, module) {\n\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n}\n\nvar lib = createCommonjsModule(function (module, exports) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\n/**\n * Constants.\n */\n\nvar IS_MAC = typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);\n\nvar MODIFIERS = {\n alt: 'altKey',\n control: 'ctrlKey',\n meta: 'metaKey',\n shift: 'shiftKey'\n};\n\nvar ALIASES = {\n add: '+',\n break: 'pause',\n cmd: 'meta',\n command: 'meta',\n ctl: 'control',\n ctrl: 'control',\n del: 'delete',\n down: 'arrowdown',\n esc: 'escape',\n ins: 'insert',\n left: 'arrowleft',\n mod: IS_MAC ? 'meta' : 'control',\n opt: 'alt',\n option: 'alt',\n return: 'enter',\n right: 'arrowright',\n space: ' ',\n spacebar: ' ',\n up: 'arrowup',\n win: 'meta',\n windows: 'meta'\n};\n\nvar CODES = {\n backspace: 8,\n tab: 9,\n enter: 13,\n shift: 16,\n control: 17,\n alt: 18,\n pause: 19,\n capslock: 20,\n escape: 27,\n ' ': 32,\n pageup: 33,\n pagedown: 34,\n end: 35,\n home: 36,\n arrowleft: 37,\n arrowup: 38,\n arrowright: 39,\n arrowdown: 40,\n insert: 45,\n delete: 46,\n meta: 91,\n numlock: 144,\n scrolllock: 145,\n ';': 186,\n '=': 187,\n ',': 188,\n '-': 189,\n '.': 190,\n '/': 191,\n '`': 192,\n '[': 219,\n '\\\\': 220,\n ']': 221,\n '\\'': 222\n};\n\nfor (var f = 1; f < 20; f++) {\n CODES['f' + f] = 111 + f;\n}\n\n/**\n * Is hotkey?\n */\n\nfunction isHotkey(hotkey, options, event) {\n if (options && !('byKey' in options)) {\n event = options;\n options = null;\n }\n\n if (!Array.isArray(hotkey)) {\n hotkey = [hotkey];\n }\n\n var array = hotkey.map(function (string) {\n return parseHotkey(string, options);\n });\n var check = function check(e) {\n return array.some(function (object) {\n return compareHotkey(object, e);\n });\n };\n var ret = event == null ? check : check(event);\n return ret;\n}\n\nfunction isCodeHotkey(hotkey, event) {\n return isHotkey(hotkey, event);\n}\n\nfunction isKeyHotkey(hotkey, event) {\n return isHotkey(hotkey, { byKey: true }, event);\n}\n\n/**\n * Parse.\n */\n\nfunction parseHotkey(hotkey, options) {\n var byKey = options && options.byKey;\n var ret = {};\n\n // Special case to handle the `+` key since we use it as a separator.\n hotkey = hotkey.replace('++', '+add');\n var values = hotkey.split('+');\n var length = values.length;\n\n // Ensure that all the modifiers are set to false unless the hotkey has them.\n\n for (var k in MODIFIERS) {\n ret[MODIFIERS[k]] = false;\n }\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var value = _step.value;\n\n var optional = value.endsWith('?');\n\n if (optional) {\n value = value.slice(0, -1);\n }\n\n var name = toKeyName(value);\n var modifier = MODIFIERS[name];\n\n if (length === 1 || !modifier) {\n if (byKey) {\n ret.key = name;\n } else {\n ret.which = toKeyCode(value);\n }\n }\n\n if (modifier) {\n ret[modifier] = optional ? null : true;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return ret;\n}\n\n/**\n * Compare.\n */\n\nfunction compareHotkey(object, event) {\n for (var key in object) {\n var expected = object[key];\n var actual = void 0;\n\n if (expected == null) {\n continue;\n }\n\n if (key === 'key') {\n actual = event.key.toLowerCase();\n } else if (key === 'which') {\n actual = expected === 91 && event.which === 93 ? 91 : event.which;\n } else {\n actual = event[key];\n }\n\n if (actual == null && expected === false) {\n continue;\n }\n\n if (actual !== expected) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Utils.\n */\n\nfunction toKeyCode(name) {\n name = toKeyName(name);\n var code = CODES[name] || name.toUpperCase().charCodeAt(0);\n return code;\n}\n\nfunction toKeyName(name) {\n name = name.toLowerCase();\n name = ALIASES[name] || name;\n return name;\n}\n\n/**\n * Export.\n */\n\nexports.default = isHotkey;\nexports.isHotkey = isHotkey;\nexports.isCodeHotkey = isCodeHotkey;\nexports.isKeyHotkey = isKeyHotkey;\nexports.parseHotkey = parseHotkey;\nexports.compareHotkey = compareHotkey;\nexports.toKeyCode = toKeyCode;\nexports.toKeyName = toKeyName;\n});\n\nvar isHotkey = unwrapExports(lib);\nvar lib_1 = lib.isHotkey;\nvar lib_2 = lib.isCodeHotkey;\nvar lib_3 = lib.isKeyHotkey;\nvar lib_4 = lib.parseHotkey;\nvar lib_5 = lib.compareHotkey;\nvar lib_6 = lib.toKeyCode;\nvar lib_7 = lib.toKeyName;\n\nvar Keymap = function Keymap(shortcuts, options) {\n var config = _objectSpread$1({\n if: function _if() {\n return true;\n }\n }, options);\n\n var functions = Object.keys(shortcuts).map(function (key) {\n var isKeyPressed = isHotkey(key);\n var command = shortcuts[key];\n\n var check = function check(event, editor) {\n return isKeyPressed(event) && config.if(editor);\n };\n\n var handler = typeof command == \"string\" ? function (event, editor) {\n event.preventDefault();\n editor.command(command);\n } : command;\n return {\n check: check,\n handler: handler\n };\n });\n return {\n onKeyDown: function onKeyDown(event, editor, next) {\n var shortcut = functions.find(function (shortcut) {\n return shortcut.check(event, editor);\n });\n\n if (shortcut) {\n return shortcut.handler(event, editor, next);\n } else {\n return next();\n }\n }\n };\n};\n\nvar isList = function isList(blocks, block) {\n return block.type == blocks.unordered_list || block.type == blocks.ordered_list;\n};\n\nvar wrapList = (function (_ref, editor) {\n var blocks = _ref.blocks;\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var type = options.type || blocks.unordered_list;\n var rootBlocks = editor.value.document.getRootBlocksAtRange(editor.value.selection);\n editor.withoutNormalizing(function () {\n rootBlocks.forEach(function (block) {\n if (isList(blocks, block)) return;\n editor.wrapBlockByKey(block.key, type);\n editor.wrapBlockByKey(block.key, blocks.list_item);\n editor.setNodeByKey(block.key, blocks.list_item_child);\n });\n });\n});\n\nvar unwrapListByKey = (function (_ref, editor, key) {\n var blocks = _ref.blocks;\n var listItem = editor.value.document.getNode(key);\n editor.withoutNormalizing(function () {\n editor.unwrapNodeByKey(listItem.key);\n var parent = editor.value.document.getParent(listItem.key);\n var itemIndex = parent.nodes.findIndex(function (node) {\n return node.key === listItem.key;\n });\n listItem.nodes.forEach(function (itemChild, index) {\n editor.moveNodeByKey(itemChild.key, parent.key, index + itemIndex);\n\n if (itemChild.type == blocks.list_item_child) {\n editor.setNodeByKey(itemChild.key, {\n type: blocks.default\n });\n }\n });\n editor.removeNodeByKey(listItem.key);\n });\n});\n\nvar unwrapList = (function (_ref, editor) {\n var blocks = _ref.blocks;\n var listItemChildren = editor.value.document.getNodesAtRange(editor.value.selection).filter(function (node) {\n return node.type == blocks.list_item_child;\n });\n var furthestListItems = listItemChildren.map(function (listItemChild) {\n return editor.value.document.getFurthest(listItemChild.key, function (node) {\n return node.type == blocks.list_item;\n });\n }).filter(function (listItemChild, index, array) {\n return array.indexOf(listItemChild) == index;\n });\n furthestListItems.forEach(function (listItem) {\n unwrapListByKey({\n blocks: blocks\n }, editor, listItem.key);\n });\n});\n\nvar toggleList = (function (_ref, editor) {\n var blocks = _ref.blocks;\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var _editor$value = editor.value,\n document = _editor$value.document,\n startBlock = _editor$value.startBlock;\n var type = options.type || blocks.unordered_list;\n var parent = document.getParent(startBlock.key);\n var isList = parent.type == blocks.list_item;\n if (!isList) return editor.wrapList({\n type: type\n });\n var list = document.getParent(parent.key);\n var sameType = list.type == type;\n\n if (sameType) {\n editor.unwrapList();\n } else {\n editor.setNodeByKey(list.key, type);\n }\n});\n\nvar decreaseListItemDepth = (function (_ref, editor) {\n var blocks = _ref.blocks;\n var _editor$value = editor.value,\n document = _editor$value.document,\n startBlock = _editor$value.startBlock;\n var listItem = document.getParent(startBlock.key);\n if (listItem.type != blocks.list_item) return;\n var list = document.getParent(listItem.key);\n var parentListItem = document.getParent(list.key);\n if (parentListItem.type != blocks.list_item) return;\n var parentList = document.getParent(parentListItem.key);\n var index = parentList.nodes.indexOf(parentListItem);\n var otherItems = list.nodes.skipUntil(function (item) {\n return item === listItem;\n }).rest();\n\n if (!otherItems.isEmpty()) {\n var newList = Block.create({\n object: \"block\",\n type: list.type\n });\n editor.withoutNormalizing(function () {\n editor.insertNodeByKey(listItem.key, listItem.nodes.size, newList);\n editor.moveNodeByKey(listItem.key, parentList.key, index + 1);\n otherItems.forEach(function (item, index) {\n return editor.moveNodeByKey(item.key, newList.key, newList.nodes.size + index);\n });\n });\n } else {\n editor.moveNodeByKey(listItem.key, parentList.key, index + 1);\n }\n});\n\nvar increaseListItemDepth = (function (_ref, editor) {\n var blocks = _ref.blocks;\n var _editor$value = editor.value,\n document = _editor$value.document,\n startBlock = _editor$value.startBlock;\n var listItem = document.getParent(startBlock.key);\n var previousListItem = document.getPreviousSibling(listItem.key);\n var list = document.getParent(listItem.key);\n if (!listItem) return;\n if (!previousListItem) return; // Because of our schema constraints, we know that the second item must be a\n // list if it exists.\n\n var existingList = previousListItem.nodes.get(1);\n\n if (existingList) {\n editor.withoutNormalizing(function () {\n editor.moveNodeByKey(listItem.key, existingList.key, existingList.nodes.size);\n });\n } else {\n var newList = Block.create({\n object: \"block\",\n type: list.type\n });\n editor.withoutNormalizing(function () {\n editor.insertNodeByKey(previousListItem.key, previousListItem.nodes.size, newList);\n editor.moveNodeByKey(listItem.key, newList.key, 0);\n });\n }\n});\n\nvar wrapWithOptions = function wrapWithOptions(fn, options) {\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return fn.apply(void 0, [options].concat(args));\n };\n};\n\nvar createCommands = (function (options) {\n return {\n wrapList: wrapWithOptions(wrapList, options),\n unwrapList: wrapWithOptions(unwrapList, options),\n toggleList: wrapWithOptions(toggleList, options),\n unwrapListByKey: wrapWithOptions(unwrapListByKey, options),\n decreaseListItemDepth: wrapWithOptions(decreaseListItemDepth, options),\n increaseListItemDepth: wrapWithOptions(increaseListItemDepth, options)\n };\n});\n\nvar sameType = function sameType(node, other) {\n return node.type == other.type;\n};\n\nvar createNormalizeNode = (function (_ref) {\n var blocks = _ref.blocks;\n\n var isList = function isList(block) {\n return block && (block.type == blocks.unordered_list || block.type == blocks.ordered_list);\n };\n\n return function (node, editor, next) {\n if (node.object !== \"document\" && node.object !== \"block\") return next();\n var mergable = node.nodes.map(function (child, index) {\n if (!isList(child)) {\n return null;\n }\n\n var adjacent = node.nodes.get(index + 1);\n\n if (!adjacent || !isList(adjacent) || !sameType(child, adjacent)) {\n return null;\n }\n\n return [child, adjacent];\n }).filter(function (node) {\n return node;\n });\n if (mergable.isEmpty()) return next();\n return function (editor) {\n mergable.reverse().forEach(function (_ref2) {\n var _ref3 = _slicedToArray(_ref2, 2),\n list = _ref3[0],\n adjacent = _ref3[1];\n\n var updatedAdjacent = editor.value.document.getDescendant(adjacent.key);\n updatedAdjacent.nodes.forEach(function (child, index) {\n editor.withoutNormalizing(function () {\n editor.moveNodeByKey(child.key, list.key, list.nodes.size + index);\n });\n });\n editor.withoutNormalizing(function () {\n editor.removeNodeByKey(adjacent.key);\n });\n });\n };\n };\n});\n\nvar createRenderBlock = (function (_ref) {\n var blocks = _ref.blocks,\n classNames = _ref.classNames;\n return function (props, editor, next) {\n var node = props.node;\n\n switch (node.type) {\n case blocks.unordered_list:\n return React.createElement(\"ul\", _extends({\n className: classNames.unordered_list\n }, props.attributes), props.children);\n\n case blocks.ordered_list:\n {\n return React.createElement(\"ol\", _extends({\n className: classNames.ordered_list\n }, props.attributes), props.children);\n }\n\n case blocks.list_item:\n {\n return React.createElement(\"li\", _extends({\n className: classNames.list_item\n }, props.attributes), props.children);\n }\n\n case blocks.list_item_child:\n {\n return React.createElement(\"div\", _extends({\n className: classNames.list_item_child\n }, props.attributes), props.children);\n }\n\n default:\n return next();\n }\n };\n});\n\nvar createSchema = (function (_ref) {\n var _blocks;\n\n var blocks = _ref.blocks;\n return {\n blocks: (_blocks = {}, _defineProperty(_blocks, blocks.unordered_list, {\n nodes: [{\n match: {\n type: blocks.list_item\n }\n }]\n }), _defineProperty(_blocks, blocks.ordered_list, {\n nodes: [{\n match: {\n type: blocks.list_item\n }\n }]\n }), _defineProperty(_blocks, blocks.list_item, {\n parent: [{\n type: blocks.unordered_list\n }, {\n type: blocks.ordered_list\n }],\n nodes: [{\n match: {\n type: blocks.list_item_child\n },\n min: 1,\n max: 1\n }, {\n match: [{\n type: blocks.unordered_list\n }, {\n type: blocks.ordered_list\n }],\n min: 0,\n max: 1\n }],\n normalize: function normalize(editor, error) {\n switch (error.code) {\n case \"child_min_invalid\":\n editor.insertNodeByKey(error.node.key, 0, Block.create({\n type: blocks.list_item_child,\n nodes: [Text.create()]\n }));\n return;\n\n case \"child_type_invalid\":\n editor.wrapBlockByKey(error.child.key, {\n type: blocks.list_item_child\n });\n return;\n\n case \"parent_type_invalid\":\n editor.wrapBlockByKey(error.node.key, blocks.unordered_list);\n return;\n\n default:\n return;\n }\n }\n }), _blocks)\n };\n});\n\nvar index = (function () {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var config = _objectSpread({}, options);\n\n var blocks = _objectSpread({\n unordered_list: \"unordered-list\",\n ordered_list: \"ordered-list\",\n list_item: \"list-item\",\n list_item_child: \"list-item-child\",\n default: \"paragraph\"\n }, config.blocks);\n\n var classNames = _objectSpread({\n unordered_list: \"unordered-list\",\n ordered_list: \"ordered-list\",\n list_item: \"list-item\",\n list_item_child: \"list-item-child\"\n }, config.classNames);\n\n var commands = createCommands({\n blocks: blocks\n });\n\n var isListItem = function isListItem(block) {\n return block && block.type == blocks.list_item;\n };\n\n var getListItem = function getListItem(editor, block) {\n var possibleListItem = editor.value.document.getParent(block.key);\n return isListItem(possibleListItem) ? possibleListItem : null;\n };\n\n var isList = function isList(block) {\n return block && (block.type == blocks.unordered_list || block.type == blocks.ordered_list);\n };\n\n var getList = function getList(editor, block) {\n var possibleList = editor.value.document.getParent(block.key);\n return isList(possibleList) ? possibleList : null;\n };\n\n var onBackspace = function onBackspace(event, editor, next) {\n var selection = editor.value.selection;\n if (selection.isExpanded) return next();\n if (selection.start.offset !== 0) return next();\n var listItem = getListItem(editor, editor.value.startBlock);\n var list = getList(editor, listItem);\n var parentListItem = getListItem(editor, list);\n\n if (parentListItem) {\n editor.decreaseListItemDepth();\n return;\n }\n\n editor.unwrapList();\n };\n\n var onEnter = function onEnter(event, editor, next) {\n var _editor$value = editor.value,\n selection = _editor$value.selection,\n startBlock = _editor$value.startBlock;\n event.preventDefault();\n if (selection.isExpanded) editor.delete();\n\n if (selection.start.offset === 0 && startBlock.getText() === \"\") {\n var _listItem = getListItem(editor, editor.value.startBlock);\n\n var list = getList(editor, _listItem);\n var parentListItem = getListItem(editor, list);\n\n if (parentListItem) {\n editor.decreaseListItemDepth();\n return;\n }\n\n editor.unwrapList();\n return;\n }\n\n var listItem = getListItem(editor, editor.value.startBlock);\n editor.splitDescendantsByKey(listItem.key, selection.start.key, selection.start.offset);\n };\n\n var onShiftEnter = function onShiftEnter(event, editor, next) {\n event.preventDefault();\n editor.insertText(\"\\n\");\n };\n\n var schema = createSchema({\n blocks: blocks\n });\n var normalizeNode = createNormalizeNode({\n blocks: blocks\n });\n var renderBlock = createRenderBlock({\n blocks: blocks,\n classNames: classNames\n });\n return [{\n commands: {\n wrapList: commands.wrapList,\n unwrapList: commands.unwrapList,\n toggleList: commands.toggleList,\n decreaseListItemDepth: commands.decreaseListItemDepth,\n increaseListItemDepth: commands.increaseListItemDepth\n },\n normalizeNode: normalizeNode,\n renderBlock: renderBlock,\n renderNode: renderBlock,\n // COMPAT: renderNode is removed in slate\n schema: schema\n }, Keymap({\n backspace: onBackspace,\n enter: onEnter,\n \"shift+enter\": onShiftEnter,\n tab: \"increaseListItemDepth\",\n \"shift+tab\": \"decreaseListItemDepth\"\n }, {\n if: function _if(editor) {\n return !!getListItem(editor, editor.value.startBlock);\n }\n })];\n});\n\nexport default index;\n","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"katex\"] = factory();\n\telse\n\t\troot[\"katex\"] = factory();\n})((typeof self !== 'undefined' ? self : this), function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 1);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// extracted by mini-css-extract-plugin\n\n/***/ }),\n/* 1 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n\n// EXTERNAL MODULE: ./src/katex.less\nvar katex = __webpack_require__(0);\n\n// CONCATENATED MODULE: ./src/SourceLocation.js\n/**\n * Lexing or parsing positional information for error reporting.\n * This object is immutable.\n */\nvar SourceLocation =\n/*#__PURE__*/\nfunction () {\n // The + prefix indicates that these fields aren't writeable\n // Lexer holding the input string.\n // Start offset, zero-based inclusive.\n // End offset, zero-based exclusive.\n function SourceLocation(lexer, start, end) {\n this.lexer = void 0;\n this.start = void 0;\n this.end = void 0;\n this.lexer = lexer;\n this.start = start;\n this.end = end;\n }\n /**\n * Merges two `SourceLocation`s from location providers, given they are\n * provided in order of appearance.\n * - Returns the first one's location if only the first is provided.\n * - Returns a merged range of the first and the last if both are provided\n * and their lexers match.\n * - Otherwise, returns null.\n */\n\n\n SourceLocation.range = function range(first, second) {\n if (!second) {\n return first && first.loc;\n } else if (!first || !first.loc || !second.loc || first.loc.lexer !== second.loc.lexer) {\n return null;\n } else {\n return new SourceLocation(first.loc.lexer, first.loc.start, second.loc.end);\n }\n };\n\n return SourceLocation;\n}();\n\n\n// CONCATENATED MODULE: ./src/Token.js\n\n/**\n * Interface required to break circular dependency between Token, Lexer, and\n * ParseError.\n */\n\n/**\n * The resulting token returned from `lex`.\n *\n * It consists of the token text plus some position information.\n * The position information is essentially a range in an input string,\n * but instead of referencing the bare input string, we refer to the lexer.\n * That way it is possible to attach extra metadata to the input string,\n * like for example a file name or similar.\n *\n * The position information is optional, so it is OK to construct synthetic\n * tokens if appropriate. Not providing available position information may\n * lead to degraded error reporting, though.\n */\nvar Token_Token =\n/*#__PURE__*/\nfunction () {\n function Token(text, // the text of this token\n loc) {\n this.text = void 0;\n this.loc = void 0;\n this.text = text;\n this.loc = loc;\n }\n /**\n * Given a pair of tokens (this and endToken), compute a `Token` encompassing\n * the whole input range enclosed by these two.\n */\n\n\n var _proto = Token.prototype;\n\n _proto.range = function range(endToken, // last token of the range, inclusive\n text) // the text of the newly constructed token\n {\n return new Token(text, SourceLocation.range(this, endToken));\n };\n\n return Token;\n}();\n// CONCATENATED MODULE: ./src/ParseError.js\n\n\n/**\n * This is the ParseError class, which is the main error thrown by KaTeX\n * functions when something has gone wrong. This is used to distinguish internal\n * errors from errors in the expression that the user provided.\n *\n * If possible, a caller should provide a Token or ParseNode with information\n * about where in the source string the problem occurred.\n */\nvar ParseError = // Error position based on passed-in Token or ParseNode.\nfunction ParseError(message, // The error message\ntoken) // An object providing position information\n{\n this.position = void 0;\n var error = \"KaTeX parse error: \" + message;\n var start;\n var loc = token && token.loc;\n\n if (loc && loc.start <= loc.end) {\n // If we have the input and a position, make the error a bit fancier\n // Get the input\n var input = loc.lexer.input; // Prepend some information\n\n start = loc.start;\n var end = loc.end;\n\n if (start === input.length) {\n error += \" at end of input: \";\n } else {\n error += \" at position \" + (start + 1) + \": \";\n } // Underline token in question using combining underscores\n\n\n var underlined = input.slice(start, end).replace(/[^]/g, \"$&\\u0332\"); // Extract some context from the input and add it to the error\n\n var left;\n\n if (start > 15) {\n left = \"…\" + input.slice(start - 15, start);\n } else {\n left = input.slice(0, start);\n }\n\n var right;\n\n if (end + 15 < input.length) {\n right = input.slice(end, end + 15) + \"…\";\n } else {\n right = input.slice(end);\n }\n\n error += left + underlined + right;\n } // Some hackery to make ParseError a prototype of Error\n // See http://stackoverflow.com/a/8460753\n\n\n var self = new Error(error);\n self.name = \"ParseError\"; // $FlowFixMe\n\n self.__proto__ = ParseError.prototype; // $FlowFixMe\n\n self.position = start;\n return self;\n}; // $FlowFixMe More hackery\n\n\nParseError.prototype.__proto__ = Error.prototype;\n/* harmony default export */ var src_ParseError = (ParseError);\n// CONCATENATED MODULE: ./src/utils.js\n/**\n * This file contains a list of utility functions which are useful in other\n * files.\n */\n\n/**\n * Return whether an element is contained in a list\n */\nvar contains = function contains(list, elem) {\n return list.indexOf(elem) !== -1;\n};\n/**\n * Provide a default value if a setting is undefined\n * NOTE: Couldn't use `T` as the output type due to facebook/flow#5022.\n */\n\n\nvar deflt = function deflt(setting, defaultIfUndefined) {\n return setting === undefined ? defaultIfUndefined : setting;\n}; // hyphenate and escape adapted from Facebook's React under Apache 2 license\n\n\nvar uppercase = /([A-Z])/g;\n\nvar hyphenate = function hyphenate(str) {\n return str.replace(uppercase, \"-$1\").toLowerCase();\n};\n\nvar ESCAPE_LOOKUP = {\n \"&\": \"&\",\n \">\": \">\",\n \"<\": \"<\",\n \"\\\"\": \""\",\n \"'\": \"'\"\n};\nvar ESCAPE_REGEX = /[&><\"']/g;\n/**\n * Escapes text to prevent scripting attacks.\n */\n\nfunction utils_escape(text) {\n return String(text).replace(ESCAPE_REGEX, function (match) {\n return ESCAPE_LOOKUP[match];\n });\n}\n/**\n * Sometimes we want to pull out the innermost element of a group. In most\n * cases, this will just be the group itself, but when ordgroups and colors have\n * a single element, we want to pull that out.\n */\n\n\nvar getBaseElem = function getBaseElem(group) {\n if (group.type === \"ordgroup\") {\n if (group.body.length === 1) {\n return getBaseElem(group.body[0]);\n } else {\n return group;\n }\n } else if (group.type === \"color\") {\n if (group.body.length === 1) {\n return getBaseElem(group.body[0]);\n } else {\n return group;\n }\n } else if (group.type === \"font\") {\n return getBaseElem(group.body);\n } else {\n return group;\n }\n};\n/**\n * TeXbook algorithms often reference \"character boxes\", which are simply groups\n * with a single character in them. To decide if something is a character box,\n * we find its innermost group, and see if it is a single character.\n */\n\n\nvar utils_isCharacterBox = function isCharacterBox(group) {\n var baseElem = getBaseElem(group); // These are all they types of groups which hold single characters\n\n return baseElem.type === \"mathord\" || baseElem.type === \"textord\" || baseElem.type === \"atom\";\n};\n\nvar assert = function assert(value) {\n if (!value) {\n throw new Error('Expected non-null, but got ' + String(value));\n }\n\n return value;\n};\n/**\n * Return the protocol of a URL, or \"_relative\" if the URL does not specify a\n * protocol (and thus is relative).\n */\n\nvar protocolFromUrl = function protocolFromUrl(url) {\n var protocol = /^\\s*([^\\\\/#]*?)(?::|�*58|�*3a)/i.exec(url);\n return protocol != null ? protocol[1] : \"_relative\";\n};\n/* harmony default export */ var utils = ({\n contains: contains,\n deflt: deflt,\n escape: utils_escape,\n hyphenate: hyphenate,\n getBaseElem: getBaseElem,\n isCharacterBox: utils_isCharacterBox,\n protocolFromUrl: protocolFromUrl\n});\n// CONCATENATED MODULE: ./src/Settings.js\n/* eslint no-console:0 */\n\n/**\n * This is a module for storing settings passed into KaTeX. It correctly handles\n * default settings.\n */\n\n\n\n\n/**\n * The main Settings object\n *\n * The current options stored are:\n * - displayMode: Whether the expression should be typeset as inline math\n * (false, the default), meaning that the math starts in\n * \\textstyle and is placed in an inline-block); or as display\n * math (true), meaning that the math starts in \\displaystyle\n * and is placed in a block with vertical margin.\n */\nvar Settings_Settings =\n/*#__PURE__*/\nfunction () {\n function Settings(options) {\n this.displayMode = void 0;\n this.output = void 0;\n this.leqno = void 0;\n this.fleqn = void 0;\n this.throwOnError = void 0;\n this.errorColor = void 0;\n this.macros = void 0;\n this.minRuleThickness = void 0;\n this.colorIsTextColor = void 0;\n this.strict = void 0;\n this.trust = void 0;\n this.maxSize = void 0;\n this.maxExpand = void 0;\n // allow null options\n options = options || {};\n this.displayMode = utils.deflt(options.displayMode, false);\n this.output = utils.deflt(options.output, \"htmlAndMathml\");\n this.leqno = utils.deflt(options.leqno, false);\n this.fleqn = utils.deflt(options.fleqn, false);\n this.throwOnError = utils.deflt(options.throwOnError, true);\n this.errorColor = utils.deflt(options.errorColor, \"#cc0000\");\n this.macros = options.macros || {};\n this.minRuleThickness = Math.max(0, utils.deflt(options.minRuleThickness, 0));\n this.colorIsTextColor = utils.deflt(options.colorIsTextColor, false);\n this.strict = utils.deflt(options.strict, \"warn\");\n this.trust = utils.deflt(options.trust, false);\n this.maxSize = Math.max(0, utils.deflt(options.maxSize, Infinity));\n this.maxExpand = Math.max(0, utils.deflt(options.maxExpand, 1000));\n }\n /**\n * Report nonstrict (non-LaTeX-compatible) input.\n * Can safely not be called if `this.strict` is false in JavaScript.\n */\n\n\n var _proto = Settings.prototype;\n\n _proto.reportNonstrict = function reportNonstrict(errorCode, errorMsg, token) {\n var strict = this.strict;\n\n if (typeof strict === \"function\") {\n // Allow return value of strict function to be boolean or string\n // (or null/undefined, meaning no further processing).\n strict = strict(errorCode, errorMsg, token);\n }\n\n if (!strict || strict === \"ignore\") {\n return;\n } else if (strict === true || strict === \"error\") {\n throw new src_ParseError(\"LaTeX-incompatible input and strict mode is set to 'error': \" + (errorMsg + \" [\" + errorCode + \"]\"), token);\n } else if (strict === \"warn\") {\n typeof console !== \"undefined\" && console.warn(\"LaTeX-incompatible input and strict mode is set to 'warn': \" + (errorMsg + \" [\" + errorCode + \"]\"));\n } else {\n // won't happen in type-safe code\n typeof console !== \"undefined\" && console.warn(\"LaTeX-incompatible input and strict mode is set to \" + (\"unrecognized '\" + strict + \"': \" + errorMsg + \" [\" + errorCode + \"]\"));\n }\n }\n /**\n * Check whether to apply strict (LaTeX-adhering) behavior for unusual\n * input (like `\\\\`). Unlike `nonstrict`, will not throw an error;\n * instead, \"error\" translates to a return value of `true`, while \"ignore\"\n * translates to a return value of `false`. May still print a warning:\n * \"warn\" prints a warning and returns `false`.\n * This is for the second category of `errorCode`s listed in the README.\n */\n ;\n\n _proto.useStrictBehavior = function useStrictBehavior(errorCode, errorMsg, token) {\n var strict = this.strict;\n\n if (typeof strict === \"function\") {\n // Allow return value of strict function to be boolean or string\n // (or null/undefined, meaning no further processing).\n // But catch any exceptions thrown by function, treating them\n // like \"error\".\n try {\n strict = strict(errorCode, errorMsg, token);\n } catch (error) {\n strict = \"error\";\n }\n }\n\n if (!strict || strict === \"ignore\") {\n return false;\n } else if (strict === true || strict === \"error\") {\n return true;\n } else if (strict === \"warn\") {\n typeof console !== \"undefined\" && console.warn(\"LaTeX-incompatible input and strict mode is set to 'warn': \" + (errorMsg + \" [\" + errorCode + \"]\"));\n return false;\n } else {\n // won't happen in type-safe code\n typeof console !== \"undefined\" && console.warn(\"LaTeX-incompatible input and strict mode is set to \" + (\"unrecognized '\" + strict + \"': \" + errorMsg + \" [\" + errorCode + \"]\"));\n return false;\n }\n }\n /**\n * Check whether to test potentially dangerous input, and return\n * `true` (trusted) or `false` (untrusted). The sole argument `context`\n * should be an object with `command` field specifying the relevant LaTeX\n * command (as a string starting with `\\`), and any other arguments, etc.\n * If `context` has a `url` field, a `protocol` field will automatically\n * get added by this function (changing the specified object).\n */\n ;\n\n _proto.isTrusted = function isTrusted(context) {\n if (context.url && !context.protocol) {\n context.protocol = utils.protocolFromUrl(context.url);\n }\n\n var trust = typeof this.trust === \"function\" ? this.trust(context) : this.trust;\n return Boolean(trust);\n };\n\n return Settings;\n}();\n\n\n// CONCATENATED MODULE: ./src/Style.js\n/**\n * This file contains information and classes for the various kinds of styles\n * used in TeX. It provides a generic `Style` class, which holds information\n * about a specific style. It then provides instances of all the different kinds\n * of styles possible, and provides functions to move between them and get\n * information about them.\n */\n\n/**\n * The main style class. Contains a unique id for the style, a size (which is\n * the same for cramped and uncramped version of a style), and a cramped flag.\n */\nvar Style =\n/*#__PURE__*/\nfunction () {\n function Style(id, size, cramped) {\n this.id = void 0;\n this.size = void 0;\n this.cramped = void 0;\n this.id = id;\n this.size = size;\n this.cramped = cramped;\n }\n /**\n * Get the style of a superscript given a base in the current style.\n */\n\n\n var _proto = Style.prototype;\n\n _proto.sup = function sup() {\n return Style_styles[_sup[this.id]];\n }\n /**\n * Get the style of a subscript given a base in the current style.\n */\n ;\n\n _proto.sub = function sub() {\n return Style_styles[_sub[this.id]];\n }\n /**\n * Get the style of a fraction numerator given the fraction in the current\n * style.\n */\n ;\n\n _proto.fracNum = function fracNum() {\n return Style_styles[_fracNum[this.id]];\n }\n /**\n * Get the style of a fraction denominator given the fraction in the current\n * style.\n */\n ;\n\n _proto.fracDen = function fracDen() {\n return Style_styles[_fracDen[this.id]];\n }\n /**\n * Get the cramped version of a style (in particular, cramping a cramped style\n * doesn't change the style).\n */\n ;\n\n _proto.cramp = function cramp() {\n return Style_styles[_cramp[this.id]];\n }\n /**\n * Get a text or display version of this style.\n */\n ;\n\n _proto.text = function text() {\n return Style_styles[_text[this.id]];\n }\n /**\n * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle)\n */\n ;\n\n _proto.isTight = function isTight() {\n return this.size >= 2;\n };\n\n return Style;\n}(); // Export an interface for type checking, but don't expose the implementation.\n// This way, no more styles can be generated.\n\n\n// IDs of the different styles\nvar D = 0;\nvar Dc = 1;\nvar T = 2;\nvar Tc = 3;\nvar S = 4;\nvar Sc = 5;\nvar SS = 6;\nvar SSc = 7; // Instances of the different styles\n\nvar Style_styles = [new Style(D, 0, false), new Style(Dc, 0, true), new Style(T, 1, false), new Style(Tc, 1, true), new Style(S, 2, false), new Style(Sc, 2, true), new Style(SS, 3, false), new Style(SSc, 3, true)]; // Lookup tables for switching from one style to another\n\nvar _sup = [S, Sc, S, Sc, SS, SSc, SS, SSc];\nvar _sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc];\nvar _fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc];\nvar _fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc];\nvar _cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc];\nvar _text = [D, Dc, T, Tc, T, Tc, T, Tc]; // We only export some of the styles.\n\n/* harmony default export */ var src_Style = ({\n DISPLAY: Style_styles[D],\n TEXT: Style_styles[T],\n SCRIPT: Style_styles[S],\n SCRIPTSCRIPT: Style_styles[SS]\n});\n// CONCATENATED MODULE: ./src/unicodeScripts.js\n/*\n * This file defines the Unicode scripts and script families that we\n * support. To add new scripts or families, just add a new entry to the\n * scriptData array below. Adding scripts to the scriptData array allows\n * characters from that script to appear in \\text{} environments.\n */\n\n/**\n * Each script or script family has a name and an array of blocks.\n * Each block is an array of two numbers which specify the start and\n * end points (inclusive) of a block of Unicode codepoints.\n */\n\n/**\n * Unicode block data for the families of scripts we support in \\text{}.\n * Scripts only need to appear here if they do not have font metrics.\n */\nvar scriptData = [{\n // Latin characters beyond the Latin-1 characters we have metrics for.\n // Needed for Czech, Hungarian and Turkish text, for example.\n name: 'latin',\n blocks: [[0x0100, 0x024f], // Latin Extended-A and Latin Extended-B\n [0x0300, 0x036f]]\n}, {\n // The Cyrillic script used by Russian and related languages.\n // A Cyrillic subset used to be supported as explicitly defined\n // symbols in symbols.js\n name: 'cyrillic',\n blocks: [[0x0400, 0x04ff]]\n}, {\n // The Brahmic scripts of South and Southeast Asia\n // Devanagari (0900–097F)\n // Bengali (0980–09FF)\n // Gurmukhi (0A00–0A7F)\n // Gujarati (0A80–0AFF)\n // Oriya (0B00–0B7F)\n // Tamil (0B80–0BFF)\n // Telugu (0C00–0C7F)\n // Kannada (0C80–0CFF)\n // Malayalam (0D00–0D7F)\n // Sinhala (0D80–0DFF)\n // Thai (0E00–0E7F)\n // Lao (0E80–0EFF)\n // Tibetan (0F00–0FFF)\n // Myanmar (1000–109F)\n name: 'brahmic',\n blocks: [[0x0900, 0x109F]]\n}, {\n name: 'georgian',\n blocks: [[0x10A0, 0x10ff]]\n}, {\n // Chinese and Japanese.\n // The \"k\" in cjk is for Korean, but we've separated Korean out\n name: \"cjk\",\n blocks: [[0x3000, 0x30FF], // CJK symbols and punctuation, Hiragana, Katakana\n [0x4E00, 0x9FAF], // CJK ideograms\n [0xFF00, 0xFF60]]\n}, {\n // Korean\n name: 'hangul',\n blocks: [[0xAC00, 0xD7AF]]\n}];\n/**\n * Given a codepoint, return the name of the script or script family\n * it is from, or null if it is not part of a known block\n */\n\nfunction scriptFromCodepoint(codepoint) {\n for (var i = 0; i < scriptData.length; i++) {\n var script = scriptData[i];\n\n for (var _i = 0; _i < script.blocks.length; _i++) {\n var block = script.blocks[_i];\n\n if (codepoint >= block[0] && codepoint <= block[1]) {\n return script.name;\n }\n }\n }\n\n return null;\n}\n/**\n * A flattened version of all the supported blocks in a single array.\n * This is an optimization to make supportedCodepoint() fast.\n */\n\nvar allBlocks = [];\nscriptData.forEach(function (s) {\n return s.blocks.forEach(function (b) {\n return allBlocks.push.apply(allBlocks, b);\n });\n});\n/**\n * Given a codepoint, return true if it falls within one of the\n * scripts or script families defined above and false otherwise.\n *\n * Micro benchmarks shows that this is faster than\n * /[\\u3000-\\u30FF\\u4E00-\\u9FAF\\uFF00-\\uFF60\\uAC00-\\uD7AF\\u0900-\\u109F]/.test()\n * in Firefox, Chrome and Node.\n */\n\nfunction supportedCodepoint(codepoint) {\n for (var i = 0; i < allBlocks.length; i += 2) {\n if (codepoint >= allBlocks[i] && codepoint <= allBlocks[i + 1]) {\n return true;\n }\n }\n\n return false;\n}\n// CONCATENATED MODULE: ./src/svgGeometry.js\n/**\n * This file provides support to domTree.js and delimiter.js.\n * It's a storehouse of path geometry for SVG images.\n */\n// In all paths below, the viewBox-to-em scale is 1000:1.\nvar hLinePad = 80; // padding above a sqrt viniculum. Prevents image cropping.\n// The viniculum of a \\sqrt can be made thicker by a KaTeX rendering option.\n// Think of variable extraViniculum as two detours in the SVG path.\n// The detour begins at the lower left of the area labeled extraViniculum below.\n// The detour proceeds one extraViniculum distance up and slightly to the right,\n// displacing the radiused corner between surd and viniculum. The radius is\n// traversed as usual, then the detour resumes. It goes right, to the end of\n// the very long viniculumn, then down one extraViniculum distance,\n// after which it resumes regular path geometry for the radical.\n\n/* viniculum\n /\n /▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒←extraViniculum\n / █████████████████████←0.04em (40 unit) std viniculum thickness\n / /\n / /\n / /\\\n / / surd\n*/\n\nvar sqrtMain = function sqrtMain(extraViniculum, hLinePad) {\n // sqrtMain path geometry is from glyph U221A in the font KaTeX Main\n return \"M95,\" + (622 + extraViniculum + hLinePad) + \"\\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\\nc69,-144,104.5,-217.7,106.5,-221\\nl\" + extraViniculum / 2.075 + \" -\" + extraViniculum + \"\\nc5.3,-9.3,12,-14,20,-14\\nH400000v\" + (40 + extraViniculum) + \"H845.2724\\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\\nM\" + (834 + extraViniculum) + \" \" + hLinePad + \"h400000v\" + (40 + extraViniculum) + \"h-400000z\";\n};\n\nvar sqrtSize1 = function sqrtSize1(extraViniculum, hLinePad) {\n // size1 is from glyph U221A in the font KaTeX_Size1-Regular\n return \"M263,\" + (601 + extraViniculum + hLinePad) + \"c0.7,0,18,39.7,52,119\\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\\nc340,-704.7,510.7,-1060.3,512,-1067\\nl\" + extraViniculum / 2.084 + \" -\" + extraViniculum + \"\\nc4.7,-7.3,11,-11,19,-11\\nH40000v\" + (40 + extraViniculum) + \"H1012.3\\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\\nM\" + (1001 + extraViniculum) + \" \" + hLinePad + \"h400000v\" + (40 + extraViniculum) + \"h-400000z\";\n};\n\nvar sqrtSize2 = function sqrtSize2(extraViniculum, hLinePad) {\n // size2 is from glyph U221A in the font KaTeX_Size2-Regular\n return \"M983 \" + (10 + extraViniculum + hLinePad) + \"\\nl\" + extraViniculum / 3.13 + \" -\" + extraViniculum + \"\\nc4,-6.7,10,-10,18,-10 H400000v\" + (40 + extraViniculum) + \"\\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\\nM\" + (1001 + extraViniculum) + \" \" + hLinePad + \"h400000v\" + (40 + extraViniculum) + \"h-400000z\";\n};\n\nvar sqrtSize3 = function sqrtSize3(extraViniculum, hLinePad) {\n // size3 is from glyph U221A in the font KaTeX_Size3-Regular\n return \"M424,\" + (2398 + extraViniculum + hLinePad) + \"\\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\\nl\" + extraViniculum / 4.223 + \" -\" + extraViniculum + \"c4,-6.7,10,-10,18,-10 H400000\\nv\" + (40 + extraViniculum) + \"H1014.6\\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\\nc-2,6,-10,9,-24,9\\nc-8,0,-12,-0.7,-12,-2z M\" + (1001 + extraViniculum) + \" \" + hLinePad + \"\\nh400000v\" + (40 + extraViniculum) + \"h-400000z\";\n};\n\nvar sqrtSize4 = function sqrtSize4(extraViniculum, hLinePad) {\n // size4 is from glyph U221A in the font KaTeX_Size4-Regular\n return \"M473,\" + (2713 + extraViniculum + hLinePad) + \"\\nc339.3,-1799.3,509.3,-2700,510,-2702 l\" + extraViniculum / 5.298 + \" -\" + extraViniculum + \"\\nc3.3,-7.3,9.3,-11,18,-11 H400000v\" + (40 + extraViniculum) + \"H1017.7\\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\\n606zM\" + (1001 + extraViniculum) + \" \" + hLinePad + \"h400000v\" + (40 + extraViniculum) + \"H1017.7z\";\n};\n\nvar sqrtTall = function sqrtTall(extraViniculum, hLinePad, viewBoxHeight) {\n // sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular\n // One path edge has a variable length. It runs vertically from the viniculumn\n // to a point near (14 units) the bottom of the surd. The viniculum\n // is normally 40 units thick. So the length of the line in question is:\n var vertSegment = viewBoxHeight - 54 - hLinePad - extraViniculum;\n return \"M702 \" + (extraViniculum + hLinePad) + \"H400000\" + (40 + extraViniculum) + \"\\nH742v\" + vertSegment + \"l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\\n219 661 l218 661zM702 \" + hLinePad + \"H400000v\" + (40 + extraViniculum) + \"H742z\";\n};\n\nvar sqrtPath = function sqrtPath(size, extraViniculum, viewBoxHeight) {\n extraViniculum = 1000 * extraViniculum; // Convert from document ems to viewBox.\n\n var path = \"\";\n\n switch (size) {\n case \"sqrtMain\":\n path = sqrtMain(extraViniculum, hLinePad);\n break;\n\n case \"sqrtSize1\":\n path = sqrtSize1(extraViniculum, hLinePad);\n break;\n\n case \"sqrtSize2\":\n path = sqrtSize2(extraViniculum, hLinePad);\n break;\n\n case \"sqrtSize3\":\n path = sqrtSize3(extraViniculum, hLinePad);\n break;\n\n case \"sqrtSize4\":\n path = sqrtSize4(extraViniculum, hLinePad);\n break;\n\n case \"sqrtTall\":\n path = sqrtTall(extraViniculum, hLinePad, viewBoxHeight);\n }\n\n return path;\n};\nvar svgGeometry_path = {\n // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main\n doubleleftarrow: \"M262 157\\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\\nm8 0v40h399730v-40zm0 194v40h399730v-40z\",\n // doublerightarrow is from glyph U+21D2 in font KaTeX Main\n doublerightarrow: \"M399738 392l\\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z\",\n // leftarrow is from glyph U+2190 in font KaTeX Main\n leftarrow: \"M400000 241H110l3-3c68.7-52.7 113.7-120\\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\\n l-3-3h399890zM100 241v40h399900v-40z\",\n // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular\n leftbrace: \"M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z\",\n leftbraceunder: \"M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z\",\n // overgroup is from the MnSymbol package (public domain)\n leftgroup: \"M400000 80\\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\\n 435 0h399565z\",\n leftgroupunder: \"M400000 262\\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\\n 435 219h399565z\",\n // Harpoons are from glyph U+21BD in font KaTeX Main\n leftharpoon: \"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z\",\n leftharpoonplus: \"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\\nm0 0v40h400000v-40z\",\n leftharpoondown: \"M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z\",\n leftharpoondownplus: \"M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z\",\n // hook is from glyph U+21A9 in font KaTeX Main\n lefthook: \"M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\\n 71.5 23h399859zM103 281v-40h399897v40z\",\n leftlinesegment: \"M40 281 V428 H0 V94 H40 V241 H400000 v40z\\nM40 281 V428 H0 V94 H40 V241 H400000 v40z\",\n leftmapsto: \"M40 281 V448H0V74H40V241H400000v40z\\nM40 281 V448H0V74H40V241H400000v40z\",\n // tofrom is from glyph U+21C4 in font KaTeX AMS Regular\n leftToFrom: \"M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z\",\n longequal: \"M0 50 h400000 v40H0z m0 194h40000v40H0z\\nM0 50 h400000 v40H0z m0 194h40000v40H0z\",\n midbrace: \"M200428 334\\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z\",\n midbraceunder: \"M199572 214\\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z\",\n oiintSize1: \"M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z\",\n oiintSize2: \"M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\\nc0 110 84 276 504 276s502.4-166 502.4-276z\",\n oiiintSize1: \"M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z\",\n oiiintSize2: \"M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z\",\n rightarrow: \"M0 241v40h399891c-47.3 35.3-84 78-110 128\\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\\n 151.7 139 205zm0 0v40h399900v-40z\",\n rightbrace: \"M400000 542l\\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z\",\n rightbraceunder: \"M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z\",\n rightgroup: \"M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\\n 3-1 3-3v-38c-76-158-257-219-435-219H0z\",\n rightgroupunder: \"M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z\",\n rightharpoon: \"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\\n 69.2 92 94.5zm0 0v40h399900v-40z\",\n rightharpoonplus: \"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z\",\n rightharpoondown: \"M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z\",\n rightharpoondownplus: \"M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\\nm0-194v40h400000v-40zm0 0v40h400000v-40z\",\n righthook: \"M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z\",\n rightlinesegment: \"M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z\",\n rightToFrom: \"M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z\",\n // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular\n twoheadleftarrow: \"M0 167c68 40\\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z\",\n twoheadrightarrow: \"M400000 167\\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z\",\n // tilde1 is a modified version of a glyph from the MnSymbol package\n tilde1: \"M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\\n-68.267.847-113-73.952-191-73.952z\",\n // ditto tilde2, tilde3, & tilde4\n tilde2: \"M344 55.266c-142 0-300.638 81.316-311.5 86.418\\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z\",\n tilde3: \"M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\\n -338 0-409-156.573-744-156.573z\",\n tilde4: \"M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\\n -175.236-744-175.236z\",\n // vec is from glyph U+20D7 in font KaTeX Main\n vec: \"M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\\nc-16-25.333-24-45-24-59z\",\n // widehat1 is a modified version of a glyph from the MnSymbol package\n widehat1: \"M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z\",\n // ditto widehat2, widehat3, & widehat4\n widehat2: \"M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z\",\n widehat3: \"M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z\",\n widehat4: \"M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z\",\n // widecheck paths are all inverted versions of widehat\n widecheck1: \"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z\",\n widecheck2: \"M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z\",\n widecheck3: \"M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z\",\n widecheck4: \"M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z\",\n // The next ten paths support reaction arrows from the mhchem package.\n // Arrows for \\ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX\n // baraboveleftarrow is mostly from from glyph U+2190 in font KaTeX Main\n baraboveleftarrow: \"M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z\",\n // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main\n rightarrowabovebar: \"M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z\",\n // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end.\n // Ref from mhchem.sty: \\rlap{\\raisebox{-.22ex}{$\\kern0.5em\n baraboveshortleftharpoon: \"M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z\",\n rightharpoonaboveshortbar: \"M0,241 l0,40c399126,0,399993,0,399993,0\\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z\",\n shortbaraboveleftharpoon: \"M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z\",\n shortrightharpoonabovebar: \"M53,241l0,40c398570,0,399437,0,399437,0\\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z\"\n};\n// CONCATENATED MODULE: ./src/tree.js\n\n\n/**\n * This node represents a document fragment, which contains elements, but when\n * placed into the DOM doesn't have any representation itself. It only contains\n * children and doesn't have any DOM node properties.\n */\nvar tree_DocumentFragment =\n/*#__PURE__*/\nfunction () {\n // HtmlDomNode\n // Never used; needed for satisfying interface.\n function DocumentFragment(children) {\n this.children = void 0;\n this.classes = void 0;\n this.height = void 0;\n this.depth = void 0;\n this.maxFontSize = void 0;\n this.style = void 0;\n this.children = children;\n this.classes = [];\n this.height = 0;\n this.depth = 0;\n this.maxFontSize = 0;\n this.style = {};\n }\n\n var _proto = DocumentFragment.prototype;\n\n _proto.hasClass = function hasClass(className) {\n return utils.contains(this.classes, className);\n }\n /** Convert the fragment into a node. */\n ;\n\n _proto.toNode = function toNode() {\n var frag = document.createDocumentFragment();\n\n for (var i = 0; i < this.children.length; i++) {\n frag.appendChild(this.children[i].toNode());\n }\n\n return frag;\n }\n /** Convert the fragment into HTML markup. */\n ;\n\n _proto.toMarkup = function toMarkup() {\n var markup = \"\"; // Simply concatenate the markup for the children together.\n\n for (var i = 0; i < this.children.length; i++) {\n markup += this.children[i].toMarkup();\n }\n\n return markup;\n }\n /**\n * Converts the math node into a string, similar to innerText. Applies to\n * MathDomNode's only.\n */\n ;\n\n _proto.toText = function toText() {\n // To avoid this, we would subclass documentFragment separately for\n // MathML, but polyfills for subclassing is expensive per PR 1469.\n // $FlowFixMe: Only works for ChildType = MathDomNode.\n var toText = function toText(child) {\n return child.toText();\n };\n\n return this.children.map(toText).join(\"\");\n };\n\n return DocumentFragment;\n}();\n// CONCATENATED MODULE: ./src/domTree.js\n/**\n * These objects store the data about the DOM nodes we create, as well as some\n * extra data. They can then be transformed into real DOM nodes with the\n * `toNode` function or HTML markup using `toMarkup`. They are useful for both\n * storing extra properties on the nodes, as well as providing a way to easily\n * work with the DOM.\n *\n * Similar functions for working with MathML nodes exist in mathMLTree.js.\n *\n * TODO: refactor `span` and `anchor` into common superclass when\n * target environments support class inheritance\n */\n\n\n\n\n\n/**\n * Create an HTML className based on a list of classes. In addition to joining\n * with spaces, we also remove empty classes.\n */\nvar createClass = function createClass(classes) {\n return classes.filter(function (cls) {\n return cls;\n }).join(\" \");\n};\n\nvar initNode = function initNode(classes, options, style) {\n this.classes = classes || [];\n this.attributes = {};\n this.height = 0;\n this.depth = 0;\n this.maxFontSize = 0;\n this.style = style || {};\n\n if (options) {\n if (options.style.isTight()) {\n this.classes.push(\"mtight\");\n }\n\n var color = options.getColor();\n\n if (color) {\n this.style.color = color;\n }\n }\n};\n/**\n * Convert into an HTML node\n */\n\n\nvar _toNode = function toNode(tagName) {\n var node = document.createElement(tagName); // Apply the class\n\n node.className = createClass(this.classes); // Apply inline styles\n\n for (var style in this.style) {\n if (this.style.hasOwnProperty(style)) {\n // $FlowFixMe Flow doesn't seem to understand span.style's type.\n node.style[style] = this.style[style];\n }\n } // Apply attributes\n\n\n for (var attr in this.attributes) {\n if (this.attributes.hasOwnProperty(attr)) {\n node.setAttribute(attr, this.attributes[attr]);\n }\n } // Append the children, also as HTML nodes\n\n\n for (var i = 0; i < this.children.length; i++) {\n node.appendChild(this.children[i].toNode());\n }\n\n return node;\n};\n/**\n * Convert into an HTML markup string\n */\n\n\nvar _toMarkup = function toMarkup(tagName) {\n var markup = \"<\" + tagName; // Add the class\n\n if (this.classes.length) {\n markup += \" class=\\\"\" + utils.escape(createClass(this.classes)) + \"\\\"\";\n }\n\n var styles = \"\"; // Add the styles, after hyphenation\n\n for (var style in this.style) {\n if (this.style.hasOwnProperty(style)) {\n styles += utils.hyphenate(style) + \":\" + this.style[style] + \";\";\n }\n }\n\n if (styles) {\n markup += \" style=\\\"\" + utils.escape(styles) + \"\\\"\";\n } // Add the attributes\n\n\n for (var attr in this.attributes) {\n if (this.attributes.hasOwnProperty(attr)) {\n markup += \" \" + attr + \"=\\\"\" + utils.escape(this.attributes[attr]) + \"\\\"\";\n }\n }\n\n markup += \">\"; // Add the markup of the children, also as markup\n\n for (var i = 0; i < this.children.length; i++) {\n markup += this.children[i].toMarkup();\n }\n\n markup += \"\";\n return markup;\n}; // Making the type below exact with all optional fields doesn't work due to\n// - https://github.com/facebook/flow/issues/4582\n// - https://github.com/facebook/flow/issues/5688\n// However, since *all* fields are optional, $Shape<> works as suggested in 5688\n// above.\n// This type does not include all CSS properties. Additional properties should\n// be added as needed.\n\n\n/**\n * This node represents a span node, with a className, a list of children, and\n * an inline style. It also contains information about its height, depth, and\n * maxFontSize.\n *\n * Represents two types with different uses: SvgSpan to wrap an SVG and DomSpan\n * otherwise. This typesafety is important when HTML builders access a span's\n * children.\n */\nvar domTree_Span =\n/*#__PURE__*/\nfunction () {\n function Span(classes, children, options, style) {\n this.children = void 0;\n this.attributes = void 0;\n this.classes = void 0;\n this.height = void 0;\n this.depth = void 0;\n this.width = void 0;\n this.maxFontSize = void 0;\n this.style = void 0;\n initNode.call(this, classes, options, style);\n this.children = children || [];\n }\n /**\n * Sets an arbitrary attribute on the span. Warning: use this wisely. Not\n * all browsers support attributes the same, and having too many custom\n * attributes is probably bad.\n */\n\n\n var _proto = Span.prototype;\n\n _proto.setAttribute = function setAttribute(attribute, value) {\n this.attributes[attribute] = value;\n };\n\n _proto.hasClass = function hasClass(className) {\n return utils.contains(this.classes, className);\n };\n\n _proto.toNode = function toNode() {\n return _toNode.call(this, \"span\");\n };\n\n _proto.toMarkup = function toMarkup() {\n return _toMarkup.call(this, \"span\");\n };\n\n return Span;\n}();\n/**\n * This node represents an anchor () element with a hyperlink. See `span`\n * for further details.\n */\n\nvar domTree_Anchor =\n/*#__PURE__*/\nfunction () {\n function Anchor(href, classes, children, options) {\n this.children = void 0;\n this.attributes = void 0;\n this.classes = void 0;\n this.height = void 0;\n this.depth = void 0;\n this.maxFontSize = void 0;\n this.style = void 0;\n initNode.call(this, classes, options);\n this.children = children || [];\n this.setAttribute('href', href);\n }\n\n var _proto2 = Anchor.prototype;\n\n _proto2.setAttribute = function setAttribute(attribute, value) {\n this.attributes[attribute] = value;\n };\n\n _proto2.hasClass = function hasClass(className) {\n return utils.contains(this.classes, className);\n };\n\n _proto2.toNode = function toNode() {\n return _toNode.call(this, \"a\");\n };\n\n _proto2.toMarkup = function toMarkup() {\n return _toMarkup.call(this, \"a\");\n };\n\n return Anchor;\n}();\n/**\n * This node represents an image embed () element.\n */\n\nvar domTree_Img =\n/*#__PURE__*/\nfunction () {\n function Img(src, alt, style) {\n this.src = void 0;\n this.alt = void 0;\n this.classes = void 0;\n this.height = void 0;\n this.depth = void 0;\n this.maxFontSize = void 0;\n this.style = void 0;\n this.alt = alt;\n this.src = src;\n this.classes = [\"mord\"];\n this.style = style;\n }\n\n var _proto3 = Img.prototype;\n\n _proto3.hasClass = function hasClass(className) {\n return utils.contains(this.classes, className);\n };\n\n _proto3.toNode = function toNode() {\n var node = document.createElement(\"img\");\n node.src = this.src;\n node.alt = this.alt;\n node.className = \"mord\"; // Apply inline styles\n\n for (var style in this.style) {\n if (this.style.hasOwnProperty(style)) {\n // $FlowFixMe\n node.style[style] = this.style[style];\n }\n }\n\n return node;\n };\n\n _proto3.toMarkup = function toMarkup() {\n var markup = \"\" + this.alt + \"\";\n return markup;\n };\n\n return Img;\n}();\nvar iCombinations = {\n 'î': \"\\u0131\\u0302\",\n 'ï': \"\\u0131\\u0308\",\n 'í': \"\\u0131\\u0301\",\n // 'ī': '\\u0131\\u0304', // enable when we add Extended Latin\n 'ì': \"\\u0131\\u0300\"\n};\n/**\n * A symbol node contains information about a single symbol. It either renders\n * to a single text node, or a span with a single text node in it, depending on\n * whether it has CSS classes, styles, or needs italic correction.\n */\n\nvar domTree_SymbolNode =\n/*#__PURE__*/\nfunction () {\n function SymbolNode(text, height, depth, italic, skew, width, classes, style) {\n this.text = void 0;\n this.height = void 0;\n this.depth = void 0;\n this.italic = void 0;\n this.skew = void 0;\n this.width = void 0;\n this.maxFontSize = void 0;\n this.classes = void 0;\n this.style = void 0;\n this.text = text;\n this.height = height || 0;\n this.depth = depth || 0;\n this.italic = italic || 0;\n this.skew = skew || 0;\n this.width = width || 0;\n this.classes = classes || [];\n this.style = style || {};\n this.maxFontSize = 0; // Mark text from non-Latin scripts with specific classes so that we\n // can specify which fonts to use. This allows us to render these\n // characters with a serif font in situations where the browser would\n // either default to a sans serif or render a placeholder character.\n // We use CSS class names like cjk_fallback, hangul_fallback and\n // brahmic_fallback. See ./unicodeScripts.js for the set of possible\n // script names\n\n var script = scriptFromCodepoint(this.text.charCodeAt(0));\n\n if (script) {\n this.classes.push(script + \"_fallback\");\n }\n\n if (/[îïíì]/.test(this.text)) {\n // add ī when we add Extended Latin\n this.text = iCombinations[this.text];\n }\n }\n\n var _proto4 = SymbolNode.prototype;\n\n _proto4.hasClass = function hasClass(className) {\n return utils.contains(this.classes, className);\n }\n /**\n * Creates a text node or span from a symbol node. Note that a span is only\n * created if it is needed.\n */\n ;\n\n _proto4.toNode = function toNode() {\n var node = document.createTextNode(this.text);\n var span = null;\n\n if (this.italic > 0) {\n span = document.createElement(\"span\");\n span.style.marginRight = this.italic + \"em\";\n }\n\n if (this.classes.length > 0) {\n span = span || document.createElement(\"span\");\n span.className = createClass(this.classes);\n }\n\n for (var style in this.style) {\n if (this.style.hasOwnProperty(style)) {\n span = span || document.createElement(\"span\"); // $FlowFixMe Flow doesn't seem to understand span.style's type.\n\n span.style[style] = this.style[style];\n }\n }\n\n if (span) {\n span.appendChild(node);\n return span;\n } else {\n return node;\n }\n }\n /**\n * Creates markup for a symbol node.\n */\n ;\n\n _proto4.toMarkup = function toMarkup() {\n // TODO(alpert): More duplication than I'd like from\n // span.prototype.toMarkup and symbolNode.prototype.toNode...\n var needsSpan = false;\n var markup = \" 0) {\n styles += \"margin-right:\" + this.italic + \"em;\";\n }\n\n for (var style in this.style) {\n if (this.style.hasOwnProperty(style)) {\n styles += utils.hyphenate(style) + \":\" + this.style[style] + \";\";\n }\n }\n\n if (styles) {\n needsSpan = true;\n markup += \" style=\\\"\" + utils.escape(styles) + \"\\\"\";\n }\n\n var escaped = utils.escape(this.text);\n\n if (needsSpan) {\n markup += \">\";\n markup += escaped;\n markup += \"\";\n return markup;\n } else {\n return escaped;\n }\n };\n\n return SymbolNode;\n}();\n/**\n * SVG nodes are used to render stretchy wide elements.\n */\n\nvar SvgNode =\n/*#__PURE__*/\nfunction () {\n function SvgNode(children, attributes) {\n this.children = void 0;\n this.attributes = void 0;\n this.children = children || [];\n this.attributes = attributes || {};\n }\n\n var _proto5 = SvgNode.prototype;\n\n _proto5.toNode = function toNode() {\n var svgNS = \"http://www.w3.org/2000/svg\";\n var node = document.createElementNS(svgNS, \"svg\"); // Apply attributes\n\n for (var attr in this.attributes) {\n if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {\n node.setAttribute(attr, this.attributes[attr]);\n }\n }\n\n for (var i = 0; i < this.children.length; i++) {\n node.appendChild(this.children[i].toNode());\n }\n\n return node;\n };\n\n _proto5.toMarkup = function toMarkup() {\n var markup = \"\";\n\n for (var i = 0; i < this.children.length; i++) {\n markup += this.children[i].toMarkup();\n }\n\n markup += \"\";\n return markup;\n };\n\n return SvgNode;\n}();\nvar domTree_PathNode =\n/*#__PURE__*/\nfunction () {\n function PathNode(pathName, alternate) {\n this.pathName = void 0;\n this.alternate = void 0;\n this.pathName = pathName;\n this.alternate = alternate; // Used only for \\sqrt\n }\n\n var _proto6 = PathNode.prototype;\n\n _proto6.toNode = function toNode() {\n var svgNS = \"http://www.w3.org/2000/svg\";\n var node = document.createElementNS(svgNS, \"path\");\n\n if (this.alternate) {\n node.setAttribute(\"d\", this.alternate);\n } else {\n node.setAttribute(\"d\", svgGeometry_path[this.pathName]);\n }\n\n return node;\n };\n\n _proto6.toMarkup = function toMarkup() {\n if (this.alternate) {\n return \"\";\n } else {\n return \"\";\n }\n };\n\n return PathNode;\n}();\nvar LineNode =\n/*#__PURE__*/\nfunction () {\n function LineNode(attributes) {\n this.attributes = void 0;\n this.attributes = attributes || {};\n }\n\n var _proto7 = LineNode.prototype;\n\n _proto7.toNode = function toNode() {\n var svgNS = \"http://www.w3.org/2000/svg\";\n var node = document.createElementNS(svgNS, \"line\"); // Apply attributes\n\n for (var attr in this.attributes) {\n if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {\n node.setAttribute(attr, this.attributes[attr]);\n }\n }\n\n return node;\n };\n\n _proto7.toMarkup = function toMarkup() {\n var markup = \"\";\n return markup;\n };\n\n return LineNode;\n}();\nfunction assertSymbolDomNode(group) {\n if (group instanceof domTree_SymbolNode) {\n return group;\n } else {\n throw new Error(\"Expected symbolNode but got \" + String(group) + \".\");\n }\n}\nfunction assertSpan(group) {\n if (group instanceof domTree_Span) {\n return group;\n } else {\n throw new Error(\"Expected span but got \" + String(group) + \".\");\n }\n}\n// CONCATENATED MODULE: ./submodules/katex-fonts/fontMetricsData.js\n// This file is GENERATED by buildMetrics.sh. DO NOT MODIFY.\n/* harmony default export */ var fontMetricsData = ({\n \"AMS-Regular\": {\n \"65\": [0, 0.68889, 0, 0, 0.72222],\n \"66\": [0, 0.68889, 0, 0, 0.66667],\n \"67\": [0, 0.68889, 0, 0, 0.72222],\n \"68\": [0, 0.68889, 0, 0, 0.72222],\n \"69\": [0, 0.68889, 0, 0, 0.66667],\n \"70\": [0, 0.68889, 0, 0, 0.61111],\n \"71\": [0, 0.68889, 0, 0, 0.77778],\n \"72\": [0, 0.68889, 0, 0, 0.77778],\n \"73\": [0, 0.68889, 0, 0, 0.38889],\n \"74\": [0.16667, 0.68889, 0, 0, 0.5],\n \"75\": [0, 0.68889, 0, 0, 0.77778],\n \"76\": [0, 0.68889, 0, 0, 0.66667],\n \"77\": [0, 0.68889, 0, 0, 0.94445],\n \"78\": [0, 0.68889, 0, 0, 0.72222],\n \"79\": [0.16667, 0.68889, 0, 0, 0.77778],\n \"80\": [0, 0.68889, 0, 0, 0.61111],\n \"81\": [0.16667, 0.68889, 0, 0, 0.77778],\n \"82\": [0, 0.68889, 0, 0, 0.72222],\n \"83\": [0, 0.68889, 0, 0, 0.55556],\n \"84\": [0, 0.68889, 0, 0, 0.66667],\n \"85\": [0, 0.68889, 0, 0, 0.72222],\n \"86\": [0, 0.68889, 0, 0, 0.72222],\n \"87\": [0, 0.68889, 0, 0, 1.0],\n \"88\": [0, 0.68889, 0, 0, 0.72222],\n \"89\": [0, 0.68889, 0, 0, 0.72222],\n \"90\": [0, 0.68889, 0, 0, 0.66667],\n \"107\": [0, 0.68889, 0, 0, 0.55556],\n \"165\": [0, 0.675, 0.025, 0, 0.75],\n \"174\": [0.15559, 0.69224, 0, 0, 0.94666],\n \"240\": [0, 0.68889, 0, 0, 0.55556],\n \"295\": [0, 0.68889, 0, 0, 0.54028],\n \"710\": [0, 0.825, 0, 0, 2.33334],\n \"732\": [0, 0.9, 0, 0, 2.33334],\n \"770\": [0, 0.825, 0, 0, 2.33334],\n \"771\": [0, 0.9, 0, 0, 2.33334],\n \"989\": [0.08167, 0.58167, 0, 0, 0.77778],\n \"1008\": [0, 0.43056, 0.04028, 0, 0.66667],\n \"8245\": [0, 0.54986, 0, 0, 0.275],\n \"8463\": [0, 0.68889, 0, 0, 0.54028],\n \"8487\": [0, 0.68889, 0, 0, 0.72222],\n \"8498\": [0, 0.68889, 0, 0, 0.55556],\n \"8502\": [0, 0.68889, 0, 0, 0.66667],\n \"8503\": [0, 0.68889, 0, 0, 0.44445],\n \"8504\": [0, 0.68889, 0, 0, 0.66667],\n \"8513\": [0, 0.68889, 0, 0, 0.63889],\n \"8592\": [-0.03598, 0.46402, 0, 0, 0.5],\n \"8594\": [-0.03598, 0.46402, 0, 0, 0.5],\n \"8602\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8603\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8606\": [0.01354, 0.52239, 0, 0, 1.0],\n \"8608\": [0.01354, 0.52239, 0, 0, 1.0],\n \"8610\": [0.01354, 0.52239, 0, 0, 1.11111],\n \"8611\": [0.01354, 0.52239, 0, 0, 1.11111],\n \"8619\": [0, 0.54986, 0, 0, 1.0],\n \"8620\": [0, 0.54986, 0, 0, 1.0],\n \"8621\": [-0.13313, 0.37788, 0, 0, 1.38889],\n \"8622\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8624\": [0, 0.69224, 0, 0, 0.5],\n \"8625\": [0, 0.69224, 0, 0, 0.5],\n \"8630\": [0, 0.43056, 0, 0, 1.0],\n \"8631\": [0, 0.43056, 0, 0, 1.0],\n \"8634\": [0.08198, 0.58198, 0, 0, 0.77778],\n \"8635\": [0.08198, 0.58198, 0, 0, 0.77778],\n \"8638\": [0.19444, 0.69224, 0, 0, 0.41667],\n \"8639\": [0.19444, 0.69224, 0, 0, 0.41667],\n \"8642\": [0.19444, 0.69224, 0, 0, 0.41667],\n \"8643\": [0.19444, 0.69224, 0, 0, 0.41667],\n \"8644\": [0.1808, 0.675, 0, 0, 1.0],\n \"8646\": [0.1808, 0.675, 0, 0, 1.0],\n \"8647\": [0.1808, 0.675, 0, 0, 1.0],\n \"8648\": [0.19444, 0.69224, 0, 0, 0.83334],\n \"8649\": [0.1808, 0.675, 0, 0, 1.0],\n \"8650\": [0.19444, 0.69224, 0, 0, 0.83334],\n \"8651\": [0.01354, 0.52239, 0, 0, 1.0],\n \"8652\": [0.01354, 0.52239, 0, 0, 1.0],\n \"8653\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8654\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8655\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8666\": [0.13667, 0.63667, 0, 0, 1.0],\n \"8667\": [0.13667, 0.63667, 0, 0, 1.0],\n \"8669\": [-0.13313, 0.37788, 0, 0, 1.0],\n \"8672\": [-0.064, 0.437, 0, 0, 1.334],\n \"8674\": [-0.064, 0.437, 0, 0, 1.334],\n \"8705\": [0, 0.825, 0, 0, 0.5],\n \"8708\": [0, 0.68889, 0, 0, 0.55556],\n \"8709\": [0.08167, 0.58167, 0, 0, 0.77778],\n \"8717\": [0, 0.43056, 0, 0, 0.42917],\n \"8722\": [-0.03598, 0.46402, 0, 0, 0.5],\n \"8724\": [0.08198, 0.69224, 0, 0, 0.77778],\n \"8726\": [0.08167, 0.58167, 0, 0, 0.77778],\n \"8733\": [0, 0.69224, 0, 0, 0.77778],\n \"8736\": [0, 0.69224, 0, 0, 0.72222],\n \"8737\": [0, 0.69224, 0, 0, 0.72222],\n \"8738\": [0.03517, 0.52239, 0, 0, 0.72222],\n \"8739\": [0.08167, 0.58167, 0, 0, 0.22222],\n \"8740\": [0.25142, 0.74111, 0, 0, 0.27778],\n \"8741\": [0.08167, 0.58167, 0, 0, 0.38889],\n \"8742\": [0.25142, 0.74111, 0, 0, 0.5],\n \"8756\": [0, 0.69224, 0, 0, 0.66667],\n \"8757\": [0, 0.69224, 0, 0, 0.66667],\n \"8764\": [-0.13313, 0.36687, 0, 0, 0.77778],\n \"8765\": [-0.13313, 0.37788, 0, 0, 0.77778],\n \"8769\": [-0.13313, 0.36687, 0, 0, 0.77778],\n \"8770\": [-0.03625, 0.46375, 0, 0, 0.77778],\n \"8774\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"8776\": [-0.01688, 0.48312, 0, 0, 0.77778],\n \"8778\": [0.08167, 0.58167, 0, 0, 0.77778],\n \"8782\": [0.06062, 0.54986, 0, 0, 0.77778],\n \"8783\": [0.06062, 0.54986, 0, 0, 0.77778],\n \"8785\": [0.08198, 0.58198, 0, 0, 0.77778],\n \"8786\": [0.08198, 0.58198, 0, 0, 0.77778],\n \"8787\": [0.08198, 0.58198, 0, 0, 0.77778],\n \"8790\": [0, 0.69224, 0, 0, 0.77778],\n \"8791\": [0.22958, 0.72958, 0, 0, 0.77778],\n \"8796\": [0.08198, 0.91667, 0, 0, 0.77778],\n \"8806\": [0.25583, 0.75583, 0, 0, 0.77778],\n \"8807\": [0.25583, 0.75583, 0, 0, 0.77778],\n \"8808\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"8809\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"8812\": [0.25583, 0.75583, 0, 0, 0.5],\n \"8814\": [0.20576, 0.70576, 0, 0, 0.77778],\n \"8815\": [0.20576, 0.70576, 0, 0, 0.77778],\n \"8816\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"8817\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"8818\": [0.22958, 0.72958, 0, 0, 0.77778],\n \"8819\": [0.22958, 0.72958, 0, 0, 0.77778],\n \"8822\": [0.1808, 0.675, 0, 0, 0.77778],\n \"8823\": [0.1808, 0.675, 0, 0, 0.77778],\n \"8828\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"8829\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"8830\": [0.22958, 0.72958, 0, 0, 0.77778],\n \"8831\": [0.22958, 0.72958, 0, 0, 0.77778],\n \"8832\": [0.20576, 0.70576, 0, 0, 0.77778],\n \"8833\": [0.20576, 0.70576, 0, 0, 0.77778],\n \"8840\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"8841\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"8842\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"8843\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"8847\": [0.03517, 0.54986, 0, 0, 0.77778],\n \"8848\": [0.03517, 0.54986, 0, 0, 0.77778],\n \"8858\": [0.08198, 0.58198, 0, 0, 0.77778],\n \"8859\": [0.08198, 0.58198, 0, 0, 0.77778],\n \"8861\": [0.08198, 0.58198, 0, 0, 0.77778],\n \"8862\": [0, 0.675, 0, 0, 0.77778],\n \"8863\": [0, 0.675, 0, 0, 0.77778],\n \"8864\": [0, 0.675, 0, 0, 0.77778],\n \"8865\": [0, 0.675, 0, 0, 0.77778],\n \"8872\": [0, 0.69224, 0, 0, 0.61111],\n \"8873\": [0, 0.69224, 0, 0, 0.72222],\n \"8874\": [0, 0.69224, 0, 0, 0.88889],\n \"8876\": [0, 0.68889, 0, 0, 0.61111],\n \"8877\": [0, 0.68889, 0, 0, 0.61111],\n \"8878\": [0, 0.68889, 0, 0, 0.72222],\n \"8879\": [0, 0.68889, 0, 0, 0.72222],\n \"8882\": [0.03517, 0.54986, 0, 0, 0.77778],\n \"8883\": [0.03517, 0.54986, 0, 0, 0.77778],\n \"8884\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"8885\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"8888\": [0, 0.54986, 0, 0, 1.11111],\n \"8890\": [0.19444, 0.43056, 0, 0, 0.55556],\n \"8891\": [0.19444, 0.69224, 0, 0, 0.61111],\n \"8892\": [0.19444, 0.69224, 0, 0, 0.61111],\n \"8901\": [0, 0.54986, 0, 0, 0.27778],\n \"8903\": [0.08167, 0.58167, 0, 0, 0.77778],\n \"8905\": [0.08167, 0.58167, 0, 0, 0.77778],\n \"8906\": [0.08167, 0.58167, 0, 0, 0.77778],\n \"8907\": [0, 0.69224, 0, 0, 0.77778],\n \"8908\": [0, 0.69224, 0, 0, 0.77778],\n \"8909\": [-0.03598, 0.46402, 0, 0, 0.77778],\n \"8910\": [0, 0.54986, 0, 0, 0.76042],\n \"8911\": [0, 0.54986, 0, 0, 0.76042],\n \"8912\": [0.03517, 0.54986, 0, 0, 0.77778],\n \"8913\": [0.03517, 0.54986, 0, 0, 0.77778],\n \"8914\": [0, 0.54986, 0, 0, 0.66667],\n \"8915\": [0, 0.54986, 0, 0, 0.66667],\n \"8916\": [0, 0.69224, 0, 0, 0.66667],\n \"8918\": [0.0391, 0.5391, 0, 0, 0.77778],\n \"8919\": [0.0391, 0.5391, 0, 0, 0.77778],\n \"8920\": [0.03517, 0.54986, 0, 0, 1.33334],\n \"8921\": [0.03517, 0.54986, 0, 0, 1.33334],\n \"8922\": [0.38569, 0.88569, 0, 0, 0.77778],\n \"8923\": [0.38569, 0.88569, 0, 0, 0.77778],\n \"8926\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"8927\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"8928\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"8929\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"8934\": [0.23222, 0.74111, 0, 0, 0.77778],\n \"8935\": [0.23222, 0.74111, 0, 0, 0.77778],\n \"8936\": [0.23222, 0.74111, 0, 0, 0.77778],\n \"8937\": [0.23222, 0.74111, 0, 0, 0.77778],\n \"8938\": [0.20576, 0.70576, 0, 0, 0.77778],\n \"8939\": [0.20576, 0.70576, 0, 0, 0.77778],\n \"8940\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"8941\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"8994\": [0.19444, 0.69224, 0, 0, 0.77778],\n \"8995\": [0.19444, 0.69224, 0, 0, 0.77778],\n \"9416\": [0.15559, 0.69224, 0, 0, 0.90222],\n \"9484\": [0, 0.69224, 0, 0, 0.5],\n \"9488\": [0, 0.69224, 0, 0, 0.5],\n \"9492\": [0, 0.37788, 0, 0, 0.5],\n \"9496\": [0, 0.37788, 0, 0, 0.5],\n \"9585\": [0.19444, 0.68889, 0, 0, 0.88889],\n \"9586\": [0.19444, 0.74111, 0, 0, 0.88889],\n \"9632\": [0, 0.675, 0, 0, 0.77778],\n \"9633\": [0, 0.675, 0, 0, 0.77778],\n \"9650\": [0, 0.54986, 0, 0, 0.72222],\n \"9651\": [0, 0.54986, 0, 0, 0.72222],\n \"9654\": [0.03517, 0.54986, 0, 0, 0.77778],\n \"9660\": [0, 0.54986, 0, 0, 0.72222],\n \"9661\": [0, 0.54986, 0, 0, 0.72222],\n \"9664\": [0.03517, 0.54986, 0, 0, 0.77778],\n \"9674\": [0.11111, 0.69224, 0, 0, 0.66667],\n \"9733\": [0.19444, 0.69224, 0, 0, 0.94445],\n \"10003\": [0, 0.69224, 0, 0, 0.83334],\n \"10016\": [0, 0.69224, 0, 0, 0.83334],\n \"10731\": [0.11111, 0.69224, 0, 0, 0.66667],\n \"10846\": [0.19444, 0.75583, 0, 0, 0.61111],\n \"10877\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"10878\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"10885\": [0.25583, 0.75583, 0, 0, 0.77778],\n \"10886\": [0.25583, 0.75583, 0, 0, 0.77778],\n \"10887\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"10888\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"10889\": [0.26167, 0.75726, 0, 0, 0.77778],\n \"10890\": [0.26167, 0.75726, 0, 0, 0.77778],\n \"10891\": [0.48256, 0.98256, 0, 0, 0.77778],\n \"10892\": [0.48256, 0.98256, 0, 0, 0.77778],\n \"10901\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"10902\": [0.13667, 0.63667, 0, 0, 0.77778],\n \"10933\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"10934\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"10935\": [0.26167, 0.75726, 0, 0, 0.77778],\n \"10936\": [0.26167, 0.75726, 0, 0, 0.77778],\n \"10937\": [0.26167, 0.75726, 0, 0, 0.77778],\n \"10938\": [0.26167, 0.75726, 0, 0, 0.77778],\n \"10949\": [0.25583, 0.75583, 0, 0, 0.77778],\n \"10950\": [0.25583, 0.75583, 0, 0, 0.77778],\n \"10955\": [0.28481, 0.79383, 0, 0, 0.77778],\n \"10956\": [0.28481, 0.79383, 0, 0, 0.77778],\n \"57350\": [0.08167, 0.58167, 0, 0, 0.22222],\n \"57351\": [0.08167, 0.58167, 0, 0, 0.38889],\n \"57352\": [0.08167, 0.58167, 0, 0, 0.77778],\n \"57353\": [0, 0.43056, 0.04028, 0, 0.66667],\n \"57356\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"57357\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"57358\": [0.41951, 0.91951, 0, 0, 0.77778],\n \"57359\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"57360\": [0.30274, 0.79383, 0, 0, 0.77778],\n \"57361\": [0.41951, 0.91951, 0, 0, 0.77778],\n \"57366\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"57367\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"57368\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"57369\": [0.25142, 0.75726, 0, 0, 0.77778],\n \"57370\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"57371\": [0.13597, 0.63597, 0, 0, 0.77778]\n },\n \"Caligraphic-Regular\": {\n \"48\": [0, 0.43056, 0, 0, 0.5],\n \"49\": [0, 0.43056, 0, 0, 0.5],\n \"50\": [0, 0.43056, 0, 0, 0.5],\n \"51\": [0.19444, 0.43056, 0, 0, 0.5],\n \"52\": [0.19444, 0.43056, 0, 0, 0.5],\n \"53\": [0.19444, 0.43056, 0, 0, 0.5],\n \"54\": [0, 0.64444, 0, 0, 0.5],\n \"55\": [0.19444, 0.43056, 0, 0, 0.5],\n \"56\": [0, 0.64444, 0, 0, 0.5],\n \"57\": [0.19444, 0.43056, 0, 0, 0.5],\n \"65\": [0, 0.68333, 0, 0.19445, 0.79847],\n \"66\": [0, 0.68333, 0.03041, 0.13889, 0.65681],\n \"67\": [0, 0.68333, 0.05834, 0.13889, 0.52653],\n \"68\": [0, 0.68333, 0.02778, 0.08334, 0.77139],\n \"69\": [0, 0.68333, 0.08944, 0.11111, 0.52778],\n \"70\": [0, 0.68333, 0.09931, 0.11111, 0.71875],\n \"71\": [0.09722, 0.68333, 0.0593, 0.11111, 0.59487],\n \"72\": [0, 0.68333, 0.00965, 0.11111, 0.84452],\n \"73\": [0, 0.68333, 0.07382, 0, 0.54452],\n \"74\": [0.09722, 0.68333, 0.18472, 0.16667, 0.67778],\n \"75\": [0, 0.68333, 0.01445, 0.05556, 0.76195],\n \"76\": [0, 0.68333, 0, 0.13889, 0.68972],\n \"77\": [0, 0.68333, 0, 0.13889, 1.2009],\n \"78\": [0, 0.68333, 0.14736, 0.08334, 0.82049],\n \"79\": [0, 0.68333, 0.02778, 0.11111, 0.79611],\n \"80\": [0, 0.68333, 0.08222, 0.08334, 0.69556],\n \"81\": [0.09722, 0.68333, 0, 0.11111, 0.81667],\n \"82\": [0, 0.68333, 0, 0.08334, 0.8475],\n \"83\": [0, 0.68333, 0.075, 0.13889, 0.60556],\n \"84\": [0, 0.68333, 0.25417, 0, 0.54464],\n \"85\": [0, 0.68333, 0.09931, 0.08334, 0.62583],\n \"86\": [0, 0.68333, 0.08222, 0, 0.61278],\n \"87\": [0, 0.68333, 0.08222, 0.08334, 0.98778],\n \"88\": [0, 0.68333, 0.14643, 0.13889, 0.7133],\n \"89\": [0.09722, 0.68333, 0.08222, 0.08334, 0.66834],\n \"90\": [0, 0.68333, 0.07944, 0.13889, 0.72473]\n },\n \"Fraktur-Regular\": {\n \"33\": [0, 0.69141, 0, 0, 0.29574],\n \"34\": [0, 0.69141, 0, 0, 0.21471],\n \"38\": [0, 0.69141, 0, 0, 0.73786],\n \"39\": [0, 0.69141, 0, 0, 0.21201],\n \"40\": [0.24982, 0.74947, 0, 0, 0.38865],\n \"41\": [0.24982, 0.74947, 0, 0, 0.38865],\n \"42\": [0, 0.62119, 0, 0, 0.27764],\n \"43\": [0.08319, 0.58283, 0, 0, 0.75623],\n \"44\": [0, 0.10803, 0, 0, 0.27764],\n \"45\": [0.08319, 0.58283, 0, 0, 0.75623],\n \"46\": [0, 0.10803, 0, 0, 0.27764],\n \"47\": [0.24982, 0.74947, 0, 0, 0.50181],\n \"48\": [0, 0.47534, 0, 0, 0.50181],\n \"49\": [0, 0.47534, 0, 0, 0.50181],\n \"50\": [0, 0.47534, 0, 0, 0.50181],\n \"51\": [0.18906, 0.47534, 0, 0, 0.50181],\n \"52\": [0.18906, 0.47534, 0, 0, 0.50181],\n \"53\": [0.18906, 0.47534, 0, 0, 0.50181],\n \"54\": [0, 0.69141, 0, 0, 0.50181],\n \"55\": [0.18906, 0.47534, 0, 0, 0.50181],\n \"56\": [0, 0.69141, 0, 0, 0.50181],\n \"57\": [0.18906, 0.47534, 0, 0, 0.50181],\n \"58\": [0, 0.47534, 0, 0, 0.21606],\n \"59\": [0.12604, 0.47534, 0, 0, 0.21606],\n \"61\": [-0.13099, 0.36866, 0, 0, 0.75623],\n \"63\": [0, 0.69141, 0, 0, 0.36245],\n \"65\": [0, 0.69141, 0, 0, 0.7176],\n \"66\": [0, 0.69141, 0, 0, 0.88397],\n \"67\": [0, 0.69141, 0, 0, 0.61254],\n \"68\": [0, 0.69141, 0, 0, 0.83158],\n \"69\": [0, 0.69141, 0, 0, 0.66278],\n \"70\": [0.12604, 0.69141, 0, 0, 0.61119],\n \"71\": [0, 0.69141, 0, 0, 0.78539],\n \"72\": [0.06302, 0.69141, 0, 0, 0.7203],\n \"73\": [0, 0.69141, 0, 0, 0.55448],\n \"74\": [0.12604, 0.69141, 0, 0, 0.55231],\n \"75\": [0, 0.69141, 0, 0, 0.66845],\n \"76\": [0, 0.69141, 0, 0, 0.66602],\n \"77\": [0, 0.69141, 0, 0, 1.04953],\n \"78\": [0, 0.69141, 0, 0, 0.83212],\n \"79\": [0, 0.69141, 0, 0, 0.82699],\n \"80\": [0.18906, 0.69141, 0, 0, 0.82753],\n \"81\": [0.03781, 0.69141, 0, 0, 0.82699],\n \"82\": [0, 0.69141, 0, 0, 0.82807],\n \"83\": [0, 0.69141, 0, 0, 0.82861],\n \"84\": [0, 0.69141, 0, 0, 0.66899],\n \"85\": [0, 0.69141, 0, 0, 0.64576],\n \"86\": [0, 0.69141, 0, 0, 0.83131],\n \"87\": [0, 0.69141, 0, 0, 1.04602],\n \"88\": [0, 0.69141, 0, 0, 0.71922],\n \"89\": [0.18906, 0.69141, 0, 0, 0.83293],\n \"90\": [0.12604, 0.69141, 0, 0, 0.60201],\n \"91\": [0.24982, 0.74947, 0, 0, 0.27764],\n \"93\": [0.24982, 0.74947, 0, 0, 0.27764],\n \"94\": [0, 0.69141, 0, 0, 0.49965],\n \"97\": [0, 0.47534, 0, 0, 0.50046],\n \"98\": [0, 0.69141, 0, 0, 0.51315],\n \"99\": [0, 0.47534, 0, 0, 0.38946],\n \"100\": [0, 0.62119, 0, 0, 0.49857],\n \"101\": [0, 0.47534, 0, 0, 0.40053],\n \"102\": [0.18906, 0.69141, 0, 0, 0.32626],\n \"103\": [0.18906, 0.47534, 0, 0, 0.5037],\n \"104\": [0.18906, 0.69141, 0, 0, 0.52126],\n \"105\": [0, 0.69141, 0, 0, 0.27899],\n \"106\": [0, 0.69141, 0, 0, 0.28088],\n \"107\": [0, 0.69141, 0, 0, 0.38946],\n \"108\": [0, 0.69141, 0, 0, 0.27953],\n \"109\": [0, 0.47534, 0, 0, 0.76676],\n \"110\": [0, 0.47534, 0, 0, 0.52666],\n \"111\": [0, 0.47534, 0, 0, 0.48885],\n \"112\": [0.18906, 0.52396, 0, 0, 0.50046],\n \"113\": [0.18906, 0.47534, 0, 0, 0.48912],\n \"114\": [0, 0.47534, 0, 0, 0.38919],\n \"115\": [0, 0.47534, 0, 0, 0.44266],\n \"116\": [0, 0.62119, 0, 0, 0.33301],\n \"117\": [0, 0.47534, 0, 0, 0.5172],\n \"118\": [0, 0.52396, 0, 0, 0.5118],\n \"119\": [0, 0.52396, 0, 0, 0.77351],\n \"120\": [0.18906, 0.47534, 0, 0, 0.38865],\n \"121\": [0.18906, 0.47534, 0, 0, 0.49884],\n \"122\": [0.18906, 0.47534, 0, 0, 0.39054],\n \"8216\": [0, 0.69141, 0, 0, 0.21471],\n \"8217\": [0, 0.69141, 0, 0, 0.21471],\n \"58112\": [0, 0.62119, 0, 0, 0.49749],\n \"58113\": [0, 0.62119, 0, 0, 0.4983],\n \"58114\": [0.18906, 0.69141, 0, 0, 0.33328],\n \"58115\": [0.18906, 0.69141, 0, 0, 0.32923],\n \"58116\": [0.18906, 0.47534, 0, 0, 0.50343],\n \"58117\": [0, 0.69141, 0, 0, 0.33301],\n \"58118\": [0, 0.62119, 0, 0, 0.33409],\n \"58119\": [0, 0.47534, 0, 0, 0.50073]\n },\n \"Main-Bold\": {\n \"33\": [0, 0.69444, 0, 0, 0.35],\n \"34\": [0, 0.69444, 0, 0, 0.60278],\n \"35\": [0.19444, 0.69444, 0, 0, 0.95833],\n \"36\": [0.05556, 0.75, 0, 0, 0.575],\n \"37\": [0.05556, 0.75, 0, 0, 0.95833],\n \"38\": [0, 0.69444, 0, 0, 0.89444],\n \"39\": [0, 0.69444, 0, 0, 0.31944],\n \"40\": [0.25, 0.75, 0, 0, 0.44722],\n \"41\": [0.25, 0.75, 0, 0, 0.44722],\n \"42\": [0, 0.75, 0, 0, 0.575],\n \"43\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"44\": [0.19444, 0.15556, 0, 0, 0.31944],\n \"45\": [0, 0.44444, 0, 0, 0.38333],\n \"46\": [0, 0.15556, 0, 0, 0.31944],\n \"47\": [0.25, 0.75, 0, 0, 0.575],\n \"48\": [0, 0.64444, 0, 0, 0.575],\n \"49\": [0, 0.64444, 0, 0, 0.575],\n \"50\": [0, 0.64444, 0, 0, 0.575],\n \"51\": [0, 0.64444, 0, 0, 0.575],\n \"52\": [0, 0.64444, 0, 0, 0.575],\n \"53\": [0, 0.64444, 0, 0, 0.575],\n \"54\": [0, 0.64444, 0, 0, 0.575],\n \"55\": [0, 0.64444, 0, 0, 0.575],\n \"56\": [0, 0.64444, 0, 0, 0.575],\n \"57\": [0, 0.64444, 0, 0, 0.575],\n \"58\": [0, 0.44444, 0, 0, 0.31944],\n \"59\": [0.19444, 0.44444, 0, 0, 0.31944],\n \"60\": [0.08556, 0.58556, 0, 0, 0.89444],\n \"61\": [-0.10889, 0.39111, 0, 0, 0.89444],\n \"62\": [0.08556, 0.58556, 0, 0, 0.89444],\n \"63\": [0, 0.69444, 0, 0, 0.54305],\n \"64\": [0, 0.69444, 0, 0, 0.89444],\n \"65\": [0, 0.68611, 0, 0, 0.86944],\n \"66\": [0, 0.68611, 0, 0, 0.81805],\n \"67\": [0, 0.68611, 0, 0, 0.83055],\n \"68\": [0, 0.68611, 0, 0, 0.88194],\n \"69\": [0, 0.68611, 0, 0, 0.75555],\n \"70\": [0, 0.68611, 0, 0, 0.72361],\n \"71\": [0, 0.68611, 0, 0, 0.90416],\n \"72\": [0, 0.68611, 0, 0, 0.9],\n \"73\": [0, 0.68611, 0, 0, 0.43611],\n \"74\": [0, 0.68611, 0, 0, 0.59444],\n \"75\": [0, 0.68611, 0, 0, 0.90138],\n \"76\": [0, 0.68611, 0, 0, 0.69166],\n \"77\": [0, 0.68611, 0, 0, 1.09166],\n \"78\": [0, 0.68611, 0, 0, 0.9],\n \"79\": [0, 0.68611, 0, 0, 0.86388],\n \"80\": [0, 0.68611, 0, 0, 0.78611],\n \"81\": [0.19444, 0.68611, 0, 0, 0.86388],\n \"82\": [0, 0.68611, 0, 0, 0.8625],\n \"83\": [0, 0.68611, 0, 0, 0.63889],\n \"84\": [0, 0.68611, 0, 0, 0.8],\n \"85\": [0, 0.68611, 0, 0, 0.88472],\n \"86\": [0, 0.68611, 0.01597, 0, 0.86944],\n \"87\": [0, 0.68611, 0.01597, 0, 1.18888],\n \"88\": [0, 0.68611, 0, 0, 0.86944],\n \"89\": [0, 0.68611, 0.02875, 0, 0.86944],\n \"90\": [0, 0.68611, 0, 0, 0.70277],\n \"91\": [0.25, 0.75, 0, 0, 0.31944],\n \"92\": [0.25, 0.75, 0, 0, 0.575],\n \"93\": [0.25, 0.75, 0, 0, 0.31944],\n \"94\": [0, 0.69444, 0, 0, 0.575],\n \"95\": [0.31, 0.13444, 0.03194, 0, 0.575],\n \"97\": [0, 0.44444, 0, 0, 0.55902],\n \"98\": [0, 0.69444, 0, 0, 0.63889],\n \"99\": [0, 0.44444, 0, 0, 0.51111],\n \"100\": [0, 0.69444, 0, 0, 0.63889],\n \"101\": [0, 0.44444, 0, 0, 0.52708],\n \"102\": [0, 0.69444, 0.10903, 0, 0.35139],\n \"103\": [0.19444, 0.44444, 0.01597, 0, 0.575],\n \"104\": [0, 0.69444, 0, 0, 0.63889],\n \"105\": [0, 0.69444, 0, 0, 0.31944],\n \"106\": [0.19444, 0.69444, 0, 0, 0.35139],\n \"107\": [0, 0.69444, 0, 0, 0.60694],\n \"108\": [0, 0.69444, 0, 0, 0.31944],\n \"109\": [0, 0.44444, 0, 0, 0.95833],\n \"110\": [0, 0.44444, 0, 0, 0.63889],\n \"111\": [0, 0.44444, 0, 0, 0.575],\n \"112\": [0.19444, 0.44444, 0, 0, 0.63889],\n \"113\": [0.19444, 0.44444, 0, 0, 0.60694],\n \"114\": [0, 0.44444, 0, 0, 0.47361],\n \"115\": [0, 0.44444, 0, 0, 0.45361],\n \"116\": [0, 0.63492, 0, 0, 0.44722],\n \"117\": [0, 0.44444, 0, 0, 0.63889],\n \"118\": [0, 0.44444, 0.01597, 0, 0.60694],\n \"119\": [0, 0.44444, 0.01597, 0, 0.83055],\n \"120\": [0, 0.44444, 0, 0, 0.60694],\n \"121\": [0.19444, 0.44444, 0.01597, 0, 0.60694],\n \"122\": [0, 0.44444, 0, 0, 0.51111],\n \"123\": [0.25, 0.75, 0, 0, 0.575],\n \"124\": [0.25, 0.75, 0, 0, 0.31944],\n \"125\": [0.25, 0.75, 0, 0, 0.575],\n \"126\": [0.35, 0.34444, 0, 0, 0.575],\n \"168\": [0, 0.69444, 0, 0, 0.575],\n \"172\": [0, 0.44444, 0, 0, 0.76666],\n \"176\": [0, 0.69444, 0, 0, 0.86944],\n \"177\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"184\": [0.17014, 0, 0, 0, 0.51111],\n \"198\": [0, 0.68611, 0, 0, 1.04166],\n \"215\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"216\": [0.04861, 0.73472, 0, 0, 0.89444],\n \"223\": [0, 0.69444, 0, 0, 0.59722],\n \"230\": [0, 0.44444, 0, 0, 0.83055],\n \"247\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"248\": [0.09722, 0.54167, 0, 0, 0.575],\n \"305\": [0, 0.44444, 0, 0, 0.31944],\n \"338\": [0, 0.68611, 0, 0, 1.16944],\n \"339\": [0, 0.44444, 0, 0, 0.89444],\n \"567\": [0.19444, 0.44444, 0, 0, 0.35139],\n \"710\": [0, 0.69444, 0, 0, 0.575],\n \"711\": [0, 0.63194, 0, 0, 0.575],\n \"713\": [0, 0.59611, 0, 0, 0.575],\n \"714\": [0, 0.69444, 0, 0, 0.575],\n \"715\": [0, 0.69444, 0, 0, 0.575],\n \"728\": [0, 0.69444, 0, 0, 0.575],\n \"729\": [0, 0.69444, 0, 0, 0.31944],\n \"730\": [0, 0.69444, 0, 0, 0.86944],\n \"732\": [0, 0.69444, 0, 0, 0.575],\n \"733\": [0, 0.69444, 0, 0, 0.575],\n \"915\": [0, 0.68611, 0, 0, 0.69166],\n \"916\": [0, 0.68611, 0, 0, 0.95833],\n \"920\": [0, 0.68611, 0, 0, 0.89444],\n \"923\": [0, 0.68611, 0, 0, 0.80555],\n \"926\": [0, 0.68611, 0, 0, 0.76666],\n \"928\": [0, 0.68611, 0, 0, 0.9],\n \"931\": [0, 0.68611, 0, 0, 0.83055],\n \"933\": [0, 0.68611, 0, 0, 0.89444],\n \"934\": [0, 0.68611, 0, 0, 0.83055],\n \"936\": [0, 0.68611, 0, 0, 0.89444],\n \"937\": [0, 0.68611, 0, 0, 0.83055],\n \"8211\": [0, 0.44444, 0.03194, 0, 0.575],\n \"8212\": [0, 0.44444, 0.03194, 0, 1.14999],\n \"8216\": [0, 0.69444, 0, 0, 0.31944],\n \"8217\": [0, 0.69444, 0, 0, 0.31944],\n \"8220\": [0, 0.69444, 0, 0, 0.60278],\n \"8221\": [0, 0.69444, 0, 0, 0.60278],\n \"8224\": [0.19444, 0.69444, 0, 0, 0.51111],\n \"8225\": [0.19444, 0.69444, 0, 0, 0.51111],\n \"8242\": [0, 0.55556, 0, 0, 0.34444],\n \"8407\": [0, 0.72444, 0.15486, 0, 0.575],\n \"8463\": [0, 0.69444, 0, 0, 0.66759],\n \"8465\": [0, 0.69444, 0, 0, 0.83055],\n \"8467\": [0, 0.69444, 0, 0, 0.47361],\n \"8472\": [0.19444, 0.44444, 0, 0, 0.74027],\n \"8476\": [0, 0.69444, 0, 0, 0.83055],\n \"8501\": [0, 0.69444, 0, 0, 0.70277],\n \"8592\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8593\": [0.19444, 0.69444, 0, 0, 0.575],\n \"8594\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8595\": [0.19444, 0.69444, 0, 0, 0.575],\n \"8596\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8597\": [0.25, 0.75, 0, 0, 0.575],\n \"8598\": [0.19444, 0.69444, 0, 0, 1.14999],\n \"8599\": [0.19444, 0.69444, 0, 0, 1.14999],\n \"8600\": [0.19444, 0.69444, 0, 0, 1.14999],\n \"8601\": [0.19444, 0.69444, 0, 0, 1.14999],\n \"8636\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8637\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8640\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8641\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8656\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8657\": [0.19444, 0.69444, 0, 0, 0.70277],\n \"8658\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8659\": [0.19444, 0.69444, 0, 0, 0.70277],\n \"8660\": [-0.10889, 0.39111, 0, 0, 1.14999],\n \"8661\": [0.25, 0.75, 0, 0, 0.70277],\n \"8704\": [0, 0.69444, 0, 0, 0.63889],\n \"8706\": [0, 0.69444, 0.06389, 0, 0.62847],\n \"8707\": [0, 0.69444, 0, 0, 0.63889],\n \"8709\": [0.05556, 0.75, 0, 0, 0.575],\n \"8711\": [0, 0.68611, 0, 0, 0.95833],\n \"8712\": [0.08556, 0.58556, 0, 0, 0.76666],\n \"8715\": [0.08556, 0.58556, 0, 0, 0.76666],\n \"8722\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"8723\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"8725\": [0.25, 0.75, 0, 0, 0.575],\n \"8726\": [0.25, 0.75, 0, 0, 0.575],\n \"8727\": [-0.02778, 0.47222, 0, 0, 0.575],\n \"8728\": [-0.02639, 0.47361, 0, 0, 0.575],\n \"8729\": [-0.02639, 0.47361, 0, 0, 0.575],\n \"8730\": [0.18, 0.82, 0, 0, 0.95833],\n \"8733\": [0, 0.44444, 0, 0, 0.89444],\n \"8734\": [0, 0.44444, 0, 0, 1.14999],\n \"8736\": [0, 0.69224, 0, 0, 0.72222],\n \"8739\": [0.25, 0.75, 0, 0, 0.31944],\n \"8741\": [0.25, 0.75, 0, 0, 0.575],\n \"8743\": [0, 0.55556, 0, 0, 0.76666],\n \"8744\": [0, 0.55556, 0, 0, 0.76666],\n \"8745\": [0, 0.55556, 0, 0, 0.76666],\n \"8746\": [0, 0.55556, 0, 0, 0.76666],\n \"8747\": [0.19444, 0.69444, 0.12778, 0, 0.56875],\n \"8764\": [-0.10889, 0.39111, 0, 0, 0.89444],\n \"8768\": [0.19444, 0.69444, 0, 0, 0.31944],\n \"8771\": [0.00222, 0.50222, 0, 0, 0.89444],\n \"8776\": [0.02444, 0.52444, 0, 0, 0.89444],\n \"8781\": [0.00222, 0.50222, 0, 0, 0.89444],\n \"8801\": [0.00222, 0.50222, 0, 0, 0.89444],\n \"8804\": [0.19667, 0.69667, 0, 0, 0.89444],\n \"8805\": [0.19667, 0.69667, 0, 0, 0.89444],\n \"8810\": [0.08556, 0.58556, 0, 0, 1.14999],\n \"8811\": [0.08556, 0.58556, 0, 0, 1.14999],\n \"8826\": [0.08556, 0.58556, 0, 0, 0.89444],\n \"8827\": [0.08556, 0.58556, 0, 0, 0.89444],\n \"8834\": [0.08556, 0.58556, 0, 0, 0.89444],\n \"8835\": [0.08556, 0.58556, 0, 0, 0.89444],\n \"8838\": [0.19667, 0.69667, 0, 0, 0.89444],\n \"8839\": [0.19667, 0.69667, 0, 0, 0.89444],\n \"8846\": [0, 0.55556, 0, 0, 0.76666],\n \"8849\": [0.19667, 0.69667, 0, 0, 0.89444],\n \"8850\": [0.19667, 0.69667, 0, 0, 0.89444],\n \"8851\": [0, 0.55556, 0, 0, 0.76666],\n \"8852\": [0, 0.55556, 0, 0, 0.76666],\n \"8853\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"8854\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"8855\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"8856\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"8857\": [0.13333, 0.63333, 0, 0, 0.89444],\n \"8866\": [0, 0.69444, 0, 0, 0.70277],\n \"8867\": [0, 0.69444, 0, 0, 0.70277],\n \"8868\": [0, 0.69444, 0, 0, 0.89444],\n \"8869\": [0, 0.69444, 0, 0, 0.89444],\n \"8900\": [-0.02639, 0.47361, 0, 0, 0.575],\n \"8901\": [-0.02639, 0.47361, 0, 0, 0.31944],\n \"8902\": [-0.02778, 0.47222, 0, 0, 0.575],\n \"8968\": [0.25, 0.75, 0, 0, 0.51111],\n \"8969\": [0.25, 0.75, 0, 0, 0.51111],\n \"8970\": [0.25, 0.75, 0, 0, 0.51111],\n \"8971\": [0.25, 0.75, 0, 0, 0.51111],\n \"8994\": [-0.13889, 0.36111, 0, 0, 1.14999],\n \"8995\": [-0.13889, 0.36111, 0, 0, 1.14999],\n \"9651\": [0.19444, 0.69444, 0, 0, 1.02222],\n \"9657\": [-0.02778, 0.47222, 0, 0, 0.575],\n \"9661\": [0.19444, 0.69444, 0, 0, 1.02222],\n \"9667\": [-0.02778, 0.47222, 0, 0, 0.575],\n \"9711\": [0.19444, 0.69444, 0, 0, 1.14999],\n \"9824\": [0.12963, 0.69444, 0, 0, 0.89444],\n \"9825\": [0.12963, 0.69444, 0, 0, 0.89444],\n \"9826\": [0.12963, 0.69444, 0, 0, 0.89444],\n \"9827\": [0.12963, 0.69444, 0, 0, 0.89444],\n \"9837\": [0, 0.75, 0, 0, 0.44722],\n \"9838\": [0.19444, 0.69444, 0, 0, 0.44722],\n \"9839\": [0.19444, 0.69444, 0, 0, 0.44722],\n \"10216\": [0.25, 0.75, 0, 0, 0.44722],\n \"10217\": [0.25, 0.75, 0, 0, 0.44722],\n \"10815\": [0, 0.68611, 0, 0, 0.9],\n \"10927\": [0.19667, 0.69667, 0, 0, 0.89444],\n \"10928\": [0.19667, 0.69667, 0, 0, 0.89444],\n \"57376\": [0.19444, 0.69444, 0, 0, 0]\n },\n \"Main-BoldItalic\": {\n \"33\": [0, 0.69444, 0.11417, 0, 0.38611],\n \"34\": [0, 0.69444, 0.07939, 0, 0.62055],\n \"35\": [0.19444, 0.69444, 0.06833, 0, 0.94444],\n \"37\": [0.05556, 0.75, 0.12861, 0, 0.94444],\n \"38\": [0, 0.69444, 0.08528, 0, 0.88555],\n \"39\": [0, 0.69444, 0.12945, 0, 0.35555],\n \"40\": [0.25, 0.75, 0.15806, 0, 0.47333],\n \"41\": [0.25, 0.75, 0.03306, 0, 0.47333],\n \"42\": [0, 0.75, 0.14333, 0, 0.59111],\n \"43\": [0.10333, 0.60333, 0.03306, 0, 0.88555],\n \"44\": [0.19444, 0.14722, 0, 0, 0.35555],\n \"45\": [0, 0.44444, 0.02611, 0, 0.41444],\n \"46\": [0, 0.14722, 0, 0, 0.35555],\n \"47\": [0.25, 0.75, 0.15806, 0, 0.59111],\n \"48\": [0, 0.64444, 0.13167, 0, 0.59111],\n \"49\": [0, 0.64444, 0.13167, 0, 0.59111],\n \"50\": [0, 0.64444, 0.13167, 0, 0.59111],\n \"51\": [0, 0.64444, 0.13167, 0, 0.59111],\n \"52\": [0.19444, 0.64444, 0.13167, 0, 0.59111],\n \"53\": [0, 0.64444, 0.13167, 0, 0.59111],\n \"54\": [0, 0.64444, 0.13167, 0, 0.59111],\n \"55\": [0.19444, 0.64444, 0.13167, 0, 0.59111],\n \"56\": [0, 0.64444, 0.13167, 0, 0.59111],\n \"57\": [0, 0.64444, 0.13167, 0, 0.59111],\n \"58\": [0, 0.44444, 0.06695, 0, 0.35555],\n \"59\": [0.19444, 0.44444, 0.06695, 0, 0.35555],\n \"61\": [-0.10889, 0.39111, 0.06833, 0, 0.88555],\n \"63\": [0, 0.69444, 0.11472, 0, 0.59111],\n \"64\": [0, 0.69444, 0.09208, 0, 0.88555],\n \"65\": [0, 0.68611, 0, 0, 0.86555],\n \"66\": [0, 0.68611, 0.0992, 0, 0.81666],\n \"67\": [0, 0.68611, 0.14208, 0, 0.82666],\n \"68\": [0, 0.68611, 0.09062, 0, 0.87555],\n \"69\": [0, 0.68611, 0.11431, 0, 0.75666],\n \"70\": [0, 0.68611, 0.12903, 0, 0.72722],\n \"71\": [0, 0.68611, 0.07347, 0, 0.89527],\n \"72\": [0, 0.68611, 0.17208, 0, 0.8961],\n \"73\": [0, 0.68611, 0.15681, 0, 0.47166],\n \"74\": [0, 0.68611, 0.145, 0, 0.61055],\n \"75\": [0, 0.68611, 0.14208, 0, 0.89499],\n \"76\": [0, 0.68611, 0, 0, 0.69777],\n \"77\": [0, 0.68611, 0.17208, 0, 1.07277],\n \"78\": [0, 0.68611, 0.17208, 0, 0.8961],\n \"79\": [0, 0.68611, 0.09062, 0, 0.85499],\n \"80\": [0, 0.68611, 0.0992, 0, 0.78721],\n \"81\": [0.19444, 0.68611, 0.09062, 0, 0.85499],\n \"82\": [0, 0.68611, 0.02559, 0, 0.85944],\n \"83\": [0, 0.68611, 0.11264, 0, 0.64999],\n \"84\": [0, 0.68611, 0.12903, 0, 0.7961],\n \"85\": [0, 0.68611, 0.17208, 0, 0.88083],\n \"86\": [0, 0.68611, 0.18625, 0, 0.86555],\n \"87\": [0, 0.68611, 0.18625, 0, 1.15999],\n \"88\": [0, 0.68611, 0.15681, 0, 0.86555],\n \"89\": [0, 0.68611, 0.19803, 0, 0.86555],\n \"90\": [0, 0.68611, 0.14208, 0, 0.70888],\n \"91\": [0.25, 0.75, 0.1875, 0, 0.35611],\n \"93\": [0.25, 0.75, 0.09972, 0, 0.35611],\n \"94\": [0, 0.69444, 0.06709, 0, 0.59111],\n \"95\": [0.31, 0.13444, 0.09811, 0, 0.59111],\n \"97\": [0, 0.44444, 0.09426, 0, 0.59111],\n \"98\": [0, 0.69444, 0.07861, 0, 0.53222],\n \"99\": [0, 0.44444, 0.05222, 0, 0.53222],\n \"100\": [0, 0.69444, 0.10861, 0, 0.59111],\n \"101\": [0, 0.44444, 0.085, 0, 0.53222],\n \"102\": [0.19444, 0.69444, 0.21778, 0, 0.4],\n \"103\": [0.19444, 0.44444, 0.105, 0, 0.53222],\n \"104\": [0, 0.69444, 0.09426, 0, 0.59111],\n \"105\": [0, 0.69326, 0.11387, 0, 0.35555],\n \"106\": [0.19444, 0.69326, 0.1672, 0, 0.35555],\n \"107\": [0, 0.69444, 0.11111, 0, 0.53222],\n \"108\": [0, 0.69444, 0.10861, 0, 0.29666],\n \"109\": [0, 0.44444, 0.09426, 0, 0.94444],\n \"110\": [0, 0.44444, 0.09426, 0, 0.64999],\n \"111\": [0, 0.44444, 0.07861, 0, 0.59111],\n \"112\": [0.19444, 0.44444, 0.07861, 0, 0.59111],\n \"113\": [0.19444, 0.44444, 0.105, 0, 0.53222],\n \"114\": [0, 0.44444, 0.11111, 0, 0.50167],\n \"115\": [0, 0.44444, 0.08167, 0, 0.48694],\n \"116\": [0, 0.63492, 0.09639, 0, 0.385],\n \"117\": [0, 0.44444, 0.09426, 0, 0.62055],\n \"118\": [0, 0.44444, 0.11111, 0, 0.53222],\n \"119\": [0, 0.44444, 0.11111, 0, 0.76777],\n \"120\": [0, 0.44444, 0.12583, 0, 0.56055],\n \"121\": [0.19444, 0.44444, 0.105, 0, 0.56166],\n \"122\": [0, 0.44444, 0.13889, 0, 0.49055],\n \"126\": [0.35, 0.34444, 0.11472, 0, 0.59111],\n \"163\": [0, 0.69444, 0, 0, 0.86853],\n \"168\": [0, 0.69444, 0.11473, 0, 0.59111],\n \"176\": [0, 0.69444, 0, 0, 0.94888],\n \"184\": [0.17014, 0, 0, 0, 0.53222],\n \"198\": [0, 0.68611, 0.11431, 0, 1.02277],\n \"216\": [0.04861, 0.73472, 0.09062, 0, 0.88555],\n \"223\": [0.19444, 0.69444, 0.09736, 0, 0.665],\n \"230\": [0, 0.44444, 0.085, 0, 0.82666],\n \"248\": [0.09722, 0.54167, 0.09458, 0, 0.59111],\n \"305\": [0, 0.44444, 0.09426, 0, 0.35555],\n \"338\": [0, 0.68611, 0.11431, 0, 1.14054],\n \"339\": [0, 0.44444, 0.085, 0, 0.82666],\n \"567\": [0.19444, 0.44444, 0.04611, 0, 0.385],\n \"710\": [0, 0.69444, 0.06709, 0, 0.59111],\n \"711\": [0, 0.63194, 0.08271, 0, 0.59111],\n \"713\": [0, 0.59444, 0.10444, 0, 0.59111],\n \"714\": [0, 0.69444, 0.08528, 0, 0.59111],\n \"715\": [0, 0.69444, 0, 0, 0.59111],\n \"728\": [0, 0.69444, 0.10333, 0, 0.59111],\n \"729\": [0, 0.69444, 0.12945, 0, 0.35555],\n \"730\": [0, 0.69444, 0, 0, 0.94888],\n \"732\": [0, 0.69444, 0.11472, 0, 0.59111],\n \"733\": [0, 0.69444, 0.11472, 0, 0.59111],\n \"915\": [0, 0.68611, 0.12903, 0, 0.69777],\n \"916\": [0, 0.68611, 0, 0, 0.94444],\n \"920\": [0, 0.68611, 0.09062, 0, 0.88555],\n \"923\": [0, 0.68611, 0, 0, 0.80666],\n \"926\": [0, 0.68611, 0.15092, 0, 0.76777],\n \"928\": [0, 0.68611, 0.17208, 0, 0.8961],\n \"931\": [0, 0.68611, 0.11431, 0, 0.82666],\n \"933\": [0, 0.68611, 0.10778, 0, 0.88555],\n \"934\": [0, 0.68611, 0.05632, 0, 0.82666],\n \"936\": [0, 0.68611, 0.10778, 0, 0.88555],\n \"937\": [0, 0.68611, 0.0992, 0, 0.82666],\n \"8211\": [0, 0.44444, 0.09811, 0, 0.59111],\n \"8212\": [0, 0.44444, 0.09811, 0, 1.18221],\n \"8216\": [0, 0.69444, 0.12945, 0, 0.35555],\n \"8217\": [0, 0.69444, 0.12945, 0, 0.35555],\n \"8220\": [0, 0.69444, 0.16772, 0, 0.62055],\n \"8221\": [0, 0.69444, 0.07939, 0, 0.62055]\n },\n \"Main-Italic\": {\n \"33\": [0, 0.69444, 0.12417, 0, 0.30667],\n \"34\": [0, 0.69444, 0.06961, 0, 0.51444],\n \"35\": [0.19444, 0.69444, 0.06616, 0, 0.81777],\n \"37\": [0.05556, 0.75, 0.13639, 0, 0.81777],\n \"38\": [0, 0.69444, 0.09694, 0, 0.76666],\n \"39\": [0, 0.69444, 0.12417, 0, 0.30667],\n \"40\": [0.25, 0.75, 0.16194, 0, 0.40889],\n \"41\": [0.25, 0.75, 0.03694, 0, 0.40889],\n \"42\": [0, 0.75, 0.14917, 0, 0.51111],\n \"43\": [0.05667, 0.56167, 0.03694, 0, 0.76666],\n \"44\": [0.19444, 0.10556, 0, 0, 0.30667],\n \"45\": [0, 0.43056, 0.02826, 0, 0.35778],\n \"46\": [0, 0.10556, 0, 0, 0.30667],\n \"47\": [0.25, 0.75, 0.16194, 0, 0.51111],\n \"48\": [0, 0.64444, 0.13556, 0, 0.51111],\n \"49\": [0, 0.64444, 0.13556, 0, 0.51111],\n \"50\": [0, 0.64444, 0.13556, 0, 0.51111],\n \"51\": [0, 0.64444, 0.13556, 0, 0.51111],\n \"52\": [0.19444, 0.64444, 0.13556, 0, 0.51111],\n \"53\": [0, 0.64444, 0.13556, 0, 0.51111],\n \"54\": [0, 0.64444, 0.13556, 0, 0.51111],\n \"55\": [0.19444, 0.64444, 0.13556, 0, 0.51111],\n \"56\": [0, 0.64444, 0.13556, 0, 0.51111],\n \"57\": [0, 0.64444, 0.13556, 0, 0.51111],\n \"58\": [0, 0.43056, 0.0582, 0, 0.30667],\n \"59\": [0.19444, 0.43056, 0.0582, 0, 0.30667],\n \"61\": [-0.13313, 0.36687, 0.06616, 0, 0.76666],\n \"63\": [0, 0.69444, 0.1225, 0, 0.51111],\n \"64\": [0, 0.69444, 0.09597, 0, 0.76666],\n \"65\": [0, 0.68333, 0, 0, 0.74333],\n \"66\": [0, 0.68333, 0.10257, 0, 0.70389],\n \"67\": [0, 0.68333, 0.14528, 0, 0.71555],\n \"68\": [0, 0.68333, 0.09403, 0, 0.755],\n \"69\": [0, 0.68333, 0.12028, 0, 0.67833],\n \"70\": [0, 0.68333, 0.13305, 0, 0.65277],\n \"71\": [0, 0.68333, 0.08722, 0, 0.77361],\n \"72\": [0, 0.68333, 0.16389, 0, 0.74333],\n \"73\": [0, 0.68333, 0.15806, 0, 0.38555],\n \"74\": [0, 0.68333, 0.14028, 0, 0.525],\n \"75\": [0, 0.68333, 0.14528, 0, 0.76888],\n \"76\": [0, 0.68333, 0, 0, 0.62722],\n \"77\": [0, 0.68333, 0.16389, 0, 0.89666],\n \"78\": [0, 0.68333, 0.16389, 0, 0.74333],\n \"79\": [0, 0.68333, 0.09403, 0, 0.76666],\n \"80\": [0, 0.68333, 0.10257, 0, 0.67833],\n \"81\": [0.19444, 0.68333, 0.09403, 0, 0.76666],\n \"82\": [0, 0.68333, 0.03868, 0, 0.72944],\n \"83\": [0, 0.68333, 0.11972, 0, 0.56222],\n \"84\": [0, 0.68333, 0.13305, 0, 0.71555],\n \"85\": [0, 0.68333, 0.16389, 0, 0.74333],\n \"86\": [0, 0.68333, 0.18361, 0, 0.74333],\n \"87\": [0, 0.68333, 0.18361, 0, 0.99888],\n \"88\": [0, 0.68333, 0.15806, 0, 0.74333],\n \"89\": [0, 0.68333, 0.19383, 0, 0.74333],\n \"90\": [0, 0.68333, 0.14528, 0, 0.61333],\n \"91\": [0.25, 0.75, 0.1875, 0, 0.30667],\n \"93\": [0.25, 0.75, 0.10528, 0, 0.30667],\n \"94\": [0, 0.69444, 0.06646, 0, 0.51111],\n \"95\": [0.31, 0.12056, 0.09208, 0, 0.51111],\n \"97\": [0, 0.43056, 0.07671, 0, 0.51111],\n \"98\": [0, 0.69444, 0.06312, 0, 0.46],\n \"99\": [0, 0.43056, 0.05653, 0, 0.46],\n \"100\": [0, 0.69444, 0.10333, 0, 0.51111],\n \"101\": [0, 0.43056, 0.07514, 0, 0.46],\n \"102\": [0.19444, 0.69444, 0.21194, 0, 0.30667],\n \"103\": [0.19444, 0.43056, 0.08847, 0, 0.46],\n \"104\": [0, 0.69444, 0.07671, 0, 0.51111],\n \"105\": [0, 0.65536, 0.1019, 0, 0.30667],\n \"106\": [0.19444, 0.65536, 0.14467, 0, 0.30667],\n \"107\": [0, 0.69444, 0.10764, 0, 0.46],\n \"108\": [0, 0.69444, 0.10333, 0, 0.25555],\n \"109\": [0, 0.43056, 0.07671, 0, 0.81777],\n \"110\": [0, 0.43056, 0.07671, 0, 0.56222],\n \"111\": [0, 0.43056, 0.06312, 0, 0.51111],\n \"112\": [0.19444, 0.43056, 0.06312, 0, 0.51111],\n \"113\": [0.19444, 0.43056, 0.08847, 0, 0.46],\n \"114\": [0, 0.43056, 0.10764, 0, 0.42166],\n \"115\": [0, 0.43056, 0.08208, 0, 0.40889],\n \"116\": [0, 0.61508, 0.09486, 0, 0.33222],\n \"117\": [0, 0.43056, 0.07671, 0, 0.53666],\n \"118\": [0, 0.43056, 0.10764, 0, 0.46],\n \"119\": [0, 0.43056, 0.10764, 0, 0.66444],\n \"120\": [0, 0.43056, 0.12042, 0, 0.46389],\n \"121\": [0.19444, 0.43056, 0.08847, 0, 0.48555],\n \"122\": [0, 0.43056, 0.12292, 0, 0.40889],\n \"126\": [0.35, 0.31786, 0.11585, 0, 0.51111],\n \"163\": [0, 0.69444, 0, 0, 0.76909],\n \"168\": [0, 0.66786, 0.10474, 0, 0.51111],\n \"176\": [0, 0.69444, 0, 0, 0.83129],\n \"184\": [0.17014, 0, 0, 0, 0.46],\n \"198\": [0, 0.68333, 0.12028, 0, 0.88277],\n \"216\": [0.04861, 0.73194, 0.09403, 0, 0.76666],\n \"223\": [0.19444, 0.69444, 0.10514, 0, 0.53666],\n \"230\": [0, 0.43056, 0.07514, 0, 0.71555],\n \"248\": [0.09722, 0.52778, 0.09194, 0, 0.51111],\n \"305\": [0, 0.43056, 0, 0.02778, 0.32246],\n \"338\": [0, 0.68333, 0.12028, 0, 0.98499],\n \"339\": [0, 0.43056, 0.07514, 0, 0.71555],\n \"567\": [0.19444, 0.43056, 0, 0.08334, 0.38403],\n \"710\": [0, 0.69444, 0.06646, 0, 0.51111],\n \"711\": [0, 0.62847, 0.08295, 0, 0.51111],\n \"713\": [0, 0.56167, 0.10333, 0, 0.51111],\n \"714\": [0, 0.69444, 0.09694, 0, 0.51111],\n \"715\": [0, 0.69444, 0, 0, 0.51111],\n \"728\": [0, 0.69444, 0.10806, 0, 0.51111],\n \"729\": [0, 0.66786, 0.11752, 0, 0.30667],\n \"730\": [0, 0.69444, 0, 0, 0.83129],\n \"732\": [0, 0.66786, 0.11585, 0, 0.51111],\n \"733\": [0, 0.69444, 0.1225, 0, 0.51111],\n \"915\": [0, 0.68333, 0.13305, 0, 0.62722],\n \"916\": [0, 0.68333, 0, 0, 0.81777],\n \"920\": [0, 0.68333, 0.09403, 0, 0.76666],\n \"923\": [0, 0.68333, 0, 0, 0.69222],\n \"926\": [0, 0.68333, 0.15294, 0, 0.66444],\n \"928\": [0, 0.68333, 0.16389, 0, 0.74333],\n \"931\": [0, 0.68333, 0.12028, 0, 0.71555],\n \"933\": [0, 0.68333, 0.11111, 0, 0.76666],\n \"934\": [0, 0.68333, 0.05986, 0, 0.71555],\n \"936\": [0, 0.68333, 0.11111, 0, 0.76666],\n \"937\": [0, 0.68333, 0.10257, 0, 0.71555],\n \"8211\": [0, 0.43056, 0.09208, 0, 0.51111],\n \"8212\": [0, 0.43056, 0.09208, 0, 1.02222],\n \"8216\": [0, 0.69444, 0.12417, 0, 0.30667],\n \"8217\": [0, 0.69444, 0.12417, 0, 0.30667],\n \"8220\": [0, 0.69444, 0.1685, 0, 0.51444],\n \"8221\": [0, 0.69444, 0.06961, 0, 0.51444],\n \"8463\": [0, 0.68889, 0, 0, 0.54028]\n },\n \"Main-Regular\": {\n \"32\": [0, 0, 0, 0, 0.25],\n \"33\": [0, 0.69444, 0, 0, 0.27778],\n \"34\": [0, 0.69444, 0, 0, 0.5],\n \"35\": [0.19444, 0.69444, 0, 0, 0.83334],\n \"36\": [0.05556, 0.75, 0, 0, 0.5],\n \"37\": [0.05556, 0.75, 0, 0, 0.83334],\n \"38\": [0, 0.69444, 0, 0, 0.77778],\n \"39\": [0, 0.69444, 0, 0, 0.27778],\n \"40\": [0.25, 0.75, 0, 0, 0.38889],\n \"41\": [0.25, 0.75, 0, 0, 0.38889],\n \"42\": [0, 0.75, 0, 0, 0.5],\n \"43\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"44\": [0.19444, 0.10556, 0, 0, 0.27778],\n \"45\": [0, 0.43056, 0, 0, 0.33333],\n \"46\": [0, 0.10556, 0, 0, 0.27778],\n \"47\": [0.25, 0.75, 0, 0, 0.5],\n \"48\": [0, 0.64444, 0, 0, 0.5],\n \"49\": [0, 0.64444, 0, 0, 0.5],\n \"50\": [0, 0.64444, 0, 0, 0.5],\n \"51\": [0, 0.64444, 0, 0, 0.5],\n \"52\": [0, 0.64444, 0, 0, 0.5],\n \"53\": [0, 0.64444, 0, 0, 0.5],\n \"54\": [0, 0.64444, 0, 0, 0.5],\n \"55\": [0, 0.64444, 0, 0, 0.5],\n \"56\": [0, 0.64444, 0, 0, 0.5],\n \"57\": [0, 0.64444, 0, 0, 0.5],\n \"58\": [0, 0.43056, 0, 0, 0.27778],\n \"59\": [0.19444, 0.43056, 0, 0, 0.27778],\n \"60\": [0.0391, 0.5391, 0, 0, 0.77778],\n \"61\": [-0.13313, 0.36687, 0, 0, 0.77778],\n \"62\": [0.0391, 0.5391, 0, 0, 0.77778],\n \"63\": [0, 0.69444, 0, 0, 0.47222],\n \"64\": [0, 0.69444, 0, 0, 0.77778],\n \"65\": [0, 0.68333, 0, 0, 0.75],\n \"66\": [0, 0.68333, 0, 0, 0.70834],\n \"67\": [0, 0.68333, 0, 0, 0.72222],\n \"68\": [0, 0.68333, 0, 0, 0.76389],\n \"69\": [0, 0.68333, 0, 0, 0.68056],\n \"70\": [0, 0.68333, 0, 0, 0.65278],\n \"71\": [0, 0.68333, 0, 0, 0.78472],\n \"72\": [0, 0.68333, 0, 0, 0.75],\n \"73\": [0, 0.68333, 0, 0, 0.36111],\n \"74\": [0, 0.68333, 0, 0, 0.51389],\n \"75\": [0, 0.68333, 0, 0, 0.77778],\n \"76\": [0, 0.68333, 0, 0, 0.625],\n \"77\": [0, 0.68333, 0, 0, 0.91667],\n \"78\": [0, 0.68333, 0, 0, 0.75],\n \"79\": [0, 0.68333, 0, 0, 0.77778],\n \"80\": [0, 0.68333, 0, 0, 0.68056],\n \"81\": [0.19444, 0.68333, 0, 0, 0.77778],\n \"82\": [0, 0.68333, 0, 0, 0.73611],\n \"83\": [0, 0.68333, 0, 0, 0.55556],\n \"84\": [0, 0.68333, 0, 0, 0.72222],\n \"85\": [0, 0.68333, 0, 0, 0.75],\n \"86\": [0, 0.68333, 0.01389, 0, 0.75],\n \"87\": [0, 0.68333, 0.01389, 0, 1.02778],\n \"88\": [0, 0.68333, 0, 0, 0.75],\n \"89\": [0, 0.68333, 0.025, 0, 0.75],\n \"90\": [0, 0.68333, 0, 0, 0.61111],\n \"91\": [0.25, 0.75, 0, 0, 0.27778],\n \"92\": [0.25, 0.75, 0, 0, 0.5],\n \"93\": [0.25, 0.75, 0, 0, 0.27778],\n \"94\": [0, 0.69444, 0, 0, 0.5],\n \"95\": [0.31, 0.12056, 0.02778, 0, 0.5],\n \"97\": [0, 0.43056, 0, 0, 0.5],\n \"98\": [0, 0.69444, 0, 0, 0.55556],\n \"99\": [0, 0.43056, 0, 0, 0.44445],\n \"100\": [0, 0.69444, 0, 0, 0.55556],\n \"101\": [0, 0.43056, 0, 0, 0.44445],\n \"102\": [0, 0.69444, 0.07778, 0, 0.30556],\n \"103\": [0.19444, 0.43056, 0.01389, 0, 0.5],\n \"104\": [0, 0.69444, 0, 0, 0.55556],\n \"105\": [0, 0.66786, 0, 0, 0.27778],\n \"106\": [0.19444, 0.66786, 0, 0, 0.30556],\n \"107\": [0, 0.69444, 0, 0, 0.52778],\n \"108\": [0, 0.69444, 0, 0, 0.27778],\n \"109\": [0, 0.43056, 0, 0, 0.83334],\n \"110\": [0, 0.43056, 0, 0, 0.55556],\n \"111\": [0, 0.43056, 0, 0, 0.5],\n \"112\": [0.19444, 0.43056, 0, 0, 0.55556],\n \"113\": [0.19444, 0.43056, 0, 0, 0.52778],\n \"114\": [0, 0.43056, 0, 0, 0.39167],\n \"115\": [0, 0.43056, 0, 0, 0.39445],\n \"116\": [0, 0.61508, 0, 0, 0.38889],\n \"117\": [0, 0.43056, 0, 0, 0.55556],\n \"118\": [0, 0.43056, 0.01389, 0, 0.52778],\n \"119\": [0, 0.43056, 0.01389, 0, 0.72222],\n \"120\": [0, 0.43056, 0, 0, 0.52778],\n \"121\": [0.19444, 0.43056, 0.01389, 0, 0.52778],\n \"122\": [0, 0.43056, 0, 0, 0.44445],\n \"123\": [0.25, 0.75, 0, 0, 0.5],\n \"124\": [0.25, 0.75, 0, 0, 0.27778],\n \"125\": [0.25, 0.75, 0, 0, 0.5],\n \"126\": [0.35, 0.31786, 0, 0, 0.5],\n \"160\": [0, 0, 0, 0, 0.25],\n \"167\": [0.19444, 0.69444, 0, 0, 0.44445],\n \"168\": [0, 0.66786, 0, 0, 0.5],\n \"172\": [0, 0.43056, 0, 0, 0.66667],\n \"176\": [0, 0.69444, 0, 0, 0.75],\n \"177\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"182\": [0.19444, 0.69444, 0, 0, 0.61111],\n \"184\": [0.17014, 0, 0, 0, 0.44445],\n \"198\": [0, 0.68333, 0, 0, 0.90278],\n \"215\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"216\": [0.04861, 0.73194, 0, 0, 0.77778],\n \"223\": [0, 0.69444, 0, 0, 0.5],\n \"230\": [0, 0.43056, 0, 0, 0.72222],\n \"247\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"248\": [0.09722, 0.52778, 0, 0, 0.5],\n \"305\": [0, 0.43056, 0, 0, 0.27778],\n \"338\": [0, 0.68333, 0, 0, 1.01389],\n \"339\": [0, 0.43056, 0, 0, 0.77778],\n \"567\": [0.19444, 0.43056, 0, 0, 0.30556],\n \"710\": [0, 0.69444, 0, 0, 0.5],\n \"711\": [0, 0.62847, 0, 0, 0.5],\n \"713\": [0, 0.56778, 0, 0, 0.5],\n \"714\": [0, 0.69444, 0, 0, 0.5],\n \"715\": [0, 0.69444, 0, 0, 0.5],\n \"728\": [0, 0.69444, 0, 0, 0.5],\n \"729\": [0, 0.66786, 0, 0, 0.27778],\n \"730\": [0, 0.69444, 0, 0, 0.75],\n \"732\": [0, 0.66786, 0, 0, 0.5],\n \"733\": [0, 0.69444, 0, 0, 0.5],\n \"915\": [0, 0.68333, 0, 0, 0.625],\n \"916\": [0, 0.68333, 0, 0, 0.83334],\n \"920\": [0, 0.68333, 0, 0, 0.77778],\n \"923\": [0, 0.68333, 0, 0, 0.69445],\n \"926\": [0, 0.68333, 0, 0, 0.66667],\n \"928\": [0, 0.68333, 0, 0, 0.75],\n \"931\": [0, 0.68333, 0, 0, 0.72222],\n \"933\": [0, 0.68333, 0, 0, 0.77778],\n \"934\": [0, 0.68333, 0, 0, 0.72222],\n \"936\": [0, 0.68333, 0, 0, 0.77778],\n \"937\": [0, 0.68333, 0, 0, 0.72222],\n \"8211\": [0, 0.43056, 0.02778, 0, 0.5],\n \"8212\": [0, 0.43056, 0.02778, 0, 1.0],\n \"8216\": [0, 0.69444, 0, 0, 0.27778],\n \"8217\": [0, 0.69444, 0, 0, 0.27778],\n \"8220\": [0, 0.69444, 0, 0, 0.5],\n \"8221\": [0, 0.69444, 0, 0, 0.5],\n \"8224\": [0.19444, 0.69444, 0, 0, 0.44445],\n \"8225\": [0.19444, 0.69444, 0, 0, 0.44445],\n \"8230\": [0, 0.12, 0, 0, 1.172],\n \"8242\": [0, 0.55556, 0, 0, 0.275],\n \"8407\": [0, 0.71444, 0.15382, 0, 0.5],\n \"8463\": [0, 0.68889, 0, 0, 0.54028],\n \"8465\": [0, 0.69444, 0, 0, 0.72222],\n \"8467\": [0, 0.69444, 0, 0.11111, 0.41667],\n \"8472\": [0.19444, 0.43056, 0, 0.11111, 0.63646],\n \"8476\": [0, 0.69444, 0, 0, 0.72222],\n \"8501\": [0, 0.69444, 0, 0, 0.61111],\n \"8592\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8593\": [0.19444, 0.69444, 0, 0, 0.5],\n \"8594\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8595\": [0.19444, 0.69444, 0, 0, 0.5],\n \"8596\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8597\": [0.25, 0.75, 0, 0, 0.5],\n \"8598\": [0.19444, 0.69444, 0, 0, 1.0],\n \"8599\": [0.19444, 0.69444, 0, 0, 1.0],\n \"8600\": [0.19444, 0.69444, 0, 0, 1.0],\n \"8601\": [0.19444, 0.69444, 0, 0, 1.0],\n \"8614\": [0.011, 0.511, 0, 0, 1.0],\n \"8617\": [0.011, 0.511, 0, 0, 1.126],\n \"8618\": [0.011, 0.511, 0, 0, 1.126],\n \"8636\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8637\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8640\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8641\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8652\": [0.011, 0.671, 0, 0, 1.0],\n \"8656\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8657\": [0.19444, 0.69444, 0, 0, 0.61111],\n \"8658\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8659\": [0.19444, 0.69444, 0, 0, 0.61111],\n \"8660\": [-0.13313, 0.36687, 0, 0, 1.0],\n \"8661\": [0.25, 0.75, 0, 0, 0.61111],\n \"8704\": [0, 0.69444, 0, 0, 0.55556],\n \"8706\": [0, 0.69444, 0.05556, 0.08334, 0.5309],\n \"8707\": [0, 0.69444, 0, 0, 0.55556],\n \"8709\": [0.05556, 0.75, 0, 0, 0.5],\n \"8711\": [0, 0.68333, 0, 0, 0.83334],\n \"8712\": [0.0391, 0.5391, 0, 0, 0.66667],\n \"8715\": [0.0391, 0.5391, 0, 0, 0.66667],\n \"8722\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"8723\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"8725\": [0.25, 0.75, 0, 0, 0.5],\n \"8726\": [0.25, 0.75, 0, 0, 0.5],\n \"8727\": [-0.03472, 0.46528, 0, 0, 0.5],\n \"8728\": [-0.05555, 0.44445, 0, 0, 0.5],\n \"8729\": [-0.05555, 0.44445, 0, 0, 0.5],\n \"8730\": [0.2, 0.8, 0, 0, 0.83334],\n \"8733\": [0, 0.43056, 0, 0, 0.77778],\n \"8734\": [0, 0.43056, 0, 0, 1.0],\n \"8736\": [0, 0.69224, 0, 0, 0.72222],\n \"8739\": [0.25, 0.75, 0, 0, 0.27778],\n \"8741\": [0.25, 0.75, 0, 0, 0.5],\n \"8743\": [0, 0.55556, 0, 0, 0.66667],\n \"8744\": [0, 0.55556, 0, 0, 0.66667],\n \"8745\": [0, 0.55556, 0, 0, 0.66667],\n \"8746\": [0, 0.55556, 0, 0, 0.66667],\n \"8747\": [0.19444, 0.69444, 0.11111, 0, 0.41667],\n \"8764\": [-0.13313, 0.36687, 0, 0, 0.77778],\n \"8768\": [0.19444, 0.69444, 0, 0, 0.27778],\n \"8771\": [-0.03625, 0.46375, 0, 0, 0.77778],\n \"8773\": [-0.022, 0.589, 0, 0, 1.0],\n \"8776\": [-0.01688, 0.48312, 0, 0, 0.77778],\n \"8781\": [-0.03625, 0.46375, 0, 0, 0.77778],\n \"8784\": [-0.133, 0.67, 0, 0, 0.778],\n \"8801\": [-0.03625, 0.46375, 0, 0, 0.77778],\n \"8804\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"8805\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"8810\": [0.0391, 0.5391, 0, 0, 1.0],\n \"8811\": [0.0391, 0.5391, 0, 0, 1.0],\n \"8826\": [0.0391, 0.5391, 0, 0, 0.77778],\n \"8827\": [0.0391, 0.5391, 0, 0, 0.77778],\n \"8834\": [0.0391, 0.5391, 0, 0, 0.77778],\n \"8835\": [0.0391, 0.5391, 0, 0, 0.77778],\n \"8838\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"8839\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"8846\": [0, 0.55556, 0, 0, 0.66667],\n \"8849\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"8850\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"8851\": [0, 0.55556, 0, 0, 0.66667],\n \"8852\": [0, 0.55556, 0, 0, 0.66667],\n \"8853\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"8854\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"8855\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"8856\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"8857\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"8866\": [0, 0.69444, 0, 0, 0.61111],\n \"8867\": [0, 0.69444, 0, 0, 0.61111],\n \"8868\": [0, 0.69444, 0, 0, 0.77778],\n \"8869\": [0, 0.69444, 0, 0, 0.77778],\n \"8872\": [0.249, 0.75, 0, 0, 0.867],\n \"8900\": [-0.05555, 0.44445, 0, 0, 0.5],\n \"8901\": [-0.05555, 0.44445, 0, 0, 0.27778],\n \"8902\": [-0.03472, 0.46528, 0, 0, 0.5],\n \"8904\": [0.005, 0.505, 0, 0, 0.9],\n \"8942\": [0.03, 0.9, 0, 0, 0.278],\n \"8943\": [-0.19, 0.31, 0, 0, 1.172],\n \"8945\": [-0.1, 0.82, 0, 0, 1.282],\n \"8968\": [0.25, 0.75, 0, 0, 0.44445],\n \"8969\": [0.25, 0.75, 0, 0, 0.44445],\n \"8970\": [0.25, 0.75, 0, 0, 0.44445],\n \"8971\": [0.25, 0.75, 0, 0, 0.44445],\n \"8994\": [-0.14236, 0.35764, 0, 0, 1.0],\n \"8995\": [-0.14236, 0.35764, 0, 0, 1.0],\n \"9136\": [0.244, 0.744, 0, 0, 0.412],\n \"9137\": [0.244, 0.744, 0, 0, 0.412],\n \"9651\": [0.19444, 0.69444, 0, 0, 0.88889],\n \"9657\": [-0.03472, 0.46528, 0, 0, 0.5],\n \"9661\": [0.19444, 0.69444, 0, 0, 0.88889],\n \"9667\": [-0.03472, 0.46528, 0, 0, 0.5],\n \"9711\": [0.19444, 0.69444, 0, 0, 1.0],\n \"9824\": [0.12963, 0.69444, 0, 0, 0.77778],\n \"9825\": [0.12963, 0.69444, 0, 0, 0.77778],\n \"9826\": [0.12963, 0.69444, 0, 0, 0.77778],\n \"9827\": [0.12963, 0.69444, 0, 0, 0.77778],\n \"9837\": [0, 0.75, 0, 0, 0.38889],\n \"9838\": [0.19444, 0.69444, 0, 0, 0.38889],\n \"9839\": [0.19444, 0.69444, 0, 0, 0.38889],\n \"10216\": [0.25, 0.75, 0, 0, 0.38889],\n \"10217\": [0.25, 0.75, 0, 0, 0.38889],\n \"10222\": [0.244, 0.744, 0, 0, 0.412],\n \"10223\": [0.244, 0.744, 0, 0, 0.412],\n \"10229\": [0.011, 0.511, 0, 0, 1.609],\n \"10230\": [0.011, 0.511, 0, 0, 1.638],\n \"10231\": [0.011, 0.511, 0, 0, 1.859],\n \"10232\": [0.024, 0.525, 0, 0, 1.609],\n \"10233\": [0.024, 0.525, 0, 0, 1.638],\n \"10234\": [0.024, 0.525, 0, 0, 1.858],\n \"10236\": [0.011, 0.511, 0, 0, 1.638],\n \"10815\": [0, 0.68333, 0, 0, 0.75],\n \"10927\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"10928\": [0.13597, 0.63597, 0, 0, 0.77778],\n \"57376\": [0.19444, 0.69444, 0, 0, 0]\n },\n \"Math-BoldItalic\": {\n \"65\": [0, 0.68611, 0, 0, 0.86944],\n \"66\": [0, 0.68611, 0.04835, 0, 0.8664],\n \"67\": [0, 0.68611, 0.06979, 0, 0.81694],\n \"68\": [0, 0.68611, 0.03194, 0, 0.93812],\n \"69\": [0, 0.68611, 0.05451, 0, 0.81007],\n \"70\": [0, 0.68611, 0.15972, 0, 0.68889],\n \"71\": [0, 0.68611, 0, 0, 0.88673],\n \"72\": [0, 0.68611, 0.08229, 0, 0.98229],\n \"73\": [0, 0.68611, 0.07778, 0, 0.51111],\n \"74\": [0, 0.68611, 0.10069, 0, 0.63125],\n \"75\": [0, 0.68611, 0.06979, 0, 0.97118],\n \"76\": [0, 0.68611, 0, 0, 0.75555],\n \"77\": [0, 0.68611, 0.11424, 0, 1.14201],\n \"78\": [0, 0.68611, 0.11424, 0, 0.95034],\n \"79\": [0, 0.68611, 0.03194, 0, 0.83666],\n \"80\": [0, 0.68611, 0.15972, 0, 0.72309],\n \"81\": [0.19444, 0.68611, 0, 0, 0.86861],\n \"82\": [0, 0.68611, 0.00421, 0, 0.87235],\n \"83\": [0, 0.68611, 0.05382, 0, 0.69271],\n \"84\": [0, 0.68611, 0.15972, 0, 0.63663],\n \"85\": [0, 0.68611, 0.11424, 0, 0.80027],\n \"86\": [0, 0.68611, 0.25555, 0, 0.67778],\n \"87\": [0, 0.68611, 0.15972, 0, 1.09305],\n \"88\": [0, 0.68611, 0.07778, 0, 0.94722],\n \"89\": [0, 0.68611, 0.25555, 0, 0.67458],\n \"90\": [0, 0.68611, 0.06979, 0, 0.77257],\n \"97\": [0, 0.44444, 0, 0, 0.63287],\n \"98\": [0, 0.69444, 0, 0, 0.52083],\n \"99\": [0, 0.44444, 0, 0, 0.51342],\n \"100\": [0, 0.69444, 0, 0, 0.60972],\n \"101\": [0, 0.44444, 0, 0, 0.55361],\n \"102\": [0.19444, 0.69444, 0.11042, 0, 0.56806],\n \"103\": [0.19444, 0.44444, 0.03704, 0, 0.5449],\n \"104\": [0, 0.69444, 0, 0, 0.66759],\n \"105\": [0, 0.69326, 0, 0, 0.4048],\n \"106\": [0.19444, 0.69326, 0.0622, 0, 0.47083],\n \"107\": [0, 0.69444, 0.01852, 0, 0.6037],\n \"108\": [0, 0.69444, 0.0088, 0, 0.34815],\n \"109\": [0, 0.44444, 0, 0, 1.0324],\n \"110\": [0, 0.44444, 0, 0, 0.71296],\n \"111\": [0, 0.44444, 0, 0, 0.58472],\n \"112\": [0.19444, 0.44444, 0, 0, 0.60092],\n \"113\": [0.19444, 0.44444, 0.03704, 0, 0.54213],\n \"114\": [0, 0.44444, 0.03194, 0, 0.5287],\n \"115\": [0, 0.44444, 0, 0, 0.53125],\n \"116\": [0, 0.63492, 0, 0, 0.41528],\n \"117\": [0, 0.44444, 0, 0, 0.68102],\n \"118\": [0, 0.44444, 0.03704, 0, 0.56666],\n \"119\": [0, 0.44444, 0.02778, 0, 0.83148],\n \"120\": [0, 0.44444, 0, 0, 0.65903],\n \"121\": [0.19444, 0.44444, 0.03704, 0, 0.59028],\n \"122\": [0, 0.44444, 0.04213, 0, 0.55509],\n \"915\": [0, 0.68611, 0.15972, 0, 0.65694],\n \"916\": [0, 0.68611, 0, 0, 0.95833],\n \"920\": [0, 0.68611, 0.03194, 0, 0.86722],\n \"923\": [0, 0.68611, 0, 0, 0.80555],\n \"926\": [0, 0.68611, 0.07458, 0, 0.84125],\n \"928\": [0, 0.68611, 0.08229, 0, 0.98229],\n \"931\": [0, 0.68611, 0.05451, 0, 0.88507],\n \"933\": [0, 0.68611, 0.15972, 0, 0.67083],\n \"934\": [0, 0.68611, 0, 0, 0.76666],\n \"936\": [0, 0.68611, 0.11653, 0, 0.71402],\n \"937\": [0, 0.68611, 0.04835, 0, 0.8789],\n \"945\": [0, 0.44444, 0, 0, 0.76064],\n \"946\": [0.19444, 0.69444, 0.03403, 0, 0.65972],\n \"947\": [0.19444, 0.44444, 0.06389, 0, 0.59003],\n \"948\": [0, 0.69444, 0.03819, 0, 0.52222],\n \"949\": [0, 0.44444, 0, 0, 0.52882],\n \"950\": [0.19444, 0.69444, 0.06215, 0, 0.50833],\n \"951\": [0.19444, 0.44444, 0.03704, 0, 0.6],\n \"952\": [0, 0.69444, 0.03194, 0, 0.5618],\n \"953\": [0, 0.44444, 0, 0, 0.41204],\n \"954\": [0, 0.44444, 0, 0, 0.66759],\n \"955\": [0, 0.69444, 0, 0, 0.67083],\n \"956\": [0.19444, 0.44444, 0, 0, 0.70787],\n \"957\": [0, 0.44444, 0.06898, 0, 0.57685],\n \"958\": [0.19444, 0.69444, 0.03021, 0, 0.50833],\n \"959\": [0, 0.44444, 0, 0, 0.58472],\n \"960\": [0, 0.44444, 0.03704, 0, 0.68241],\n \"961\": [0.19444, 0.44444, 0, 0, 0.6118],\n \"962\": [0.09722, 0.44444, 0.07917, 0, 0.42361],\n \"963\": [0, 0.44444, 0.03704, 0, 0.68588],\n \"964\": [0, 0.44444, 0.13472, 0, 0.52083],\n \"965\": [0, 0.44444, 0.03704, 0, 0.63055],\n \"966\": [0.19444, 0.44444, 0, 0, 0.74722],\n \"967\": [0.19444, 0.44444, 0, 0, 0.71805],\n \"968\": [0.19444, 0.69444, 0.03704, 0, 0.75833],\n \"969\": [0, 0.44444, 0.03704, 0, 0.71782],\n \"977\": [0, 0.69444, 0, 0, 0.69155],\n \"981\": [0.19444, 0.69444, 0, 0, 0.7125],\n \"982\": [0, 0.44444, 0.03194, 0, 0.975],\n \"1009\": [0.19444, 0.44444, 0, 0, 0.6118],\n \"1013\": [0, 0.44444, 0, 0, 0.48333]\n },\n \"Math-Italic\": {\n \"65\": [0, 0.68333, 0, 0.13889, 0.75],\n \"66\": [0, 0.68333, 0.05017, 0.08334, 0.75851],\n \"67\": [0, 0.68333, 0.07153, 0.08334, 0.71472],\n \"68\": [0, 0.68333, 0.02778, 0.05556, 0.82792],\n \"69\": [0, 0.68333, 0.05764, 0.08334, 0.7382],\n \"70\": [0, 0.68333, 0.13889, 0.08334, 0.64306],\n \"71\": [0, 0.68333, 0, 0.08334, 0.78625],\n \"72\": [0, 0.68333, 0.08125, 0.05556, 0.83125],\n \"73\": [0, 0.68333, 0.07847, 0.11111, 0.43958],\n \"74\": [0, 0.68333, 0.09618, 0.16667, 0.55451],\n \"75\": [0, 0.68333, 0.07153, 0.05556, 0.84931],\n \"76\": [0, 0.68333, 0, 0.02778, 0.68056],\n \"77\": [0, 0.68333, 0.10903, 0.08334, 0.97014],\n \"78\": [0, 0.68333, 0.10903, 0.08334, 0.80347],\n \"79\": [0, 0.68333, 0.02778, 0.08334, 0.76278],\n \"80\": [0, 0.68333, 0.13889, 0.08334, 0.64201],\n \"81\": [0.19444, 0.68333, 0, 0.08334, 0.79056],\n \"82\": [0, 0.68333, 0.00773, 0.08334, 0.75929],\n \"83\": [0, 0.68333, 0.05764, 0.08334, 0.6132],\n \"84\": [0, 0.68333, 0.13889, 0.08334, 0.58438],\n \"85\": [0, 0.68333, 0.10903, 0.02778, 0.68278],\n \"86\": [0, 0.68333, 0.22222, 0, 0.58333],\n \"87\": [0, 0.68333, 0.13889, 0, 0.94445],\n \"88\": [0, 0.68333, 0.07847, 0.08334, 0.82847],\n \"89\": [0, 0.68333, 0.22222, 0, 0.58056],\n \"90\": [0, 0.68333, 0.07153, 0.08334, 0.68264],\n \"97\": [0, 0.43056, 0, 0, 0.52859],\n \"98\": [0, 0.69444, 0, 0, 0.42917],\n \"99\": [0, 0.43056, 0, 0.05556, 0.43276],\n \"100\": [0, 0.69444, 0, 0.16667, 0.52049],\n \"101\": [0, 0.43056, 0, 0.05556, 0.46563],\n \"102\": [0.19444, 0.69444, 0.10764, 0.16667, 0.48959],\n \"103\": [0.19444, 0.43056, 0.03588, 0.02778, 0.47697],\n \"104\": [0, 0.69444, 0, 0, 0.57616],\n \"105\": [0, 0.65952, 0, 0, 0.34451],\n \"106\": [0.19444, 0.65952, 0.05724, 0, 0.41181],\n \"107\": [0, 0.69444, 0.03148, 0, 0.5206],\n \"108\": [0, 0.69444, 0.01968, 0.08334, 0.29838],\n \"109\": [0, 0.43056, 0, 0, 0.87801],\n \"110\": [0, 0.43056, 0, 0, 0.60023],\n \"111\": [0, 0.43056, 0, 0.05556, 0.48472],\n \"112\": [0.19444, 0.43056, 0, 0.08334, 0.50313],\n \"113\": [0.19444, 0.43056, 0.03588, 0.08334, 0.44641],\n \"114\": [0, 0.43056, 0.02778, 0.05556, 0.45116],\n \"115\": [0, 0.43056, 0, 0.05556, 0.46875],\n \"116\": [0, 0.61508, 0, 0.08334, 0.36111],\n \"117\": [0, 0.43056, 0, 0.02778, 0.57246],\n \"118\": [0, 0.43056, 0.03588, 0.02778, 0.48472],\n \"119\": [0, 0.43056, 0.02691, 0.08334, 0.71592],\n \"120\": [0, 0.43056, 0, 0.02778, 0.57153],\n \"121\": [0.19444, 0.43056, 0.03588, 0.05556, 0.49028],\n \"122\": [0, 0.43056, 0.04398, 0.05556, 0.46505],\n \"915\": [0, 0.68333, 0.13889, 0.08334, 0.61528],\n \"916\": [0, 0.68333, 0, 0.16667, 0.83334],\n \"920\": [0, 0.68333, 0.02778, 0.08334, 0.76278],\n \"923\": [0, 0.68333, 0, 0.16667, 0.69445],\n \"926\": [0, 0.68333, 0.07569, 0.08334, 0.74236],\n \"928\": [0, 0.68333, 0.08125, 0.05556, 0.83125],\n \"931\": [0, 0.68333, 0.05764, 0.08334, 0.77986],\n \"933\": [0, 0.68333, 0.13889, 0.05556, 0.58333],\n \"934\": [0, 0.68333, 0, 0.08334, 0.66667],\n \"936\": [0, 0.68333, 0.11, 0.05556, 0.61222],\n \"937\": [0, 0.68333, 0.05017, 0.08334, 0.7724],\n \"945\": [0, 0.43056, 0.0037, 0.02778, 0.6397],\n \"946\": [0.19444, 0.69444, 0.05278, 0.08334, 0.56563],\n \"947\": [0.19444, 0.43056, 0.05556, 0, 0.51773],\n \"948\": [0, 0.69444, 0.03785, 0.05556, 0.44444],\n \"949\": [0, 0.43056, 0, 0.08334, 0.46632],\n \"950\": [0.19444, 0.69444, 0.07378, 0.08334, 0.4375],\n \"951\": [0.19444, 0.43056, 0.03588, 0.05556, 0.49653],\n \"952\": [0, 0.69444, 0.02778, 0.08334, 0.46944],\n \"953\": [0, 0.43056, 0, 0.05556, 0.35394],\n \"954\": [0, 0.43056, 0, 0, 0.57616],\n \"955\": [0, 0.69444, 0, 0, 0.58334],\n \"956\": [0.19444, 0.43056, 0, 0.02778, 0.60255],\n \"957\": [0, 0.43056, 0.06366, 0.02778, 0.49398],\n \"958\": [0.19444, 0.69444, 0.04601, 0.11111, 0.4375],\n \"959\": [0, 0.43056, 0, 0.05556, 0.48472],\n \"960\": [0, 0.43056, 0.03588, 0, 0.57003],\n \"961\": [0.19444, 0.43056, 0, 0.08334, 0.51702],\n \"962\": [0.09722, 0.43056, 0.07986, 0.08334, 0.36285],\n \"963\": [0, 0.43056, 0.03588, 0, 0.57141],\n \"964\": [0, 0.43056, 0.1132, 0.02778, 0.43715],\n \"965\": [0, 0.43056, 0.03588, 0.02778, 0.54028],\n \"966\": [0.19444, 0.43056, 0, 0.08334, 0.65417],\n \"967\": [0.19444, 0.43056, 0, 0.05556, 0.62569],\n \"968\": [0.19444, 0.69444, 0.03588, 0.11111, 0.65139],\n \"969\": [0, 0.43056, 0.03588, 0, 0.62245],\n \"977\": [0, 0.69444, 0, 0.08334, 0.59144],\n \"981\": [0.19444, 0.69444, 0, 0.08334, 0.59583],\n \"982\": [0, 0.43056, 0.02778, 0, 0.82813],\n \"1009\": [0.19444, 0.43056, 0, 0.08334, 0.51702],\n \"1013\": [0, 0.43056, 0, 0.05556, 0.4059]\n },\n \"Math-Regular\": {\n \"65\": [0, 0.68333, 0, 0.13889, 0.75],\n \"66\": [0, 0.68333, 0.05017, 0.08334, 0.75851],\n \"67\": [0, 0.68333, 0.07153, 0.08334, 0.71472],\n \"68\": [0, 0.68333, 0.02778, 0.05556, 0.82792],\n \"69\": [0, 0.68333, 0.05764, 0.08334, 0.7382],\n \"70\": [0, 0.68333, 0.13889, 0.08334, 0.64306],\n \"71\": [0, 0.68333, 0, 0.08334, 0.78625],\n \"72\": [0, 0.68333, 0.08125, 0.05556, 0.83125],\n \"73\": [0, 0.68333, 0.07847, 0.11111, 0.43958],\n \"74\": [0, 0.68333, 0.09618, 0.16667, 0.55451],\n \"75\": [0, 0.68333, 0.07153, 0.05556, 0.84931],\n \"76\": [0, 0.68333, 0, 0.02778, 0.68056],\n \"77\": [0, 0.68333, 0.10903, 0.08334, 0.97014],\n \"78\": [0, 0.68333, 0.10903, 0.08334, 0.80347],\n \"79\": [0, 0.68333, 0.02778, 0.08334, 0.76278],\n \"80\": [0, 0.68333, 0.13889, 0.08334, 0.64201],\n \"81\": [0.19444, 0.68333, 0, 0.08334, 0.79056],\n \"82\": [0, 0.68333, 0.00773, 0.08334, 0.75929],\n \"83\": [0, 0.68333, 0.05764, 0.08334, 0.6132],\n \"84\": [0, 0.68333, 0.13889, 0.08334, 0.58438],\n \"85\": [0, 0.68333, 0.10903, 0.02778, 0.68278],\n \"86\": [0, 0.68333, 0.22222, 0, 0.58333],\n \"87\": [0, 0.68333, 0.13889, 0, 0.94445],\n \"88\": [0, 0.68333, 0.07847, 0.08334, 0.82847],\n \"89\": [0, 0.68333, 0.22222, 0, 0.58056],\n \"90\": [0, 0.68333, 0.07153, 0.08334, 0.68264],\n \"97\": [0, 0.43056, 0, 0, 0.52859],\n \"98\": [0, 0.69444, 0, 0, 0.42917],\n \"99\": [0, 0.43056, 0, 0.05556, 0.43276],\n \"100\": [0, 0.69444, 0, 0.16667, 0.52049],\n \"101\": [0, 0.43056, 0, 0.05556, 0.46563],\n \"102\": [0.19444, 0.69444, 0.10764, 0.16667, 0.48959],\n \"103\": [0.19444, 0.43056, 0.03588, 0.02778, 0.47697],\n \"104\": [0, 0.69444, 0, 0, 0.57616],\n \"105\": [0, 0.65952, 0, 0, 0.34451],\n \"106\": [0.19444, 0.65952, 0.05724, 0, 0.41181],\n \"107\": [0, 0.69444, 0.03148, 0, 0.5206],\n \"108\": [0, 0.69444, 0.01968, 0.08334, 0.29838],\n \"109\": [0, 0.43056, 0, 0, 0.87801],\n \"110\": [0, 0.43056, 0, 0, 0.60023],\n \"111\": [0, 0.43056, 0, 0.05556, 0.48472],\n \"112\": [0.19444, 0.43056, 0, 0.08334, 0.50313],\n \"113\": [0.19444, 0.43056, 0.03588, 0.08334, 0.44641],\n \"114\": [0, 0.43056, 0.02778, 0.05556, 0.45116],\n \"115\": [0, 0.43056, 0, 0.05556, 0.46875],\n \"116\": [0, 0.61508, 0, 0.08334, 0.36111],\n \"117\": [0, 0.43056, 0, 0.02778, 0.57246],\n \"118\": [0, 0.43056, 0.03588, 0.02778, 0.48472],\n \"119\": [0, 0.43056, 0.02691, 0.08334, 0.71592],\n \"120\": [0, 0.43056, 0, 0.02778, 0.57153],\n \"121\": [0.19444, 0.43056, 0.03588, 0.05556, 0.49028],\n \"122\": [0, 0.43056, 0.04398, 0.05556, 0.46505],\n \"915\": [0, 0.68333, 0.13889, 0.08334, 0.61528],\n \"916\": [0, 0.68333, 0, 0.16667, 0.83334],\n \"920\": [0, 0.68333, 0.02778, 0.08334, 0.76278],\n \"923\": [0, 0.68333, 0, 0.16667, 0.69445],\n \"926\": [0, 0.68333, 0.07569, 0.08334, 0.74236],\n \"928\": [0, 0.68333, 0.08125, 0.05556, 0.83125],\n \"931\": [0, 0.68333, 0.05764, 0.08334, 0.77986],\n \"933\": [0, 0.68333, 0.13889, 0.05556, 0.58333],\n \"934\": [0, 0.68333, 0, 0.08334, 0.66667],\n \"936\": [0, 0.68333, 0.11, 0.05556, 0.61222],\n \"937\": [0, 0.68333, 0.05017, 0.08334, 0.7724],\n \"945\": [0, 0.43056, 0.0037, 0.02778, 0.6397],\n \"946\": [0.19444, 0.69444, 0.05278, 0.08334, 0.56563],\n \"947\": [0.19444, 0.43056, 0.05556, 0, 0.51773],\n \"948\": [0, 0.69444, 0.03785, 0.05556, 0.44444],\n \"949\": [0, 0.43056, 0, 0.08334, 0.46632],\n \"950\": [0.19444, 0.69444, 0.07378, 0.08334, 0.4375],\n \"951\": [0.19444, 0.43056, 0.03588, 0.05556, 0.49653],\n \"952\": [0, 0.69444, 0.02778, 0.08334, 0.46944],\n \"953\": [0, 0.43056, 0, 0.05556, 0.35394],\n \"954\": [0, 0.43056, 0, 0, 0.57616],\n \"955\": [0, 0.69444, 0, 0, 0.58334],\n \"956\": [0.19444, 0.43056, 0, 0.02778, 0.60255],\n \"957\": [0, 0.43056, 0.06366, 0.02778, 0.49398],\n \"958\": [0.19444, 0.69444, 0.04601, 0.11111, 0.4375],\n \"959\": [0, 0.43056, 0, 0.05556, 0.48472],\n \"960\": [0, 0.43056, 0.03588, 0, 0.57003],\n \"961\": [0.19444, 0.43056, 0, 0.08334, 0.51702],\n \"962\": [0.09722, 0.43056, 0.07986, 0.08334, 0.36285],\n \"963\": [0, 0.43056, 0.03588, 0, 0.57141],\n \"964\": [0, 0.43056, 0.1132, 0.02778, 0.43715],\n \"965\": [0, 0.43056, 0.03588, 0.02778, 0.54028],\n \"966\": [0.19444, 0.43056, 0, 0.08334, 0.65417],\n \"967\": [0.19444, 0.43056, 0, 0.05556, 0.62569],\n \"968\": [0.19444, 0.69444, 0.03588, 0.11111, 0.65139],\n \"969\": [0, 0.43056, 0.03588, 0, 0.62245],\n \"977\": [0, 0.69444, 0, 0.08334, 0.59144],\n \"981\": [0.19444, 0.69444, 0, 0.08334, 0.59583],\n \"982\": [0, 0.43056, 0.02778, 0, 0.82813],\n \"1009\": [0.19444, 0.43056, 0, 0.08334, 0.51702],\n \"1013\": [0, 0.43056, 0, 0.05556, 0.4059]\n },\n \"SansSerif-Bold\": {\n \"33\": [0, 0.69444, 0, 0, 0.36667],\n \"34\": [0, 0.69444, 0, 0, 0.55834],\n \"35\": [0.19444, 0.69444, 0, 0, 0.91667],\n \"36\": [0.05556, 0.75, 0, 0, 0.55],\n \"37\": [0.05556, 0.75, 0, 0, 1.02912],\n \"38\": [0, 0.69444, 0, 0, 0.83056],\n \"39\": [0, 0.69444, 0, 0, 0.30556],\n \"40\": [0.25, 0.75, 0, 0, 0.42778],\n \"41\": [0.25, 0.75, 0, 0, 0.42778],\n \"42\": [0, 0.75, 0, 0, 0.55],\n \"43\": [0.11667, 0.61667, 0, 0, 0.85556],\n \"44\": [0.10556, 0.13056, 0, 0, 0.30556],\n \"45\": [0, 0.45833, 0, 0, 0.36667],\n \"46\": [0, 0.13056, 0, 0, 0.30556],\n \"47\": [0.25, 0.75, 0, 0, 0.55],\n \"48\": [0, 0.69444, 0, 0, 0.55],\n \"49\": [0, 0.69444, 0, 0, 0.55],\n \"50\": [0, 0.69444, 0, 0, 0.55],\n \"51\": [0, 0.69444, 0, 0, 0.55],\n \"52\": [0, 0.69444, 0, 0, 0.55],\n \"53\": [0, 0.69444, 0, 0, 0.55],\n \"54\": [0, 0.69444, 0, 0, 0.55],\n \"55\": [0, 0.69444, 0, 0, 0.55],\n \"56\": [0, 0.69444, 0, 0, 0.55],\n \"57\": [0, 0.69444, 0, 0, 0.55],\n \"58\": [0, 0.45833, 0, 0, 0.30556],\n \"59\": [0.10556, 0.45833, 0, 0, 0.30556],\n \"61\": [-0.09375, 0.40625, 0, 0, 0.85556],\n \"63\": [0, 0.69444, 0, 0, 0.51945],\n \"64\": [0, 0.69444, 0, 0, 0.73334],\n \"65\": [0, 0.69444, 0, 0, 0.73334],\n \"66\": [0, 0.69444, 0, 0, 0.73334],\n \"67\": [0, 0.69444, 0, 0, 0.70278],\n \"68\": [0, 0.69444, 0, 0, 0.79445],\n \"69\": [0, 0.69444, 0, 0, 0.64167],\n \"70\": [0, 0.69444, 0, 0, 0.61111],\n \"71\": [0, 0.69444, 0, 0, 0.73334],\n \"72\": [0, 0.69444, 0, 0, 0.79445],\n \"73\": [0, 0.69444, 0, 0, 0.33056],\n \"74\": [0, 0.69444, 0, 0, 0.51945],\n \"75\": [0, 0.69444, 0, 0, 0.76389],\n \"76\": [0, 0.69444, 0, 0, 0.58056],\n \"77\": [0, 0.69444, 0, 0, 0.97778],\n \"78\": [0, 0.69444, 0, 0, 0.79445],\n \"79\": [0, 0.69444, 0, 0, 0.79445],\n \"80\": [0, 0.69444, 0, 0, 0.70278],\n \"81\": [0.10556, 0.69444, 0, 0, 0.79445],\n \"82\": [0, 0.69444, 0, 0, 0.70278],\n \"83\": [0, 0.69444, 0, 0, 0.61111],\n \"84\": [0, 0.69444, 0, 0, 0.73334],\n \"85\": [0, 0.69444, 0, 0, 0.76389],\n \"86\": [0, 0.69444, 0.01528, 0, 0.73334],\n \"87\": [0, 0.69444, 0.01528, 0, 1.03889],\n \"88\": [0, 0.69444, 0, 0, 0.73334],\n \"89\": [0, 0.69444, 0.0275, 0, 0.73334],\n \"90\": [0, 0.69444, 0, 0, 0.67223],\n \"91\": [0.25, 0.75, 0, 0, 0.34306],\n \"93\": [0.25, 0.75, 0, 0, 0.34306],\n \"94\": [0, 0.69444, 0, 0, 0.55],\n \"95\": [0.35, 0.10833, 0.03056, 0, 0.55],\n \"97\": [0, 0.45833, 0, 0, 0.525],\n \"98\": [0, 0.69444, 0, 0, 0.56111],\n \"99\": [0, 0.45833, 0, 0, 0.48889],\n \"100\": [0, 0.69444, 0, 0, 0.56111],\n \"101\": [0, 0.45833, 0, 0, 0.51111],\n \"102\": [0, 0.69444, 0.07639, 0, 0.33611],\n \"103\": [0.19444, 0.45833, 0.01528, 0, 0.55],\n \"104\": [0, 0.69444, 0, 0, 0.56111],\n \"105\": [0, 0.69444, 0, 0, 0.25556],\n \"106\": [0.19444, 0.69444, 0, 0, 0.28611],\n \"107\": [0, 0.69444, 0, 0, 0.53056],\n \"108\": [0, 0.69444, 0, 0, 0.25556],\n \"109\": [0, 0.45833, 0, 0, 0.86667],\n \"110\": [0, 0.45833, 0, 0, 0.56111],\n \"111\": [0, 0.45833, 0, 0, 0.55],\n \"112\": [0.19444, 0.45833, 0, 0, 0.56111],\n \"113\": [0.19444, 0.45833, 0, 0, 0.56111],\n \"114\": [0, 0.45833, 0.01528, 0, 0.37222],\n \"115\": [0, 0.45833, 0, 0, 0.42167],\n \"116\": [0, 0.58929, 0, 0, 0.40417],\n \"117\": [0, 0.45833, 0, 0, 0.56111],\n \"118\": [0, 0.45833, 0.01528, 0, 0.5],\n \"119\": [0, 0.45833, 0.01528, 0, 0.74445],\n \"120\": [0, 0.45833, 0, 0, 0.5],\n \"121\": [0.19444, 0.45833, 0.01528, 0, 0.5],\n \"122\": [0, 0.45833, 0, 0, 0.47639],\n \"126\": [0.35, 0.34444, 0, 0, 0.55],\n \"168\": [0, 0.69444, 0, 0, 0.55],\n \"176\": [0, 0.69444, 0, 0, 0.73334],\n \"180\": [0, 0.69444, 0, 0, 0.55],\n \"184\": [0.17014, 0, 0, 0, 0.48889],\n \"305\": [0, 0.45833, 0, 0, 0.25556],\n \"567\": [0.19444, 0.45833, 0, 0, 0.28611],\n \"710\": [0, 0.69444, 0, 0, 0.55],\n \"711\": [0, 0.63542, 0, 0, 0.55],\n \"713\": [0, 0.63778, 0, 0, 0.55],\n \"728\": [0, 0.69444, 0, 0, 0.55],\n \"729\": [0, 0.69444, 0, 0, 0.30556],\n \"730\": [0, 0.69444, 0, 0, 0.73334],\n \"732\": [0, 0.69444, 0, 0, 0.55],\n \"733\": [0, 0.69444, 0, 0, 0.55],\n \"915\": [0, 0.69444, 0, 0, 0.58056],\n \"916\": [0, 0.69444, 0, 0, 0.91667],\n \"920\": [0, 0.69444, 0, 0, 0.85556],\n \"923\": [0, 0.69444, 0, 0, 0.67223],\n \"926\": [0, 0.69444, 0, 0, 0.73334],\n \"928\": [0, 0.69444, 0, 0, 0.79445],\n \"931\": [0, 0.69444, 0, 0, 0.79445],\n \"933\": [0, 0.69444, 0, 0, 0.85556],\n \"934\": [0, 0.69444, 0, 0, 0.79445],\n \"936\": [0, 0.69444, 0, 0, 0.85556],\n \"937\": [0, 0.69444, 0, 0, 0.79445],\n \"8211\": [0, 0.45833, 0.03056, 0, 0.55],\n \"8212\": [0, 0.45833, 0.03056, 0, 1.10001],\n \"8216\": [0, 0.69444, 0, 0, 0.30556],\n \"8217\": [0, 0.69444, 0, 0, 0.30556],\n \"8220\": [0, 0.69444, 0, 0, 0.55834],\n \"8221\": [0, 0.69444, 0, 0, 0.55834]\n },\n \"SansSerif-Italic\": {\n \"33\": [0, 0.69444, 0.05733, 0, 0.31945],\n \"34\": [0, 0.69444, 0.00316, 0, 0.5],\n \"35\": [0.19444, 0.69444, 0.05087, 0, 0.83334],\n \"36\": [0.05556, 0.75, 0.11156, 0, 0.5],\n \"37\": [0.05556, 0.75, 0.03126, 0, 0.83334],\n \"38\": [0, 0.69444, 0.03058, 0, 0.75834],\n \"39\": [0, 0.69444, 0.07816, 0, 0.27778],\n \"40\": [0.25, 0.75, 0.13164, 0, 0.38889],\n \"41\": [0.25, 0.75, 0.02536, 0, 0.38889],\n \"42\": [0, 0.75, 0.11775, 0, 0.5],\n \"43\": [0.08333, 0.58333, 0.02536, 0, 0.77778],\n \"44\": [0.125, 0.08333, 0, 0, 0.27778],\n \"45\": [0, 0.44444, 0.01946, 0, 0.33333],\n \"46\": [0, 0.08333, 0, 0, 0.27778],\n \"47\": [0.25, 0.75, 0.13164, 0, 0.5],\n \"48\": [0, 0.65556, 0.11156, 0, 0.5],\n \"49\": [0, 0.65556, 0.11156, 0, 0.5],\n \"50\": [0, 0.65556, 0.11156, 0, 0.5],\n \"51\": [0, 0.65556, 0.11156, 0, 0.5],\n \"52\": [0, 0.65556, 0.11156, 0, 0.5],\n \"53\": [0, 0.65556, 0.11156, 0, 0.5],\n \"54\": [0, 0.65556, 0.11156, 0, 0.5],\n \"55\": [0, 0.65556, 0.11156, 0, 0.5],\n \"56\": [0, 0.65556, 0.11156, 0, 0.5],\n \"57\": [0, 0.65556, 0.11156, 0, 0.5],\n \"58\": [0, 0.44444, 0.02502, 0, 0.27778],\n \"59\": [0.125, 0.44444, 0.02502, 0, 0.27778],\n \"61\": [-0.13, 0.37, 0.05087, 0, 0.77778],\n \"63\": [0, 0.69444, 0.11809, 0, 0.47222],\n \"64\": [0, 0.69444, 0.07555, 0, 0.66667],\n \"65\": [0, 0.69444, 0, 0, 0.66667],\n \"66\": [0, 0.69444, 0.08293, 0, 0.66667],\n \"67\": [0, 0.69444, 0.11983, 0, 0.63889],\n \"68\": [0, 0.69444, 0.07555, 0, 0.72223],\n \"69\": [0, 0.69444, 0.11983, 0, 0.59722],\n \"70\": [0, 0.69444, 0.13372, 0, 0.56945],\n \"71\": [0, 0.69444, 0.11983, 0, 0.66667],\n \"72\": [0, 0.69444, 0.08094, 0, 0.70834],\n \"73\": [0, 0.69444, 0.13372, 0, 0.27778],\n \"74\": [0, 0.69444, 0.08094, 0, 0.47222],\n \"75\": [0, 0.69444, 0.11983, 0, 0.69445],\n \"76\": [0, 0.69444, 0, 0, 0.54167],\n \"77\": [0, 0.69444, 0.08094, 0, 0.875],\n \"78\": [0, 0.69444, 0.08094, 0, 0.70834],\n \"79\": [0, 0.69444, 0.07555, 0, 0.73611],\n \"80\": [0, 0.69444, 0.08293, 0, 0.63889],\n \"81\": [0.125, 0.69444, 0.07555, 0, 0.73611],\n \"82\": [0, 0.69444, 0.08293, 0, 0.64584],\n \"83\": [0, 0.69444, 0.09205, 0, 0.55556],\n \"84\": [0, 0.69444, 0.13372, 0, 0.68056],\n \"85\": [0, 0.69444, 0.08094, 0, 0.6875],\n \"86\": [0, 0.69444, 0.1615, 0, 0.66667],\n \"87\": [0, 0.69444, 0.1615, 0, 0.94445],\n \"88\": [0, 0.69444, 0.13372, 0, 0.66667],\n \"89\": [0, 0.69444, 0.17261, 0, 0.66667],\n \"90\": [0, 0.69444, 0.11983, 0, 0.61111],\n \"91\": [0.25, 0.75, 0.15942, 0, 0.28889],\n \"93\": [0.25, 0.75, 0.08719, 0, 0.28889],\n \"94\": [0, 0.69444, 0.0799, 0, 0.5],\n \"95\": [0.35, 0.09444, 0.08616, 0, 0.5],\n \"97\": [0, 0.44444, 0.00981, 0, 0.48056],\n \"98\": [0, 0.69444, 0.03057, 0, 0.51667],\n \"99\": [0, 0.44444, 0.08336, 0, 0.44445],\n \"100\": [0, 0.69444, 0.09483, 0, 0.51667],\n \"101\": [0, 0.44444, 0.06778, 0, 0.44445],\n \"102\": [0, 0.69444, 0.21705, 0, 0.30556],\n \"103\": [0.19444, 0.44444, 0.10836, 0, 0.5],\n \"104\": [0, 0.69444, 0.01778, 0, 0.51667],\n \"105\": [0, 0.67937, 0.09718, 0, 0.23889],\n \"106\": [0.19444, 0.67937, 0.09162, 0, 0.26667],\n \"107\": [0, 0.69444, 0.08336, 0, 0.48889],\n \"108\": [0, 0.69444, 0.09483, 0, 0.23889],\n \"109\": [0, 0.44444, 0.01778, 0, 0.79445],\n \"110\": [0, 0.44444, 0.01778, 0, 0.51667],\n \"111\": [0, 0.44444, 0.06613, 0, 0.5],\n \"112\": [0.19444, 0.44444, 0.0389, 0, 0.51667],\n \"113\": [0.19444, 0.44444, 0.04169, 0, 0.51667],\n \"114\": [0, 0.44444, 0.10836, 0, 0.34167],\n \"115\": [0, 0.44444, 0.0778, 0, 0.38333],\n \"116\": [0, 0.57143, 0.07225, 0, 0.36111],\n \"117\": [0, 0.44444, 0.04169, 0, 0.51667],\n \"118\": [0, 0.44444, 0.10836, 0, 0.46111],\n \"119\": [0, 0.44444, 0.10836, 0, 0.68334],\n \"120\": [0, 0.44444, 0.09169, 0, 0.46111],\n \"121\": [0.19444, 0.44444, 0.10836, 0, 0.46111],\n \"122\": [0, 0.44444, 0.08752, 0, 0.43472],\n \"126\": [0.35, 0.32659, 0.08826, 0, 0.5],\n \"168\": [0, 0.67937, 0.06385, 0, 0.5],\n \"176\": [0, 0.69444, 0, 0, 0.73752],\n \"184\": [0.17014, 0, 0, 0, 0.44445],\n \"305\": [0, 0.44444, 0.04169, 0, 0.23889],\n \"567\": [0.19444, 0.44444, 0.04169, 0, 0.26667],\n \"710\": [0, 0.69444, 0.0799, 0, 0.5],\n \"711\": [0, 0.63194, 0.08432, 0, 0.5],\n \"713\": [0, 0.60889, 0.08776, 0, 0.5],\n \"714\": [0, 0.69444, 0.09205, 0, 0.5],\n \"715\": [0, 0.69444, 0, 0, 0.5],\n \"728\": [0, 0.69444, 0.09483, 0, 0.5],\n \"729\": [0, 0.67937, 0.07774, 0, 0.27778],\n \"730\": [0, 0.69444, 0, 0, 0.73752],\n \"732\": [0, 0.67659, 0.08826, 0, 0.5],\n \"733\": [0, 0.69444, 0.09205, 0, 0.5],\n \"915\": [0, 0.69444, 0.13372, 0, 0.54167],\n \"916\": [0, 0.69444, 0, 0, 0.83334],\n \"920\": [0, 0.69444, 0.07555, 0, 0.77778],\n \"923\": [0, 0.69444, 0, 0, 0.61111],\n \"926\": [0, 0.69444, 0.12816, 0, 0.66667],\n \"928\": [0, 0.69444, 0.08094, 0, 0.70834],\n \"931\": [0, 0.69444, 0.11983, 0, 0.72222],\n \"933\": [0, 0.69444, 0.09031, 0, 0.77778],\n \"934\": [0, 0.69444, 0.04603, 0, 0.72222],\n \"936\": [0, 0.69444, 0.09031, 0, 0.77778],\n \"937\": [0, 0.69444, 0.08293, 0, 0.72222],\n \"8211\": [0, 0.44444, 0.08616, 0, 0.5],\n \"8212\": [0, 0.44444, 0.08616, 0, 1.0],\n \"8216\": [0, 0.69444, 0.07816, 0, 0.27778],\n \"8217\": [0, 0.69444, 0.07816, 0, 0.27778],\n \"8220\": [0, 0.69444, 0.14205, 0, 0.5],\n \"8221\": [0, 0.69444, 0.00316, 0, 0.5]\n },\n \"SansSerif-Regular\": {\n \"33\": [0, 0.69444, 0, 0, 0.31945],\n \"34\": [0, 0.69444, 0, 0, 0.5],\n \"35\": [0.19444, 0.69444, 0, 0, 0.83334],\n \"36\": [0.05556, 0.75, 0, 0, 0.5],\n \"37\": [0.05556, 0.75, 0, 0, 0.83334],\n \"38\": [0, 0.69444, 0, 0, 0.75834],\n \"39\": [0, 0.69444, 0, 0, 0.27778],\n \"40\": [0.25, 0.75, 0, 0, 0.38889],\n \"41\": [0.25, 0.75, 0, 0, 0.38889],\n \"42\": [0, 0.75, 0, 0, 0.5],\n \"43\": [0.08333, 0.58333, 0, 0, 0.77778],\n \"44\": [0.125, 0.08333, 0, 0, 0.27778],\n \"45\": [0, 0.44444, 0, 0, 0.33333],\n \"46\": [0, 0.08333, 0, 0, 0.27778],\n \"47\": [0.25, 0.75, 0, 0, 0.5],\n \"48\": [0, 0.65556, 0, 0, 0.5],\n \"49\": [0, 0.65556, 0, 0, 0.5],\n \"50\": [0, 0.65556, 0, 0, 0.5],\n \"51\": [0, 0.65556, 0, 0, 0.5],\n \"52\": [0, 0.65556, 0, 0, 0.5],\n \"53\": [0, 0.65556, 0, 0, 0.5],\n \"54\": [0, 0.65556, 0, 0, 0.5],\n \"55\": [0, 0.65556, 0, 0, 0.5],\n \"56\": [0, 0.65556, 0, 0, 0.5],\n \"57\": [0, 0.65556, 0, 0, 0.5],\n \"58\": [0, 0.44444, 0, 0, 0.27778],\n \"59\": [0.125, 0.44444, 0, 0, 0.27778],\n \"61\": [-0.13, 0.37, 0, 0, 0.77778],\n \"63\": [0, 0.69444, 0, 0, 0.47222],\n \"64\": [0, 0.69444, 0, 0, 0.66667],\n \"65\": [0, 0.69444, 0, 0, 0.66667],\n \"66\": [0, 0.69444, 0, 0, 0.66667],\n \"67\": [0, 0.69444, 0, 0, 0.63889],\n \"68\": [0, 0.69444, 0, 0, 0.72223],\n \"69\": [0, 0.69444, 0, 0, 0.59722],\n \"70\": [0, 0.69444, 0, 0, 0.56945],\n \"71\": [0, 0.69444, 0, 0, 0.66667],\n \"72\": [0, 0.69444, 0, 0, 0.70834],\n \"73\": [0, 0.69444, 0, 0, 0.27778],\n \"74\": [0, 0.69444, 0, 0, 0.47222],\n \"75\": [0, 0.69444, 0, 0, 0.69445],\n \"76\": [0, 0.69444, 0, 0, 0.54167],\n \"77\": [0, 0.69444, 0, 0, 0.875],\n \"78\": [0, 0.69444, 0, 0, 0.70834],\n \"79\": [0, 0.69444, 0, 0, 0.73611],\n \"80\": [0, 0.69444, 0, 0, 0.63889],\n \"81\": [0.125, 0.69444, 0, 0, 0.73611],\n \"82\": [0, 0.69444, 0, 0, 0.64584],\n \"83\": [0, 0.69444, 0, 0, 0.55556],\n \"84\": [0, 0.69444, 0, 0, 0.68056],\n \"85\": [0, 0.69444, 0, 0, 0.6875],\n \"86\": [0, 0.69444, 0.01389, 0, 0.66667],\n \"87\": [0, 0.69444, 0.01389, 0, 0.94445],\n \"88\": [0, 0.69444, 0, 0, 0.66667],\n \"89\": [0, 0.69444, 0.025, 0, 0.66667],\n \"90\": [0, 0.69444, 0, 0, 0.61111],\n \"91\": [0.25, 0.75, 0, 0, 0.28889],\n \"93\": [0.25, 0.75, 0, 0, 0.28889],\n \"94\": [0, 0.69444, 0, 0, 0.5],\n \"95\": [0.35, 0.09444, 0.02778, 0, 0.5],\n \"97\": [0, 0.44444, 0, 0, 0.48056],\n \"98\": [0, 0.69444, 0, 0, 0.51667],\n \"99\": [0, 0.44444, 0, 0, 0.44445],\n \"100\": [0, 0.69444, 0, 0, 0.51667],\n \"101\": [0, 0.44444, 0, 0, 0.44445],\n \"102\": [0, 0.69444, 0.06944, 0, 0.30556],\n \"103\": [0.19444, 0.44444, 0.01389, 0, 0.5],\n \"104\": [0, 0.69444, 0, 0, 0.51667],\n \"105\": [0, 0.67937, 0, 0, 0.23889],\n \"106\": [0.19444, 0.67937, 0, 0, 0.26667],\n \"107\": [0, 0.69444, 0, 0, 0.48889],\n \"108\": [0, 0.69444, 0, 0, 0.23889],\n \"109\": [0, 0.44444, 0, 0, 0.79445],\n \"110\": [0, 0.44444, 0, 0, 0.51667],\n \"111\": [0, 0.44444, 0, 0, 0.5],\n \"112\": [0.19444, 0.44444, 0, 0, 0.51667],\n \"113\": [0.19444, 0.44444, 0, 0, 0.51667],\n \"114\": [0, 0.44444, 0.01389, 0, 0.34167],\n \"115\": [0, 0.44444, 0, 0, 0.38333],\n \"116\": [0, 0.57143, 0, 0, 0.36111],\n \"117\": [0, 0.44444, 0, 0, 0.51667],\n \"118\": [0, 0.44444, 0.01389, 0, 0.46111],\n \"119\": [0, 0.44444, 0.01389, 0, 0.68334],\n \"120\": [0, 0.44444, 0, 0, 0.46111],\n \"121\": [0.19444, 0.44444, 0.01389, 0, 0.46111],\n \"122\": [0, 0.44444, 0, 0, 0.43472],\n \"126\": [0.35, 0.32659, 0, 0, 0.5],\n \"168\": [0, 0.67937, 0, 0, 0.5],\n \"176\": [0, 0.69444, 0, 0, 0.66667],\n \"184\": [0.17014, 0, 0, 0, 0.44445],\n \"305\": [0, 0.44444, 0, 0, 0.23889],\n \"567\": [0.19444, 0.44444, 0, 0, 0.26667],\n \"710\": [0, 0.69444, 0, 0, 0.5],\n \"711\": [0, 0.63194, 0, 0, 0.5],\n \"713\": [0, 0.60889, 0, 0, 0.5],\n \"714\": [0, 0.69444, 0, 0, 0.5],\n \"715\": [0, 0.69444, 0, 0, 0.5],\n \"728\": [0, 0.69444, 0, 0, 0.5],\n \"729\": [0, 0.67937, 0, 0, 0.27778],\n \"730\": [0, 0.69444, 0, 0, 0.66667],\n \"732\": [0, 0.67659, 0, 0, 0.5],\n \"733\": [0, 0.69444, 0, 0, 0.5],\n \"915\": [0, 0.69444, 0, 0, 0.54167],\n \"916\": [0, 0.69444, 0, 0, 0.83334],\n \"920\": [0, 0.69444, 0, 0, 0.77778],\n \"923\": [0, 0.69444, 0, 0, 0.61111],\n \"926\": [0, 0.69444, 0, 0, 0.66667],\n \"928\": [0, 0.69444, 0, 0, 0.70834],\n \"931\": [0, 0.69444, 0, 0, 0.72222],\n \"933\": [0, 0.69444, 0, 0, 0.77778],\n \"934\": [0, 0.69444, 0, 0, 0.72222],\n \"936\": [0, 0.69444, 0, 0, 0.77778],\n \"937\": [0, 0.69444, 0, 0, 0.72222],\n \"8211\": [0, 0.44444, 0.02778, 0, 0.5],\n \"8212\": [0, 0.44444, 0.02778, 0, 1.0],\n \"8216\": [0, 0.69444, 0, 0, 0.27778],\n \"8217\": [0, 0.69444, 0, 0, 0.27778],\n \"8220\": [0, 0.69444, 0, 0, 0.5],\n \"8221\": [0, 0.69444, 0, 0, 0.5]\n },\n \"Script-Regular\": {\n \"65\": [0, 0.7, 0.22925, 0, 0.80253],\n \"66\": [0, 0.7, 0.04087, 0, 0.90757],\n \"67\": [0, 0.7, 0.1689, 0, 0.66619],\n \"68\": [0, 0.7, 0.09371, 0, 0.77443],\n \"69\": [0, 0.7, 0.18583, 0, 0.56162],\n \"70\": [0, 0.7, 0.13634, 0, 0.89544],\n \"71\": [0, 0.7, 0.17322, 0, 0.60961],\n \"72\": [0, 0.7, 0.29694, 0, 0.96919],\n \"73\": [0, 0.7, 0.19189, 0, 0.80907],\n \"74\": [0.27778, 0.7, 0.19189, 0, 1.05159],\n \"75\": [0, 0.7, 0.31259, 0, 0.91364],\n \"76\": [0, 0.7, 0.19189, 0, 0.87373],\n \"77\": [0, 0.7, 0.15981, 0, 1.08031],\n \"78\": [0, 0.7, 0.3525, 0, 0.9015],\n \"79\": [0, 0.7, 0.08078, 0, 0.73787],\n \"80\": [0, 0.7, 0.08078, 0, 1.01262],\n \"81\": [0, 0.7, 0.03305, 0, 0.88282],\n \"82\": [0, 0.7, 0.06259, 0, 0.85],\n \"83\": [0, 0.7, 0.19189, 0, 0.86767],\n \"84\": [0, 0.7, 0.29087, 0, 0.74697],\n \"85\": [0, 0.7, 0.25815, 0, 0.79996],\n \"86\": [0, 0.7, 0.27523, 0, 0.62204],\n \"87\": [0, 0.7, 0.27523, 0, 0.80532],\n \"88\": [0, 0.7, 0.26006, 0, 0.94445],\n \"89\": [0, 0.7, 0.2939, 0, 0.70961],\n \"90\": [0, 0.7, 0.24037, 0, 0.8212]\n },\n \"Size1-Regular\": {\n \"40\": [0.35001, 0.85, 0, 0, 0.45834],\n \"41\": [0.35001, 0.85, 0, 0, 0.45834],\n \"47\": [0.35001, 0.85, 0, 0, 0.57778],\n \"91\": [0.35001, 0.85, 0, 0, 0.41667],\n \"92\": [0.35001, 0.85, 0, 0, 0.57778],\n \"93\": [0.35001, 0.85, 0, 0, 0.41667],\n \"123\": [0.35001, 0.85, 0, 0, 0.58334],\n \"125\": [0.35001, 0.85, 0, 0, 0.58334],\n \"710\": [0, 0.72222, 0, 0, 0.55556],\n \"732\": [0, 0.72222, 0, 0, 0.55556],\n \"770\": [0, 0.72222, 0, 0, 0.55556],\n \"771\": [0, 0.72222, 0, 0, 0.55556],\n \"8214\": [-0.00099, 0.601, 0, 0, 0.77778],\n \"8593\": [1e-05, 0.6, 0, 0, 0.66667],\n \"8595\": [1e-05, 0.6, 0, 0, 0.66667],\n \"8657\": [1e-05, 0.6, 0, 0, 0.77778],\n \"8659\": [1e-05, 0.6, 0, 0, 0.77778],\n \"8719\": [0.25001, 0.75, 0, 0, 0.94445],\n \"8720\": [0.25001, 0.75, 0, 0, 0.94445],\n \"8721\": [0.25001, 0.75, 0, 0, 1.05556],\n \"8730\": [0.35001, 0.85, 0, 0, 1.0],\n \"8739\": [-0.00599, 0.606, 0, 0, 0.33333],\n \"8741\": [-0.00599, 0.606, 0, 0, 0.55556],\n \"8747\": [0.30612, 0.805, 0.19445, 0, 0.47222],\n \"8748\": [0.306, 0.805, 0.19445, 0, 0.47222],\n \"8749\": [0.306, 0.805, 0.19445, 0, 0.47222],\n \"8750\": [0.30612, 0.805, 0.19445, 0, 0.47222],\n \"8896\": [0.25001, 0.75, 0, 0, 0.83334],\n \"8897\": [0.25001, 0.75, 0, 0, 0.83334],\n \"8898\": [0.25001, 0.75, 0, 0, 0.83334],\n \"8899\": [0.25001, 0.75, 0, 0, 0.83334],\n \"8968\": [0.35001, 0.85, 0, 0, 0.47222],\n \"8969\": [0.35001, 0.85, 0, 0, 0.47222],\n \"8970\": [0.35001, 0.85, 0, 0, 0.47222],\n \"8971\": [0.35001, 0.85, 0, 0, 0.47222],\n \"9168\": [-0.00099, 0.601, 0, 0, 0.66667],\n \"10216\": [0.35001, 0.85, 0, 0, 0.47222],\n \"10217\": [0.35001, 0.85, 0, 0, 0.47222],\n \"10752\": [0.25001, 0.75, 0, 0, 1.11111],\n \"10753\": [0.25001, 0.75, 0, 0, 1.11111],\n \"10754\": [0.25001, 0.75, 0, 0, 1.11111],\n \"10756\": [0.25001, 0.75, 0, 0, 0.83334],\n \"10758\": [0.25001, 0.75, 0, 0, 0.83334]\n },\n \"Size2-Regular\": {\n \"40\": [0.65002, 1.15, 0, 0, 0.59722],\n \"41\": [0.65002, 1.15, 0, 0, 0.59722],\n \"47\": [0.65002, 1.15, 0, 0, 0.81111],\n \"91\": [0.65002, 1.15, 0, 0, 0.47222],\n \"92\": [0.65002, 1.15, 0, 0, 0.81111],\n \"93\": [0.65002, 1.15, 0, 0, 0.47222],\n \"123\": [0.65002, 1.15, 0, 0, 0.66667],\n \"125\": [0.65002, 1.15, 0, 0, 0.66667],\n \"710\": [0, 0.75, 0, 0, 1.0],\n \"732\": [0, 0.75, 0, 0, 1.0],\n \"770\": [0, 0.75, 0, 0, 1.0],\n \"771\": [0, 0.75, 0, 0, 1.0],\n \"8719\": [0.55001, 1.05, 0, 0, 1.27778],\n \"8720\": [0.55001, 1.05, 0, 0, 1.27778],\n \"8721\": [0.55001, 1.05, 0, 0, 1.44445],\n \"8730\": [0.65002, 1.15, 0, 0, 1.0],\n \"8747\": [0.86225, 1.36, 0.44445, 0, 0.55556],\n \"8748\": [0.862, 1.36, 0.44445, 0, 0.55556],\n \"8749\": [0.862, 1.36, 0.44445, 0, 0.55556],\n \"8750\": [0.86225, 1.36, 0.44445, 0, 0.55556],\n \"8896\": [0.55001, 1.05, 0, 0, 1.11111],\n \"8897\": [0.55001, 1.05, 0, 0, 1.11111],\n \"8898\": [0.55001, 1.05, 0, 0, 1.11111],\n \"8899\": [0.55001, 1.05, 0, 0, 1.11111],\n \"8968\": [0.65002, 1.15, 0, 0, 0.52778],\n \"8969\": [0.65002, 1.15, 0, 0, 0.52778],\n \"8970\": [0.65002, 1.15, 0, 0, 0.52778],\n \"8971\": [0.65002, 1.15, 0, 0, 0.52778],\n \"10216\": [0.65002, 1.15, 0, 0, 0.61111],\n \"10217\": [0.65002, 1.15, 0, 0, 0.61111],\n \"10752\": [0.55001, 1.05, 0, 0, 1.51112],\n \"10753\": [0.55001, 1.05, 0, 0, 1.51112],\n \"10754\": [0.55001, 1.05, 0, 0, 1.51112],\n \"10756\": [0.55001, 1.05, 0, 0, 1.11111],\n \"10758\": [0.55001, 1.05, 0, 0, 1.11111]\n },\n \"Size3-Regular\": {\n \"40\": [0.95003, 1.45, 0, 0, 0.73611],\n \"41\": [0.95003, 1.45, 0, 0, 0.73611],\n \"47\": [0.95003, 1.45, 0, 0, 1.04445],\n \"91\": [0.95003, 1.45, 0, 0, 0.52778],\n \"92\": [0.95003, 1.45, 0, 0, 1.04445],\n \"93\": [0.95003, 1.45, 0, 0, 0.52778],\n \"123\": [0.95003, 1.45, 0, 0, 0.75],\n \"125\": [0.95003, 1.45, 0, 0, 0.75],\n \"710\": [0, 0.75, 0, 0, 1.44445],\n \"732\": [0, 0.75, 0, 0, 1.44445],\n \"770\": [0, 0.75, 0, 0, 1.44445],\n \"771\": [0, 0.75, 0, 0, 1.44445],\n \"8730\": [0.95003, 1.45, 0, 0, 1.0],\n \"8968\": [0.95003, 1.45, 0, 0, 0.58334],\n \"8969\": [0.95003, 1.45, 0, 0, 0.58334],\n \"8970\": [0.95003, 1.45, 0, 0, 0.58334],\n \"8971\": [0.95003, 1.45, 0, 0, 0.58334],\n \"10216\": [0.95003, 1.45, 0, 0, 0.75],\n \"10217\": [0.95003, 1.45, 0, 0, 0.75]\n },\n \"Size4-Regular\": {\n \"40\": [1.25003, 1.75, 0, 0, 0.79167],\n \"41\": [1.25003, 1.75, 0, 0, 0.79167],\n \"47\": [1.25003, 1.75, 0, 0, 1.27778],\n \"91\": [1.25003, 1.75, 0, 0, 0.58334],\n \"92\": [1.25003, 1.75, 0, 0, 1.27778],\n \"93\": [1.25003, 1.75, 0, 0, 0.58334],\n \"123\": [1.25003, 1.75, 0, 0, 0.80556],\n \"125\": [1.25003, 1.75, 0, 0, 0.80556],\n \"710\": [0, 0.825, 0, 0, 1.8889],\n \"732\": [0, 0.825, 0, 0, 1.8889],\n \"770\": [0, 0.825, 0, 0, 1.8889],\n \"771\": [0, 0.825, 0, 0, 1.8889],\n \"8730\": [1.25003, 1.75, 0, 0, 1.0],\n \"8968\": [1.25003, 1.75, 0, 0, 0.63889],\n \"8969\": [1.25003, 1.75, 0, 0, 0.63889],\n \"8970\": [1.25003, 1.75, 0, 0, 0.63889],\n \"8971\": [1.25003, 1.75, 0, 0, 0.63889],\n \"9115\": [0.64502, 1.155, 0, 0, 0.875],\n \"9116\": [1e-05, 0.6, 0, 0, 0.875],\n \"9117\": [0.64502, 1.155, 0, 0, 0.875],\n \"9118\": [0.64502, 1.155, 0, 0, 0.875],\n \"9119\": [1e-05, 0.6, 0, 0, 0.875],\n \"9120\": [0.64502, 1.155, 0, 0, 0.875],\n \"9121\": [0.64502, 1.155, 0, 0, 0.66667],\n \"9122\": [-0.00099, 0.601, 0, 0, 0.66667],\n \"9123\": [0.64502, 1.155, 0, 0, 0.66667],\n \"9124\": [0.64502, 1.155, 0, 0, 0.66667],\n \"9125\": [-0.00099, 0.601, 0, 0, 0.66667],\n \"9126\": [0.64502, 1.155, 0, 0, 0.66667],\n \"9127\": [1e-05, 0.9, 0, 0, 0.88889],\n \"9128\": [0.65002, 1.15, 0, 0, 0.88889],\n \"9129\": [0.90001, 0, 0, 0, 0.88889],\n \"9130\": [0, 0.3, 0, 0, 0.88889],\n \"9131\": [1e-05, 0.9, 0, 0, 0.88889],\n \"9132\": [0.65002, 1.15, 0, 0, 0.88889],\n \"9133\": [0.90001, 0, 0, 0, 0.88889],\n \"9143\": [0.88502, 0.915, 0, 0, 1.05556],\n \"10216\": [1.25003, 1.75, 0, 0, 0.80556],\n \"10217\": [1.25003, 1.75, 0, 0, 0.80556],\n \"57344\": [-0.00499, 0.605, 0, 0, 1.05556],\n \"57345\": [-0.00499, 0.605, 0, 0, 1.05556],\n \"57680\": [0, 0.12, 0, 0, 0.45],\n \"57681\": [0, 0.12, 0, 0, 0.45],\n \"57682\": [0, 0.12, 0, 0, 0.45],\n \"57683\": [0, 0.12, 0, 0, 0.45]\n },\n \"Typewriter-Regular\": {\n \"32\": [0, 0, 0, 0, 0.525],\n \"33\": [0, 0.61111, 0, 0, 0.525],\n \"34\": [0, 0.61111, 0, 0, 0.525],\n \"35\": [0, 0.61111, 0, 0, 0.525],\n \"36\": [0.08333, 0.69444, 0, 0, 0.525],\n \"37\": [0.08333, 0.69444, 0, 0, 0.525],\n \"38\": [0, 0.61111, 0, 0, 0.525],\n \"39\": [0, 0.61111, 0, 0, 0.525],\n \"40\": [0.08333, 0.69444, 0, 0, 0.525],\n \"41\": [0.08333, 0.69444, 0, 0, 0.525],\n \"42\": [0, 0.52083, 0, 0, 0.525],\n \"43\": [-0.08056, 0.53055, 0, 0, 0.525],\n \"44\": [0.13889, 0.125, 0, 0, 0.525],\n \"45\": [-0.08056, 0.53055, 0, 0, 0.525],\n \"46\": [0, 0.125, 0, 0, 0.525],\n \"47\": [0.08333, 0.69444, 0, 0, 0.525],\n \"48\": [0, 0.61111, 0, 0, 0.525],\n \"49\": [0, 0.61111, 0, 0, 0.525],\n \"50\": [0, 0.61111, 0, 0, 0.525],\n \"51\": [0, 0.61111, 0, 0, 0.525],\n \"52\": [0, 0.61111, 0, 0, 0.525],\n \"53\": [0, 0.61111, 0, 0, 0.525],\n \"54\": [0, 0.61111, 0, 0, 0.525],\n \"55\": [0, 0.61111, 0, 0, 0.525],\n \"56\": [0, 0.61111, 0, 0, 0.525],\n \"57\": [0, 0.61111, 0, 0, 0.525],\n \"58\": [0, 0.43056, 0, 0, 0.525],\n \"59\": [0.13889, 0.43056, 0, 0, 0.525],\n \"60\": [-0.05556, 0.55556, 0, 0, 0.525],\n \"61\": [-0.19549, 0.41562, 0, 0, 0.525],\n \"62\": [-0.05556, 0.55556, 0, 0, 0.525],\n \"63\": [0, 0.61111, 0, 0, 0.525],\n \"64\": [0, 0.61111, 0, 0, 0.525],\n \"65\": [0, 0.61111, 0, 0, 0.525],\n \"66\": [0, 0.61111, 0, 0, 0.525],\n \"67\": [0, 0.61111, 0, 0, 0.525],\n \"68\": [0, 0.61111, 0, 0, 0.525],\n \"69\": [0, 0.61111, 0, 0, 0.525],\n \"70\": [0, 0.61111, 0, 0, 0.525],\n \"71\": [0, 0.61111, 0, 0, 0.525],\n \"72\": [0, 0.61111, 0, 0, 0.525],\n \"73\": [0, 0.61111, 0, 0, 0.525],\n \"74\": [0, 0.61111, 0, 0, 0.525],\n \"75\": [0, 0.61111, 0, 0, 0.525],\n \"76\": [0, 0.61111, 0, 0, 0.525],\n \"77\": [0, 0.61111, 0, 0, 0.525],\n \"78\": [0, 0.61111, 0, 0, 0.525],\n \"79\": [0, 0.61111, 0, 0, 0.525],\n \"80\": [0, 0.61111, 0, 0, 0.525],\n \"81\": [0.13889, 0.61111, 0, 0, 0.525],\n \"82\": [0, 0.61111, 0, 0, 0.525],\n \"83\": [0, 0.61111, 0, 0, 0.525],\n \"84\": [0, 0.61111, 0, 0, 0.525],\n \"85\": [0, 0.61111, 0, 0, 0.525],\n \"86\": [0, 0.61111, 0, 0, 0.525],\n \"87\": [0, 0.61111, 0, 0, 0.525],\n \"88\": [0, 0.61111, 0, 0, 0.525],\n \"89\": [0, 0.61111, 0, 0, 0.525],\n \"90\": [0, 0.61111, 0, 0, 0.525],\n \"91\": [0.08333, 0.69444, 0, 0, 0.525],\n \"92\": [0.08333, 0.69444, 0, 0, 0.525],\n \"93\": [0.08333, 0.69444, 0, 0, 0.525],\n \"94\": [0, 0.61111, 0, 0, 0.525],\n \"95\": [0.09514, 0, 0, 0, 0.525],\n \"96\": [0, 0.61111, 0, 0, 0.525],\n \"97\": [0, 0.43056, 0, 0, 0.525],\n \"98\": [0, 0.61111, 0, 0, 0.525],\n \"99\": [0, 0.43056, 0, 0, 0.525],\n \"100\": [0, 0.61111, 0, 0, 0.525],\n \"101\": [0, 0.43056, 0, 0, 0.525],\n \"102\": [0, 0.61111, 0, 0, 0.525],\n \"103\": [0.22222, 0.43056, 0, 0, 0.525],\n \"104\": [0, 0.61111, 0, 0, 0.525],\n \"105\": [0, 0.61111, 0, 0, 0.525],\n \"106\": [0.22222, 0.61111, 0, 0, 0.525],\n \"107\": [0, 0.61111, 0, 0, 0.525],\n \"108\": [0, 0.61111, 0, 0, 0.525],\n \"109\": [0, 0.43056, 0, 0, 0.525],\n \"110\": [0, 0.43056, 0, 0, 0.525],\n \"111\": [0, 0.43056, 0, 0, 0.525],\n \"112\": [0.22222, 0.43056, 0, 0, 0.525],\n \"113\": [0.22222, 0.43056, 0, 0, 0.525],\n \"114\": [0, 0.43056, 0, 0, 0.525],\n \"115\": [0, 0.43056, 0, 0, 0.525],\n \"116\": [0, 0.55358, 0, 0, 0.525],\n \"117\": [0, 0.43056, 0, 0, 0.525],\n \"118\": [0, 0.43056, 0, 0, 0.525],\n \"119\": [0, 0.43056, 0, 0, 0.525],\n \"120\": [0, 0.43056, 0, 0, 0.525],\n \"121\": [0.22222, 0.43056, 0, 0, 0.525],\n \"122\": [0, 0.43056, 0, 0, 0.525],\n \"123\": [0.08333, 0.69444, 0, 0, 0.525],\n \"124\": [0.08333, 0.69444, 0, 0, 0.525],\n \"125\": [0.08333, 0.69444, 0, 0, 0.525],\n \"126\": [0, 0.61111, 0, 0, 0.525],\n \"127\": [0, 0.61111, 0, 0, 0.525],\n \"160\": [0, 0, 0, 0, 0.525],\n \"176\": [0, 0.61111, 0, 0, 0.525],\n \"184\": [0.19445, 0, 0, 0, 0.525],\n \"305\": [0, 0.43056, 0, 0, 0.525],\n \"567\": [0.22222, 0.43056, 0, 0, 0.525],\n \"711\": [0, 0.56597, 0, 0, 0.525],\n \"713\": [0, 0.56555, 0, 0, 0.525],\n \"714\": [0, 0.61111, 0, 0, 0.525],\n \"715\": [0, 0.61111, 0, 0, 0.525],\n \"728\": [0, 0.61111, 0, 0, 0.525],\n \"730\": [0, 0.61111, 0, 0, 0.525],\n \"770\": [0, 0.61111, 0, 0, 0.525],\n \"771\": [0, 0.61111, 0, 0, 0.525],\n \"776\": [0, 0.61111, 0, 0, 0.525],\n \"915\": [0, 0.61111, 0, 0, 0.525],\n \"916\": [0, 0.61111, 0, 0, 0.525],\n \"920\": [0, 0.61111, 0, 0, 0.525],\n \"923\": [0, 0.61111, 0, 0, 0.525],\n \"926\": [0, 0.61111, 0, 0, 0.525],\n \"928\": [0, 0.61111, 0, 0, 0.525],\n \"931\": [0, 0.61111, 0, 0, 0.525],\n \"933\": [0, 0.61111, 0, 0, 0.525],\n \"934\": [0, 0.61111, 0, 0, 0.525],\n \"936\": [0, 0.61111, 0, 0, 0.525],\n \"937\": [0, 0.61111, 0, 0, 0.525],\n \"8216\": [0, 0.61111, 0, 0, 0.525],\n \"8217\": [0, 0.61111, 0, 0, 0.525],\n \"8242\": [0, 0.61111, 0, 0, 0.525],\n \"9251\": [0.11111, 0.21944, 0, 0, 0.525]\n }\n});\n// CONCATENATED MODULE: ./src/fontMetrics.js\n\n\n/**\n * This file contains metrics regarding fonts and individual symbols. The sigma\n * and xi variables, as well as the metricMap map contain data extracted from\n * TeX, TeX font metrics, and the TTF files. These data are then exposed via the\n * `metrics` variable and the getCharacterMetrics function.\n */\n// In TeX, there are actually three sets of dimensions, one for each of\n// textstyle (size index 5 and higher: >=9pt), scriptstyle (size index 3 and 4:\n// 7-8pt), and scriptscriptstyle (size index 1 and 2: 5-6pt). These are\n// provided in the the arrays below, in that order.\n//\n// The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respsectively.\n// This was determined by running the following script:\n//\n// latex -interaction=nonstopmode \\\n// '\\documentclass{article}\\usepackage{amsmath}\\begin{document}' \\\n// '$a$ \\expandafter\\show\\the\\textfont2' \\\n// '\\expandafter\\show\\the\\scriptfont2' \\\n// '\\expandafter\\show\\the\\scriptscriptfont2' \\\n// '\\stop'\n//\n// The metrics themselves were retreived using the following commands:\n//\n// tftopl cmsy10\n// tftopl cmsy7\n// tftopl cmsy5\n//\n// The output of each of these commands is quite lengthy. The only part we\n// care about is the FONTDIMEN section. Each value is measured in EMs.\nvar sigmasAndXis = {\n slant: [0.250, 0.250, 0.250],\n // sigma1\n space: [0.000, 0.000, 0.000],\n // sigma2\n stretch: [0.000, 0.000, 0.000],\n // sigma3\n shrink: [0.000, 0.000, 0.000],\n // sigma4\n xHeight: [0.431, 0.431, 0.431],\n // sigma5\n quad: [1.000, 1.171, 1.472],\n // sigma6\n extraSpace: [0.000, 0.000, 0.000],\n // sigma7\n num1: [0.677, 0.732, 0.925],\n // sigma8\n num2: [0.394, 0.384, 0.387],\n // sigma9\n num3: [0.444, 0.471, 0.504],\n // sigma10\n denom1: [0.686, 0.752, 1.025],\n // sigma11\n denom2: [0.345, 0.344, 0.532],\n // sigma12\n sup1: [0.413, 0.503, 0.504],\n // sigma13\n sup2: [0.363, 0.431, 0.404],\n // sigma14\n sup3: [0.289, 0.286, 0.294],\n // sigma15\n sub1: [0.150, 0.143, 0.200],\n // sigma16\n sub2: [0.247, 0.286, 0.400],\n // sigma17\n supDrop: [0.386, 0.353, 0.494],\n // sigma18\n subDrop: [0.050, 0.071, 0.100],\n // sigma19\n delim1: [2.390, 1.700, 1.980],\n // sigma20\n delim2: [1.010, 1.157, 1.420],\n // sigma21\n axisHeight: [0.250, 0.250, 0.250],\n // sigma22\n // These font metrics are extracted from TeX by using tftopl on cmex10.tfm;\n // they correspond to the font parameters of the extension fonts (family 3).\n // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to\n // match cmex7, we'd use cmex7.tfm values for script and scriptscript\n // values.\n defaultRuleThickness: [0.04, 0.049, 0.049],\n // xi8; cmex7: 0.049\n bigOpSpacing1: [0.111, 0.111, 0.111],\n // xi9\n bigOpSpacing2: [0.166, 0.166, 0.166],\n // xi10\n bigOpSpacing3: [0.2, 0.2, 0.2],\n // xi11\n bigOpSpacing4: [0.6, 0.611, 0.611],\n // xi12; cmex7: 0.611\n bigOpSpacing5: [0.1, 0.143, 0.143],\n // xi13; cmex7: 0.143\n // The \\sqrt rule width is taken from the height of the surd character.\n // Since we use the same font at all sizes, this thickness doesn't scale.\n sqrtRuleThickness: [0.04, 0.04, 0.04],\n // This value determines how large a pt is, for metrics which are defined\n // in terms of pts.\n // This value is also used in katex.less; if you change it make sure the\n // values match.\n ptPerEm: [10.0, 10.0, 10.0],\n // The space between adjacent `|` columns in an array definition. From\n // `\\showthe\\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm.\n doubleRuleSep: [0.2, 0.2, 0.2],\n // The width of separator lines in {array} environments. From\n // `\\showthe\\arrayrulewidth` in LaTeX. Equals 0.4 / ptPerEm.\n arrayRuleWidth: [0.04, 0.04, 0.04],\n // Two values from LaTeX source2e:\n fboxsep: [0.3, 0.3, 0.3],\n // 3 pt / ptPerEm\n fboxrule: [0.04, 0.04, 0.04] // 0.4 pt / ptPerEm\n\n}; // This map contains a mapping from font name and character code to character\n// metrics, including height, depth, italic correction, and skew (kern from the\n// character to the corresponding \\skewchar)\n// This map is generated via `make metrics`. It should not be changed manually.\n\n // These are very rough approximations. We default to Times New Roman which\n// should have Latin-1 and Cyrillic characters, but may not depending on the\n// operating system. The metrics do not account for extra height from the\n// accents. In the case of Cyrillic characters which have both ascenders and\n// descenders we prefer approximations with ascenders, primarily to prevent\n// the fraction bar or root line from intersecting the glyph.\n// TODO(kevinb) allow union of multiple glyph metrics for better accuracy.\n\nvar extraCharacterMap = {\n // Latin-1\n 'Å': 'A',\n 'Ç': 'C',\n 'Ð': 'D',\n 'Þ': 'o',\n 'å': 'a',\n 'ç': 'c',\n 'ð': 'd',\n 'þ': 'o',\n // Cyrillic\n 'А': 'A',\n 'Б': 'B',\n 'В': 'B',\n 'Г': 'F',\n 'Д': 'A',\n 'Е': 'E',\n 'Ж': 'K',\n 'З': '3',\n 'И': 'N',\n 'Й': 'N',\n 'К': 'K',\n 'Л': 'N',\n 'М': 'M',\n 'Н': 'H',\n 'О': 'O',\n 'П': 'N',\n 'Р': 'P',\n 'С': 'C',\n 'Т': 'T',\n 'У': 'y',\n 'Ф': 'O',\n 'Х': 'X',\n 'Ц': 'U',\n 'Ч': 'h',\n 'Ш': 'W',\n 'Щ': 'W',\n 'Ъ': 'B',\n 'Ы': 'X',\n 'Ь': 'B',\n 'Э': '3',\n 'Ю': 'X',\n 'Я': 'R',\n 'а': 'a',\n 'б': 'b',\n 'в': 'a',\n 'г': 'r',\n 'д': 'y',\n 'е': 'e',\n 'ж': 'm',\n 'з': 'e',\n 'и': 'n',\n 'й': 'n',\n 'к': 'n',\n 'л': 'n',\n 'м': 'm',\n 'н': 'n',\n 'о': 'o',\n 'п': 'n',\n 'р': 'p',\n 'с': 'c',\n 'т': 'o',\n 'у': 'y',\n 'ф': 'b',\n 'х': 'x',\n 'ц': 'n',\n 'ч': 'n',\n 'ш': 'w',\n 'щ': 'w',\n 'ъ': 'a',\n 'ы': 'm',\n 'ь': 'a',\n 'э': 'e',\n 'ю': 'm',\n 'я': 'r'\n};\n\n/**\n * This function adds new font metrics to default metricMap\n * It can also override existing metrics\n */\nfunction setFontMetrics(fontName, metrics) {\n fontMetricsData[fontName] = metrics;\n}\n/**\n * This function is a convenience function for looking up information in the\n * metricMap table. It takes a character as a string, and a font.\n *\n * Note: the `width` property may be undefined if fontMetricsData.js wasn't\n * built using `Make extended_metrics`.\n */\n\nfunction getCharacterMetrics(character, font, mode) {\n if (!fontMetricsData[font]) {\n throw new Error(\"Font metrics not found for font: \" + font + \".\");\n }\n\n var ch = character.charCodeAt(0);\n var metrics = fontMetricsData[font][ch];\n\n if (!metrics && character[0] in extraCharacterMap) {\n ch = extraCharacterMap[character[0]].charCodeAt(0);\n metrics = fontMetricsData[font][ch];\n }\n\n if (!metrics && mode === 'text') {\n // We don't typically have font metrics for Asian scripts.\n // But since we support them in text mode, we need to return\n // some sort of metrics.\n // So if the character is in a script we support but we\n // don't have metrics for it, just use the metrics for\n // the Latin capital letter M. This is close enough because\n // we (currently) only care about the height of the glpyh\n // not its width.\n if (supportedCodepoint(ch)) {\n metrics = fontMetricsData[font][77]; // 77 is the charcode for 'M'\n }\n }\n\n if (metrics) {\n return {\n depth: metrics[0],\n height: metrics[1],\n italic: metrics[2],\n skew: metrics[3],\n width: metrics[4]\n };\n }\n}\nvar fontMetricsBySizeIndex = {};\n/**\n * Get the font metrics for a given size.\n */\n\nfunction getGlobalMetrics(size) {\n var sizeIndex;\n\n if (size >= 5) {\n sizeIndex = 0;\n } else if (size >= 3) {\n sizeIndex = 1;\n } else {\n sizeIndex = 2;\n }\n\n if (!fontMetricsBySizeIndex[sizeIndex]) {\n var metrics = fontMetricsBySizeIndex[sizeIndex] = {\n cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18\n };\n\n for (var key in sigmasAndXis) {\n if (sigmasAndXis.hasOwnProperty(key)) {\n metrics[key] = sigmasAndXis[key][sizeIndex];\n }\n }\n }\n\n return fontMetricsBySizeIndex[sizeIndex];\n}\n// CONCATENATED MODULE: ./src/symbols.js\n/**\n * This file holds a list of all no-argument functions and single-character\n * symbols (like 'a' or ';').\n *\n * For each of the symbols, there are three properties they can have:\n * - font (required): the font to be used for this symbol. Either \"main\" (the\n normal font), or \"ams\" (the ams fonts).\n * - group (required): the ParseNode group type the symbol should have (i.e.\n \"textord\", \"mathord\", etc).\n See https://github.com/KaTeX/KaTeX/wiki/Examining-TeX#group-types\n * - replace: the character that this symbol or function should be\n * replaced with (i.e. \"\\phi\" has a replace value of \"\\u03d5\", the phi\n * character in the main font).\n *\n * The outermost map in the table indicates what mode the symbols should be\n * accepted in (e.g. \"math\" or \"text\").\n */\n// Some of these have a \"-token\" suffix since these are also used as `ParseNode`\n// types for raw text tokens, and we want to avoid conflicts with higher-level\n// `ParseNode` types. These `ParseNode`s are constructed within `Parser` by\n// looking up the `symbols` map.\nvar ATOMS = {\n \"bin\": 1,\n \"close\": 1,\n \"inner\": 1,\n \"open\": 1,\n \"punct\": 1,\n \"rel\": 1\n};\nvar NON_ATOMS = {\n \"accent-token\": 1,\n \"mathord\": 1,\n \"op-token\": 1,\n \"spacing\": 1,\n \"textord\": 1\n};\nvar symbols = {\n \"math\": {},\n \"text\": {}\n};\n/* harmony default export */ var src_symbols = (symbols);\n/** `acceptUnicodeChar = true` is only applicable if `replace` is set. */\n\nfunction defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) {\n symbols[mode][name] = {\n font: font,\n group: group,\n replace: replace\n };\n\n if (acceptUnicodeChar && replace) {\n symbols[mode][replace] = symbols[mode][name];\n }\n} // Some abbreviations for commonly used strings.\n// This helps minify the code, and also spotting typos using jshint.\n// modes:\n\nvar symbols_math = \"math\";\nvar symbols_text = \"text\"; // fonts:\n\nvar main = \"main\";\nvar ams = \"ams\"; // groups:\n\nvar symbols_accent = \"accent-token\";\nvar bin = \"bin\";\nvar symbols_close = \"close\";\nvar symbols_inner = \"inner\";\nvar mathord = \"mathord\";\nvar op = \"op-token\";\nvar symbols_open = \"open\";\nvar punct = \"punct\";\nvar rel = \"rel\";\nvar symbols_spacing = \"spacing\";\nvar symbols_textord = \"textord\"; // Now comes the symbol table\n// Relation Symbols\n\ndefineSymbol(symbols_math, main, rel, \"\\u2261\", \"\\\\equiv\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u227A\", \"\\\\prec\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u227B\", \"\\\\succ\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u223C\", \"\\\\sim\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u22A5\", \"\\\\perp\");\ndefineSymbol(symbols_math, main, rel, \"\\u2AAF\", \"\\\\preceq\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2AB0\", \"\\\\succeq\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2243\", \"\\\\simeq\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2223\", \"\\\\mid\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u226A\", \"\\\\ll\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u226B\", \"\\\\gg\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u224D\", \"\\\\asymp\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2225\", \"\\\\parallel\");\ndefineSymbol(symbols_math, main, rel, \"\\u22C8\", \"\\\\bowtie\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2323\", \"\\\\smile\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2291\", \"\\\\sqsubseteq\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2292\", \"\\\\sqsupseteq\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2250\", \"\\\\doteq\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2322\", \"\\\\frown\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u220B\", \"\\\\ni\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u221D\", \"\\\\propto\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u22A2\", \"\\\\vdash\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u22A3\", \"\\\\dashv\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u220B\", \"\\\\owns\"); // Punctuation\n\ndefineSymbol(symbols_math, main, punct, \".\", \"\\\\ldotp\");\ndefineSymbol(symbols_math, main, punct, \"\\u22C5\", \"\\\\cdotp\"); // Misc Symbols\n\ndefineSymbol(symbols_math, main, symbols_textord, \"#\", \"\\\\#\");\ndefineSymbol(symbols_text, main, symbols_textord, \"#\", \"\\\\#\");\ndefineSymbol(symbols_math, main, symbols_textord, \"&\", \"\\\\&\");\ndefineSymbol(symbols_text, main, symbols_textord, \"&\", \"\\\\&\");\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2135\", \"\\\\aleph\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2200\", \"\\\\forall\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u210F\", \"\\\\hbar\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2203\", \"\\\\exists\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2207\", \"\\\\nabla\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u266D\", \"\\\\flat\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2113\", \"\\\\ell\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u266E\", \"\\\\natural\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2663\", \"\\\\clubsuit\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2118\", \"\\\\wp\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u266F\", \"\\\\sharp\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2662\", \"\\\\diamondsuit\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u211C\", \"\\\\Re\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2661\", \"\\\\heartsuit\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2111\", \"\\\\Im\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2660\", \"\\\\spadesuit\", true);\ndefineSymbol(symbols_text, main, symbols_textord, \"\\xA7\", \"\\\\S\", true);\ndefineSymbol(symbols_text, main, symbols_textord, \"\\xB6\", \"\\\\P\", true); // Math and Text\n\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2020\", \"\\\\dag\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u2020\", \"\\\\dag\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u2020\", \"\\\\textdagger\");\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2021\", \"\\\\ddag\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u2021\", \"\\\\ddag\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u2021\", \"\\\\textdaggerdbl\"); // Large Delimiters\n\ndefineSymbol(symbols_math, main, symbols_close, \"\\u23B1\", \"\\\\rmoustache\", true);\ndefineSymbol(symbols_math, main, symbols_open, \"\\u23B0\", \"\\\\lmoustache\", true);\ndefineSymbol(symbols_math, main, symbols_close, \"\\u27EF\", \"\\\\rgroup\", true);\ndefineSymbol(symbols_math, main, symbols_open, \"\\u27EE\", \"\\\\lgroup\", true); // Binary Operators\n\ndefineSymbol(symbols_math, main, bin, \"\\u2213\", \"\\\\mp\", true);\ndefineSymbol(symbols_math, main, bin, \"\\u2296\", \"\\\\ominus\", true);\ndefineSymbol(symbols_math, main, bin, \"\\u228E\", \"\\\\uplus\", true);\ndefineSymbol(symbols_math, main, bin, \"\\u2293\", \"\\\\sqcap\", true);\ndefineSymbol(symbols_math, main, bin, \"\\u2217\", \"\\\\ast\");\ndefineSymbol(symbols_math, main, bin, \"\\u2294\", \"\\\\sqcup\", true);\ndefineSymbol(symbols_math, main, bin, \"\\u25EF\", \"\\\\bigcirc\");\ndefineSymbol(symbols_math, main, bin, \"\\u2219\", \"\\\\bullet\");\ndefineSymbol(symbols_math, main, bin, \"\\u2021\", \"\\\\ddagger\");\ndefineSymbol(symbols_math, main, bin, \"\\u2240\", \"\\\\wr\", true);\ndefineSymbol(symbols_math, main, bin, \"\\u2A3F\", \"\\\\amalg\");\ndefineSymbol(symbols_math, main, bin, \"&\", \"\\\\And\"); // from amsmath\n// Arrow Symbols\n\ndefineSymbol(symbols_math, main, rel, \"\\u27F5\", \"\\\\longleftarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u21D0\", \"\\\\Leftarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u27F8\", \"\\\\Longleftarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u27F6\", \"\\\\longrightarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u21D2\", \"\\\\Rightarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u27F9\", \"\\\\Longrightarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2194\", \"\\\\leftrightarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u27F7\", \"\\\\longleftrightarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u21D4\", \"\\\\Leftrightarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u27FA\", \"\\\\Longleftrightarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u21A6\", \"\\\\mapsto\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u27FC\", \"\\\\longmapsto\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2197\", \"\\\\nearrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u21A9\", \"\\\\hookleftarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u21AA\", \"\\\\hookrightarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2198\", \"\\\\searrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u21BC\", \"\\\\leftharpoonup\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u21C0\", \"\\\\rightharpoonup\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2199\", \"\\\\swarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u21BD\", \"\\\\leftharpoondown\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u21C1\", \"\\\\rightharpoondown\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2196\", \"\\\\nwarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u21CC\", \"\\\\rightleftharpoons\", true); // AMS Negated Binary Relations\n\ndefineSymbol(symbols_math, ams, rel, \"\\u226E\", \"\\\\nless\", true); // Symbol names preceeded by \"@\" each have a corresponding macro.\n\ndefineSymbol(symbols_math, ams, rel, \"\\uE010\", \"\\\\@nleqslant\");\ndefineSymbol(symbols_math, ams, rel, \"\\uE011\", \"\\\\@nleqq\");\ndefineSymbol(symbols_math, ams, rel, \"\\u2A87\", \"\\\\lneq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2268\", \"\\\\lneqq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\uE00C\", \"\\\\@lvertneqq\");\ndefineSymbol(symbols_math, ams, rel, \"\\u22E6\", \"\\\\lnsim\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2A89\", \"\\\\lnapprox\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2280\", \"\\\\nprec\", true); // unicode-math maps \\u22e0 to \\npreccurlyeq. We'll use the AMS synonym.\n\ndefineSymbol(symbols_math, ams, rel, \"\\u22E0\", \"\\\\npreceq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22E8\", \"\\\\precnsim\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2AB9\", \"\\\\precnapprox\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2241\", \"\\\\nsim\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\uE006\", \"\\\\@nshortmid\");\ndefineSymbol(symbols_math, ams, rel, \"\\u2224\", \"\\\\nmid\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22AC\", \"\\\\nvdash\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22AD\", \"\\\\nvDash\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22EA\", \"\\\\ntriangleleft\");\ndefineSymbol(symbols_math, ams, rel, \"\\u22EC\", \"\\\\ntrianglelefteq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u228A\", \"\\\\subsetneq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\uE01A\", \"\\\\@varsubsetneq\");\ndefineSymbol(symbols_math, ams, rel, \"\\u2ACB\", \"\\\\subsetneqq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\uE017\", \"\\\\@varsubsetneqq\");\ndefineSymbol(symbols_math, ams, rel, \"\\u226F\", \"\\\\ngtr\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\uE00F\", \"\\\\@ngeqslant\");\ndefineSymbol(symbols_math, ams, rel, \"\\uE00E\", \"\\\\@ngeqq\");\ndefineSymbol(symbols_math, ams, rel, \"\\u2A88\", \"\\\\gneq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2269\", \"\\\\gneqq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\uE00D\", \"\\\\@gvertneqq\");\ndefineSymbol(symbols_math, ams, rel, \"\\u22E7\", \"\\\\gnsim\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2A8A\", \"\\\\gnapprox\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2281\", \"\\\\nsucc\", true); // unicode-math maps \\u22e1 to \\nsucccurlyeq. We'll use the AMS synonym.\n\ndefineSymbol(symbols_math, ams, rel, \"\\u22E1\", \"\\\\nsucceq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22E9\", \"\\\\succnsim\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2ABA\", \"\\\\succnapprox\", true); // unicode-math maps \\u2246 to \\simneqq. We'll use the AMS synonym.\n\ndefineSymbol(symbols_math, ams, rel, \"\\u2246\", \"\\\\ncong\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\uE007\", \"\\\\@nshortparallel\");\ndefineSymbol(symbols_math, ams, rel, \"\\u2226\", \"\\\\nparallel\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22AF\", \"\\\\nVDash\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22EB\", \"\\\\ntriangleright\");\ndefineSymbol(symbols_math, ams, rel, \"\\u22ED\", \"\\\\ntrianglerighteq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\uE018\", \"\\\\@nsupseteqq\");\ndefineSymbol(symbols_math, ams, rel, \"\\u228B\", \"\\\\supsetneq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\uE01B\", \"\\\\@varsupsetneq\");\ndefineSymbol(symbols_math, ams, rel, \"\\u2ACC\", \"\\\\supsetneqq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\uE019\", \"\\\\@varsupsetneqq\");\ndefineSymbol(symbols_math, ams, rel, \"\\u22AE\", \"\\\\nVdash\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2AB5\", \"\\\\precneqq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2AB6\", \"\\\\succneqq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\uE016\", \"\\\\@nsubseteqq\");\ndefineSymbol(symbols_math, ams, bin, \"\\u22B4\", \"\\\\unlhd\");\ndefineSymbol(symbols_math, ams, bin, \"\\u22B5\", \"\\\\unrhd\"); // AMS Negated Arrows\n\ndefineSymbol(symbols_math, ams, rel, \"\\u219A\", \"\\\\nleftarrow\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u219B\", \"\\\\nrightarrow\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21CD\", \"\\\\nLeftarrow\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21CF\", \"\\\\nRightarrow\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21AE\", \"\\\\nleftrightarrow\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21CE\", \"\\\\nLeftrightarrow\", true); // AMS Misc\n\ndefineSymbol(symbols_math, ams, rel, \"\\u25B3\", \"\\\\vartriangle\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u210F\", \"\\\\hslash\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u25BD\", \"\\\\triangledown\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u25CA\", \"\\\\lozenge\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u24C8\", \"\\\\circledS\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\xAE\", \"\\\\circledR\");\ndefineSymbol(symbols_text, ams, symbols_textord, \"\\xAE\", \"\\\\circledR\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u2221\", \"\\\\measuredangle\", true);\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u2204\", \"\\\\nexists\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u2127\", \"\\\\mho\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u2132\", \"\\\\Finv\", true);\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u2141\", \"\\\\Game\", true);\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u2035\", \"\\\\backprime\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u25B2\", \"\\\\blacktriangle\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u25BC\", \"\\\\blacktriangledown\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u25A0\", \"\\\\blacksquare\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u29EB\", \"\\\\blacklozenge\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u2605\", \"\\\\bigstar\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u2222\", \"\\\\sphericalangle\", true);\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u2201\", \"\\\\complement\", true); // unicode-math maps U+F0 (ð) to \\matheth. We map to AMS function \\eth\n\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\xF0\", \"\\\\eth\", true);\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u2571\", \"\\\\diagup\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u2572\", \"\\\\diagdown\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u25A1\", \"\\\\square\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u25A1\", \"\\\\Box\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u25CA\", \"\\\\Diamond\"); // unicode-math maps U+A5 to \\mathyen. We map to AMS function \\yen\n\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\xA5\", \"\\\\yen\", true);\ndefineSymbol(symbols_text, ams, symbols_textord, \"\\xA5\", \"\\\\yen\", true);\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u2713\", \"\\\\checkmark\", true);\ndefineSymbol(symbols_text, ams, symbols_textord, \"\\u2713\", \"\\\\checkmark\"); // AMS Hebrew\n\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u2136\", \"\\\\beth\", true);\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u2138\", \"\\\\daleth\", true);\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u2137\", \"\\\\gimel\", true); // AMS Greek\n\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u03DD\", \"\\\\digamma\", true);\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u03F0\", \"\\\\varkappa\"); // AMS Delimiters\n\ndefineSymbol(symbols_math, ams, symbols_open, \"\\u250C\", \"\\\\ulcorner\", true);\ndefineSymbol(symbols_math, ams, symbols_close, \"\\u2510\", \"\\\\urcorner\", true);\ndefineSymbol(symbols_math, ams, symbols_open, \"\\u2514\", \"\\\\llcorner\", true);\ndefineSymbol(symbols_math, ams, symbols_close, \"\\u2518\", \"\\\\lrcorner\", true); // AMS Binary Relations\n\ndefineSymbol(symbols_math, ams, rel, \"\\u2266\", \"\\\\leqq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2A7D\", \"\\\\leqslant\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2A95\", \"\\\\eqslantless\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2272\", \"\\\\lesssim\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2A85\", \"\\\\lessapprox\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u224A\", \"\\\\approxeq\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u22D6\", \"\\\\lessdot\");\ndefineSymbol(symbols_math, ams, rel, \"\\u22D8\", \"\\\\lll\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2276\", \"\\\\lessgtr\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22DA\", \"\\\\lesseqgtr\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2A8B\", \"\\\\lesseqqgtr\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2251\", \"\\\\doteqdot\");\ndefineSymbol(symbols_math, ams, rel, \"\\u2253\", \"\\\\risingdotseq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2252\", \"\\\\fallingdotseq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u223D\", \"\\\\backsim\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22CD\", \"\\\\backsimeq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2AC5\", \"\\\\subseteqq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22D0\", \"\\\\Subset\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u228F\", \"\\\\sqsubset\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u227C\", \"\\\\preccurlyeq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22DE\", \"\\\\curlyeqprec\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u227E\", \"\\\\precsim\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2AB7\", \"\\\\precapprox\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22B2\", \"\\\\vartriangleleft\");\ndefineSymbol(symbols_math, ams, rel, \"\\u22B4\", \"\\\\trianglelefteq\");\ndefineSymbol(symbols_math, ams, rel, \"\\u22A8\", \"\\\\vDash\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22AA\", \"\\\\Vvdash\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2323\", \"\\\\smallsmile\");\ndefineSymbol(symbols_math, ams, rel, \"\\u2322\", \"\\\\smallfrown\");\ndefineSymbol(symbols_math, ams, rel, \"\\u224F\", \"\\\\bumpeq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u224E\", \"\\\\Bumpeq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2267\", \"\\\\geqq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2A7E\", \"\\\\geqslant\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2A96\", \"\\\\eqslantgtr\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2273\", \"\\\\gtrsim\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2A86\", \"\\\\gtrapprox\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u22D7\", \"\\\\gtrdot\");\ndefineSymbol(symbols_math, ams, rel, \"\\u22D9\", \"\\\\ggg\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2277\", \"\\\\gtrless\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22DB\", \"\\\\gtreqless\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2A8C\", \"\\\\gtreqqless\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2256\", \"\\\\eqcirc\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2257\", \"\\\\circeq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u225C\", \"\\\\triangleq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u223C\", \"\\\\thicksim\");\ndefineSymbol(symbols_math, ams, rel, \"\\u2248\", \"\\\\thickapprox\");\ndefineSymbol(symbols_math, ams, rel, \"\\u2AC6\", \"\\\\supseteqq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22D1\", \"\\\\Supset\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2290\", \"\\\\sqsupset\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u227D\", \"\\\\succcurlyeq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22DF\", \"\\\\curlyeqsucc\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u227F\", \"\\\\succsim\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2AB8\", \"\\\\succapprox\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22B3\", \"\\\\vartriangleright\");\ndefineSymbol(symbols_math, ams, rel, \"\\u22B5\", \"\\\\trianglerighteq\");\ndefineSymbol(symbols_math, ams, rel, \"\\u22A9\", \"\\\\Vdash\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2223\", \"\\\\shortmid\");\ndefineSymbol(symbols_math, ams, rel, \"\\u2225\", \"\\\\shortparallel\");\ndefineSymbol(symbols_math, ams, rel, \"\\u226C\", \"\\\\between\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22D4\", \"\\\\pitchfork\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u221D\", \"\\\\varpropto\");\ndefineSymbol(symbols_math, ams, rel, \"\\u25C0\", \"\\\\blacktriangleleft\"); // unicode-math says that \\therefore is a mathord atom.\n// We kept the amssymb atom type, which is rel.\n\ndefineSymbol(symbols_math, ams, rel, \"\\u2234\", \"\\\\therefore\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u220D\", \"\\\\backepsilon\");\ndefineSymbol(symbols_math, ams, rel, \"\\u25B6\", \"\\\\blacktriangleright\"); // unicode-math says that \\because is a mathord atom.\n// We kept the amssymb atom type, which is rel.\n\ndefineSymbol(symbols_math, ams, rel, \"\\u2235\", \"\\\\because\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22D8\", \"\\\\llless\");\ndefineSymbol(symbols_math, ams, rel, \"\\u22D9\", \"\\\\gggtr\");\ndefineSymbol(symbols_math, ams, bin, \"\\u22B2\", \"\\\\lhd\");\ndefineSymbol(symbols_math, ams, bin, \"\\u22B3\", \"\\\\rhd\");\ndefineSymbol(symbols_math, ams, rel, \"\\u2242\", \"\\\\eqsim\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u22C8\", \"\\\\Join\");\ndefineSymbol(symbols_math, ams, rel, \"\\u2251\", \"\\\\Doteq\", true); // AMS Binary Operators\n\ndefineSymbol(symbols_math, ams, bin, \"\\u2214\", \"\\\\dotplus\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u2216\", \"\\\\smallsetminus\");\ndefineSymbol(symbols_math, ams, bin, \"\\u22D2\", \"\\\\Cap\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u22D3\", \"\\\\Cup\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u2A5E\", \"\\\\doublebarwedge\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u229F\", \"\\\\boxminus\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u229E\", \"\\\\boxplus\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u22C7\", \"\\\\divideontimes\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u22C9\", \"\\\\ltimes\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u22CA\", \"\\\\rtimes\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u22CB\", \"\\\\leftthreetimes\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u22CC\", \"\\\\rightthreetimes\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u22CF\", \"\\\\curlywedge\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u22CE\", \"\\\\curlyvee\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u229D\", \"\\\\circleddash\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u229B\", \"\\\\circledast\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u22C5\", \"\\\\centerdot\");\ndefineSymbol(symbols_math, ams, bin, \"\\u22BA\", \"\\\\intercal\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u22D2\", \"\\\\doublecap\");\ndefineSymbol(symbols_math, ams, bin, \"\\u22D3\", \"\\\\doublecup\");\ndefineSymbol(symbols_math, ams, bin, \"\\u22A0\", \"\\\\boxtimes\", true); // AMS Arrows\n// Note: unicode-math maps \\u21e2 to their own function \\rightdasharrow.\n// We'll map it to AMS function \\dashrightarrow. It produces the same atom.\n\ndefineSymbol(symbols_math, ams, rel, \"\\u21E2\", \"\\\\dashrightarrow\", true); // unicode-math maps \\u21e0 to \\leftdasharrow. We'll use the AMS synonym.\n\ndefineSymbol(symbols_math, ams, rel, \"\\u21E0\", \"\\\\dashleftarrow\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21C7\", \"\\\\leftleftarrows\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21C6\", \"\\\\leftrightarrows\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21DA\", \"\\\\Lleftarrow\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u219E\", \"\\\\twoheadleftarrow\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21A2\", \"\\\\leftarrowtail\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21AB\", \"\\\\looparrowleft\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21CB\", \"\\\\leftrightharpoons\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21B6\", \"\\\\curvearrowleft\", true); // unicode-math maps \\u21ba to \\acwopencirclearrow. We'll use the AMS synonym.\n\ndefineSymbol(symbols_math, ams, rel, \"\\u21BA\", \"\\\\circlearrowleft\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21B0\", \"\\\\Lsh\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21C8\", \"\\\\upuparrows\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21BF\", \"\\\\upharpoonleft\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21C3\", \"\\\\downharpoonleft\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u22B8\", \"\\\\multimap\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21AD\", \"\\\\leftrightsquigarrow\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21C9\", \"\\\\rightrightarrows\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21C4\", \"\\\\rightleftarrows\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21A0\", \"\\\\twoheadrightarrow\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21A3\", \"\\\\rightarrowtail\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21AC\", \"\\\\looparrowright\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21B7\", \"\\\\curvearrowright\", true); // unicode-math maps \\u21bb to \\cwopencirclearrow. We'll use the AMS synonym.\n\ndefineSymbol(symbols_math, ams, rel, \"\\u21BB\", \"\\\\circlearrowright\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21B1\", \"\\\\Rsh\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21CA\", \"\\\\downdownarrows\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21BE\", \"\\\\upharpoonright\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21C2\", \"\\\\downharpoonright\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21DD\", \"\\\\rightsquigarrow\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21DD\", \"\\\\leadsto\");\ndefineSymbol(symbols_math, ams, rel, \"\\u21DB\", \"\\\\Rrightarrow\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u21BE\", \"\\\\restriction\");\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2018\", \"`\");\ndefineSymbol(symbols_math, main, symbols_textord, \"$\", \"\\\\$\");\ndefineSymbol(symbols_text, main, symbols_textord, \"$\", \"\\\\$\");\ndefineSymbol(symbols_text, main, symbols_textord, \"$\", \"\\\\textdollar\");\ndefineSymbol(symbols_math, main, symbols_textord, \"%\", \"\\\\%\");\ndefineSymbol(symbols_text, main, symbols_textord, \"%\", \"\\\\%\");\ndefineSymbol(symbols_math, main, symbols_textord, \"_\", \"\\\\_\");\ndefineSymbol(symbols_text, main, symbols_textord, \"_\", \"\\\\_\");\ndefineSymbol(symbols_text, main, symbols_textord, \"_\", \"\\\\textunderscore\");\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2220\", \"\\\\angle\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u221E\", \"\\\\infty\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2032\", \"\\\\prime\");\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u25B3\", \"\\\\triangle\");\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u0393\", \"\\\\Gamma\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u0394\", \"\\\\Delta\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u0398\", \"\\\\Theta\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u039B\", \"\\\\Lambda\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u039E\", \"\\\\Xi\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u03A0\", \"\\\\Pi\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u03A3\", \"\\\\Sigma\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u03A5\", \"\\\\Upsilon\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u03A6\", \"\\\\Phi\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u03A8\", \"\\\\Psi\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u03A9\", \"\\\\Omega\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"A\", \"\\u0391\");\ndefineSymbol(symbols_math, main, symbols_textord, \"B\", \"\\u0392\");\ndefineSymbol(symbols_math, main, symbols_textord, \"E\", \"\\u0395\");\ndefineSymbol(symbols_math, main, symbols_textord, \"Z\", \"\\u0396\");\ndefineSymbol(symbols_math, main, symbols_textord, \"H\", \"\\u0397\");\ndefineSymbol(symbols_math, main, symbols_textord, \"I\", \"\\u0399\");\ndefineSymbol(symbols_math, main, symbols_textord, \"K\", \"\\u039A\");\ndefineSymbol(symbols_math, main, symbols_textord, \"M\", \"\\u039C\");\ndefineSymbol(symbols_math, main, symbols_textord, \"N\", \"\\u039D\");\ndefineSymbol(symbols_math, main, symbols_textord, \"O\", \"\\u039F\");\ndefineSymbol(symbols_math, main, symbols_textord, \"P\", \"\\u03A1\");\ndefineSymbol(symbols_math, main, symbols_textord, \"T\", \"\\u03A4\");\ndefineSymbol(symbols_math, main, symbols_textord, \"X\", \"\\u03A7\");\ndefineSymbol(symbols_math, main, symbols_textord, \"\\xAC\", \"\\\\neg\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\xAC\", \"\\\\lnot\");\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u22A4\", \"\\\\top\");\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u22A5\", \"\\\\bot\");\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2205\", \"\\\\emptyset\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u2205\", \"\\\\varnothing\");\ndefineSymbol(symbols_math, main, mathord, \"\\u03B1\", \"\\\\alpha\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03B2\", \"\\\\beta\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03B3\", \"\\\\gamma\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03B4\", \"\\\\delta\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03F5\", \"\\\\epsilon\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03B6\", \"\\\\zeta\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03B7\", \"\\\\eta\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03B8\", \"\\\\theta\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03B9\", \"\\\\iota\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03BA\", \"\\\\kappa\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03BB\", \"\\\\lambda\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03BC\", \"\\\\mu\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03BD\", \"\\\\nu\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03BE\", \"\\\\xi\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03BF\", \"\\\\omicron\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03C0\", \"\\\\pi\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03C1\", \"\\\\rho\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03C3\", \"\\\\sigma\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03C4\", \"\\\\tau\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03C5\", \"\\\\upsilon\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03D5\", \"\\\\phi\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03C7\", \"\\\\chi\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03C8\", \"\\\\psi\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03C9\", \"\\\\omega\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03B5\", \"\\\\varepsilon\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03D1\", \"\\\\vartheta\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03D6\", \"\\\\varpi\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03F1\", \"\\\\varrho\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03C2\", \"\\\\varsigma\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u03C6\", \"\\\\varphi\", true);\ndefineSymbol(symbols_math, main, bin, \"\\u2217\", \"*\");\ndefineSymbol(symbols_math, main, bin, \"+\", \"+\");\ndefineSymbol(symbols_math, main, bin, \"\\u2212\", \"-\");\ndefineSymbol(symbols_math, main, bin, \"\\u22C5\", \"\\\\cdot\", true);\ndefineSymbol(symbols_math, main, bin, \"\\u2218\", \"\\\\circ\");\ndefineSymbol(symbols_math, main, bin, \"\\xF7\", \"\\\\div\", true);\ndefineSymbol(symbols_math, main, bin, \"\\xB1\", \"\\\\pm\", true);\ndefineSymbol(symbols_math, main, bin, \"\\xD7\", \"\\\\times\", true);\ndefineSymbol(symbols_math, main, bin, \"\\u2229\", \"\\\\cap\", true);\ndefineSymbol(symbols_math, main, bin, \"\\u222A\", \"\\\\cup\", true);\ndefineSymbol(symbols_math, main, bin, \"\\u2216\", \"\\\\setminus\");\ndefineSymbol(symbols_math, main, bin, \"\\u2227\", \"\\\\land\");\ndefineSymbol(symbols_math, main, bin, \"\\u2228\", \"\\\\lor\");\ndefineSymbol(symbols_math, main, bin, \"\\u2227\", \"\\\\wedge\", true);\ndefineSymbol(symbols_math, main, bin, \"\\u2228\", \"\\\\vee\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u221A\", \"\\\\surd\");\ndefineSymbol(symbols_math, main, symbols_open, \"(\", \"(\");\ndefineSymbol(symbols_math, main, symbols_open, \"[\", \"[\");\ndefineSymbol(symbols_math, main, symbols_open, \"\\u27E8\", \"\\\\langle\", true);\ndefineSymbol(symbols_math, main, symbols_open, \"\\u2223\", \"\\\\lvert\");\ndefineSymbol(symbols_math, main, symbols_open, \"\\u2225\", \"\\\\lVert\");\ndefineSymbol(symbols_math, main, symbols_close, \")\", \")\");\ndefineSymbol(symbols_math, main, symbols_close, \"]\", \"]\");\ndefineSymbol(symbols_math, main, symbols_close, \"?\", \"?\");\ndefineSymbol(symbols_math, main, symbols_close, \"!\", \"!\");\ndefineSymbol(symbols_math, main, symbols_close, \"\\u27E9\", \"\\\\rangle\", true);\ndefineSymbol(symbols_math, main, symbols_close, \"\\u2223\", \"\\\\rvert\");\ndefineSymbol(symbols_math, main, symbols_close, \"\\u2225\", \"\\\\rVert\");\ndefineSymbol(symbols_math, main, rel, \"=\", \"=\");\ndefineSymbol(symbols_math, main, rel, \"<\", \"<\");\ndefineSymbol(symbols_math, main, rel, \">\", \">\");\ndefineSymbol(symbols_math, main, rel, \":\", \":\");\ndefineSymbol(symbols_math, main, rel, \"\\u2248\", \"\\\\approx\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2245\", \"\\\\cong\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2265\", \"\\\\ge\");\ndefineSymbol(symbols_math, main, rel, \"\\u2265\", \"\\\\geq\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2190\", \"\\\\gets\");\ndefineSymbol(symbols_math, main, rel, \">\", \"\\\\gt\");\ndefineSymbol(symbols_math, main, rel, \"\\u2208\", \"\\\\in\", true);\ndefineSymbol(symbols_math, main, rel, \"\\uE020\", \"\\\\@not\");\ndefineSymbol(symbols_math, main, rel, \"\\u2282\", \"\\\\subset\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2283\", \"\\\\supset\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2286\", \"\\\\subseteq\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2287\", \"\\\\supseteq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2288\", \"\\\\nsubseteq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2289\", \"\\\\nsupseteq\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u22A8\", \"\\\\models\");\ndefineSymbol(symbols_math, main, rel, \"\\u2190\", \"\\\\leftarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2264\", \"\\\\le\");\ndefineSymbol(symbols_math, main, rel, \"\\u2264\", \"\\\\leq\", true);\ndefineSymbol(symbols_math, main, rel, \"<\", \"\\\\lt\");\ndefineSymbol(symbols_math, main, rel, \"\\u2192\", \"\\\\rightarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2192\", \"\\\\to\");\ndefineSymbol(symbols_math, ams, rel, \"\\u2271\", \"\\\\ngeq\", true);\ndefineSymbol(symbols_math, ams, rel, \"\\u2270\", \"\\\\nleq\", true);\ndefineSymbol(symbols_math, main, symbols_spacing, \"\\xA0\", \"\\\\ \");\ndefineSymbol(symbols_math, main, symbols_spacing, \"\\xA0\", \"~\");\ndefineSymbol(symbols_math, main, symbols_spacing, \"\\xA0\", \"\\\\space\"); // Ref: LaTeX Source 2e: \\DeclareRobustCommand{\\nobreakspace}{%\n\ndefineSymbol(symbols_math, main, symbols_spacing, \"\\xA0\", \"\\\\nobreakspace\");\ndefineSymbol(symbols_text, main, symbols_spacing, \"\\xA0\", \"\\\\ \");\ndefineSymbol(symbols_text, main, symbols_spacing, \"\\xA0\", \"~\");\ndefineSymbol(symbols_text, main, symbols_spacing, \"\\xA0\", \"\\\\space\");\ndefineSymbol(symbols_text, main, symbols_spacing, \"\\xA0\", \"\\\\nobreakspace\");\ndefineSymbol(symbols_math, main, symbols_spacing, null, \"\\\\nobreak\");\ndefineSymbol(symbols_math, main, symbols_spacing, null, \"\\\\allowbreak\");\ndefineSymbol(symbols_math, main, punct, \",\", \",\");\ndefineSymbol(symbols_math, main, punct, \";\", \";\");\ndefineSymbol(symbols_math, ams, bin, \"\\u22BC\", \"\\\\barwedge\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u22BB\", \"\\\\veebar\", true);\ndefineSymbol(symbols_math, main, bin, \"\\u2299\", \"\\\\odot\", true);\ndefineSymbol(symbols_math, main, bin, \"\\u2295\", \"\\\\oplus\", true);\ndefineSymbol(symbols_math, main, bin, \"\\u2297\", \"\\\\otimes\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2202\", \"\\\\partial\", true);\ndefineSymbol(symbols_math, main, bin, \"\\u2298\", \"\\\\oslash\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u229A\", \"\\\\circledcirc\", true);\ndefineSymbol(symbols_math, ams, bin, \"\\u22A1\", \"\\\\boxdot\", true);\ndefineSymbol(symbols_math, main, bin, \"\\u25B3\", \"\\\\bigtriangleup\");\ndefineSymbol(symbols_math, main, bin, \"\\u25BD\", \"\\\\bigtriangledown\");\ndefineSymbol(symbols_math, main, bin, \"\\u2020\", \"\\\\dagger\");\ndefineSymbol(symbols_math, main, bin, \"\\u22C4\", \"\\\\diamond\");\ndefineSymbol(symbols_math, main, bin, \"\\u22C6\", \"\\\\star\");\ndefineSymbol(symbols_math, main, bin, \"\\u25C3\", \"\\\\triangleleft\");\ndefineSymbol(symbols_math, main, bin, \"\\u25B9\", \"\\\\triangleright\");\ndefineSymbol(symbols_math, main, symbols_open, \"{\", \"\\\\{\");\ndefineSymbol(symbols_text, main, symbols_textord, \"{\", \"\\\\{\");\ndefineSymbol(symbols_text, main, symbols_textord, \"{\", \"\\\\textbraceleft\");\ndefineSymbol(symbols_math, main, symbols_close, \"}\", \"\\\\}\");\ndefineSymbol(symbols_text, main, symbols_textord, \"}\", \"\\\\}\");\ndefineSymbol(symbols_text, main, symbols_textord, \"}\", \"\\\\textbraceright\");\ndefineSymbol(symbols_math, main, symbols_open, \"{\", \"\\\\lbrace\");\ndefineSymbol(symbols_math, main, symbols_close, \"}\", \"\\\\rbrace\");\ndefineSymbol(symbols_math, main, symbols_open, \"[\", \"\\\\lbrack\");\ndefineSymbol(symbols_text, main, symbols_textord, \"[\", \"\\\\lbrack\");\ndefineSymbol(symbols_math, main, symbols_close, \"]\", \"\\\\rbrack\");\ndefineSymbol(symbols_text, main, symbols_textord, \"]\", \"\\\\rbrack\");\ndefineSymbol(symbols_math, main, symbols_open, \"(\", \"\\\\lparen\");\ndefineSymbol(symbols_math, main, symbols_close, \")\", \"\\\\rparen\");\ndefineSymbol(symbols_text, main, symbols_textord, \"<\", \"\\\\textless\"); // in T1 fontenc\n\ndefineSymbol(symbols_text, main, symbols_textord, \">\", \"\\\\textgreater\"); // in T1 fontenc\n\ndefineSymbol(symbols_math, main, symbols_open, \"\\u230A\", \"\\\\lfloor\", true);\ndefineSymbol(symbols_math, main, symbols_close, \"\\u230B\", \"\\\\rfloor\", true);\ndefineSymbol(symbols_math, main, symbols_open, \"\\u2308\", \"\\\\lceil\", true);\ndefineSymbol(symbols_math, main, symbols_close, \"\\u2309\", \"\\\\rceil\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\\\\", \"\\\\backslash\");\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2223\", \"|\");\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2223\", \"\\\\vert\");\ndefineSymbol(symbols_text, main, symbols_textord, \"|\", \"\\\\textbar\"); // in T1 fontenc\n\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2225\", \"\\\\|\");\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u2225\", \"\\\\Vert\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u2225\", \"\\\\textbardbl\");\ndefineSymbol(symbols_text, main, symbols_textord, \"~\", \"\\\\textasciitilde\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\\\\", \"\\\\textbackslash\");\ndefineSymbol(symbols_text, main, symbols_textord, \"^\", \"\\\\textasciicircum\");\ndefineSymbol(symbols_math, main, rel, \"\\u2191\", \"\\\\uparrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u21D1\", \"\\\\Uparrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2193\", \"\\\\downarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u21D3\", \"\\\\Downarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u2195\", \"\\\\updownarrow\", true);\ndefineSymbol(symbols_math, main, rel, \"\\u21D5\", \"\\\\Updownarrow\", true);\ndefineSymbol(symbols_math, main, op, \"\\u2210\", \"\\\\coprod\");\ndefineSymbol(symbols_math, main, op, \"\\u22C1\", \"\\\\bigvee\");\ndefineSymbol(symbols_math, main, op, \"\\u22C0\", \"\\\\bigwedge\");\ndefineSymbol(symbols_math, main, op, \"\\u2A04\", \"\\\\biguplus\");\ndefineSymbol(symbols_math, main, op, \"\\u22C2\", \"\\\\bigcap\");\ndefineSymbol(symbols_math, main, op, \"\\u22C3\", \"\\\\bigcup\");\ndefineSymbol(symbols_math, main, op, \"\\u222B\", \"\\\\int\");\ndefineSymbol(symbols_math, main, op, \"\\u222B\", \"\\\\intop\");\ndefineSymbol(symbols_math, main, op, \"\\u222C\", \"\\\\iint\");\ndefineSymbol(symbols_math, main, op, \"\\u222D\", \"\\\\iiint\");\ndefineSymbol(symbols_math, main, op, \"\\u220F\", \"\\\\prod\");\ndefineSymbol(symbols_math, main, op, \"\\u2211\", \"\\\\sum\");\ndefineSymbol(symbols_math, main, op, \"\\u2A02\", \"\\\\bigotimes\");\ndefineSymbol(symbols_math, main, op, \"\\u2A01\", \"\\\\bigoplus\");\ndefineSymbol(symbols_math, main, op, \"\\u2A00\", \"\\\\bigodot\");\ndefineSymbol(symbols_math, main, op, \"\\u222E\", \"\\\\oint\");\ndefineSymbol(symbols_math, main, op, \"\\u222F\", \"\\\\oiint\");\ndefineSymbol(symbols_math, main, op, \"\\u2230\", \"\\\\oiiint\");\ndefineSymbol(symbols_math, main, op, \"\\u2A06\", \"\\\\bigsqcup\");\ndefineSymbol(symbols_math, main, op, \"\\u222B\", \"\\\\smallint\");\ndefineSymbol(symbols_text, main, symbols_inner, \"\\u2026\", \"\\\\textellipsis\");\ndefineSymbol(symbols_math, main, symbols_inner, \"\\u2026\", \"\\\\mathellipsis\");\ndefineSymbol(symbols_text, main, symbols_inner, \"\\u2026\", \"\\\\ldots\", true);\ndefineSymbol(symbols_math, main, symbols_inner, \"\\u2026\", \"\\\\ldots\", true);\ndefineSymbol(symbols_math, main, symbols_inner, \"\\u22EF\", \"\\\\@cdots\", true);\ndefineSymbol(symbols_math, main, symbols_inner, \"\\u22F1\", \"\\\\ddots\", true);\ndefineSymbol(symbols_math, main, symbols_textord, \"\\u22EE\", \"\\\\varvdots\"); // \\vdots is a macro\n\ndefineSymbol(symbols_math, main, symbols_accent, \"\\u02CA\", \"\\\\acute\");\ndefineSymbol(symbols_math, main, symbols_accent, \"\\u02CB\", \"\\\\grave\");\ndefineSymbol(symbols_math, main, symbols_accent, \"\\xA8\", \"\\\\ddot\");\ndefineSymbol(symbols_math, main, symbols_accent, \"~\", \"\\\\tilde\");\ndefineSymbol(symbols_math, main, symbols_accent, \"\\u02C9\", \"\\\\bar\");\ndefineSymbol(symbols_math, main, symbols_accent, \"\\u02D8\", \"\\\\breve\");\ndefineSymbol(symbols_math, main, symbols_accent, \"\\u02C7\", \"\\\\check\");\ndefineSymbol(symbols_math, main, symbols_accent, \"^\", \"\\\\hat\");\ndefineSymbol(symbols_math, main, symbols_accent, \"\\u20D7\", \"\\\\vec\");\ndefineSymbol(symbols_math, main, symbols_accent, \"\\u02D9\", \"\\\\dot\");\ndefineSymbol(symbols_math, main, symbols_accent, \"\\u02DA\", \"\\\\mathring\");\ndefineSymbol(symbols_math, main, mathord, \"\\u0131\", \"\\\\imath\", true);\ndefineSymbol(symbols_math, main, mathord, \"\\u0237\", \"\\\\jmath\", true);\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u0131\", \"\\\\i\", true);\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u0237\", \"\\\\j\", true);\ndefineSymbol(symbols_text, main, symbols_textord, \"\\xDF\", \"\\\\ss\", true);\ndefineSymbol(symbols_text, main, symbols_textord, \"\\xE6\", \"\\\\ae\", true);\ndefineSymbol(symbols_text, main, symbols_textord, \"\\xE6\", \"\\\\ae\", true);\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u0153\", \"\\\\oe\", true);\ndefineSymbol(symbols_text, main, symbols_textord, \"\\xF8\", \"\\\\o\", true);\ndefineSymbol(symbols_text, main, symbols_textord, \"\\xC6\", \"\\\\AE\", true);\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u0152\", \"\\\\OE\", true);\ndefineSymbol(symbols_text, main, symbols_textord, \"\\xD8\", \"\\\\O\", true);\ndefineSymbol(symbols_text, main, symbols_accent, \"\\u02CA\", \"\\\\'\"); // acute\n\ndefineSymbol(symbols_text, main, symbols_accent, \"\\u02CB\", \"\\\\`\"); // grave\n\ndefineSymbol(symbols_text, main, symbols_accent, \"\\u02C6\", \"\\\\^\"); // circumflex\n\ndefineSymbol(symbols_text, main, symbols_accent, \"\\u02DC\", \"\\\\~\"); // tilde\n\ndefineSymbol(symbols_text, main, symbols_accent, \"\\u02C9\", \"\\\\=\"); // macron\n\ndefineSymbol(symbols_text, main, symbols_accent, \"\\u02D8\", \"\\\\u\"); // breve\n\ndefineSymbol(symbols_text, main, symbols_accent, \"\\u02D9\", \"\\\\.\"); // dot above\n\ndefineSymbol(symbols_text, main, symbols_accent, \"\\u02DA\", \"\\\\r\"); // ring above\n\ndefineSymbol(symbols_text, main, symbols_accent, \"\\u02C7\", \"\\\\v\"); // caron\n\ndefineSymbol(symbols_text, main, symbols_accent, \"\\xA8\", '\\\\\"'); // diaresis\n\ndefineSymbol(symbols_text, main, symbols_accent, \"\\u02DD\", \"\\\\H\"); // double acute\n\ndefineSymbol(symbols_text, main, symbols_accent, \"\\u25EF\", \"\\\\textcircled\"); // \\bigcirc glyph\n// These ligatures are detected and created in Parser.js's `formLigatures`.\n\nvar ligatures = {\n \"--\": true,\n \"---\": true,\n \"``\": true,\n \"''\": true\n};\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u2013\", \"--\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u2013\", \"\\\\textendash\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u2014\", \"---\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u2014\", \"\\\\textemdash\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u2018\", \"`\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u2018\", \"\\\\textquoteleft\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u2019\", \"'\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u2019\", \"\\\\textquoteright\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u201C\", \"``\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u201C\", \"\\\\textquotedblleft\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u201D\", \"''\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u201D\", \"\\\\textquotedblright\"); // \\degree from gensymb package\n\ndefineSymbol(symbols_math, main, symbols_textord, \"\\xB0\", \"\\\\degree\", true);\ndefineSymbol(symbols_text, main, symbols_textord, \"\\xB0\", \"\\\\degree\"); // \\textdegree from inputenc package\n\ndefineSymbol(symbols_text, main, symbols_textord, \"\\xB0\", \"\\\\textdegree\", true); // TODO: In LaTeX, \\pounds can generate a different character in text and math\n// mode, but among our fonts, only Main-Italic defines this character \"163\".\n\ndefineSymbol(symbols_math, main, mathord, \"\\xA3\", \"\\\\pounds\");\ndefineSymbol(symbols_math, main, mathord, \"\\xA3\", \"\\\\mathsterling\", true);\ndefineSymbol(symbols_text, main, mathord, \"\\xA3\", \"\\\\pounds\");\ndefineSymbol(symbols_text, main, mathord, \"\\xA3\", \"\\\\textsterling\", true);\ndefineSymbol(symbols_math, ams, symbols_textord, \"\\u2720\", \"\\\\maltese\");\ndefineSymbol(symbols_text, ams, symbols_textord, \"\\u2720\", \"\\\\maltese\");\ndefineSymbol(symbols_text, main, symbols_spacing, \"\\xA0\", \"\\\\ \");\ndefineSymbol(symbols_text, main, symbols_spacing, \"\\xA0\", \" \");\ndefineSymbol(symbols_text, main, symbols_spacing, \"\\xA0\", \"~\"); // There are lots of symbols which are the same, so we add them in afterwards.\n// All of these are textords in math mode\n\nvar mathTextSymbols = \"0123456789/@.\\\"\";\n\nfor (var symbols_i = 0; symbols_i < mathTextSymbols.length; symbols_i++) {\n var symbols_ch = mathTextSymbols.charAt(symbols_i);\n defineSymbol(symbols_math, main, symbols_textord, symbols_ch, symbols_ch);\n} // All of these are textords in text mode\n\n\nvar textSymbols = \"0123456789!@*()-=+[]<>|\\\";:?/.,\";\n\nfor (var src_symbols_i = 0; src_symbols_i < textSymbols.length; src_symbols_i++) {\n var _ch = textSymbols.charAt(src_symbols_i);\n\n defineSymbol(symbols_text, main, symbols_textord, _ch, _ch);\n} // All of these are textords in text mode, and mathords in math mode\n\n\nvar letters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";\n\nfor (var symbols_i2 = 0; symbols_i2 < letters.length; symbols_i2++) {\n var _ch2 = letters.charAt(symbols_i2);\n\n defineSymbol(symbols_math, main, mathord, _ch2, _ch2);\n defineSymbol(symbols_text, main, symbols_textord, _ch2, _ch2);\n} // Blackboard bold and script letters in Unicode range\n\n\ndefineSymbol(symbols_math, ams, symbols_textord, \"C\", \"\\u2102\"); // blackboard bold\n\ndefineSymbol(symbols_text, ams, symbols_textord, \"C\", \"\\u2102\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"H\", \"\\u210D\");\ndefineSymbol(symbols_text, ams, symbols_textord, \"H\", \"\\u210D\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"N\", \"\\u2115\");\ndefineSymbol(symbols_text, ams, symbols_textord, \"N\", \"\\u2115\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"P\", \"\\u2119\");\ndefineSymbol(symbols_text, ams, symbols_textord, \"P\", \"\\u2119\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"Q\", \"\\u211A\");\ndefineSymbol(symbols_text, ams, symbols_textord, \"Q\", \"\\u211A\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"R\", \"\\u211D\");\ndefineSymbol(symbols_text, ams, symbols_textord, \"R\", \"\\u211D\");\ndefineSymbol(symbols_math, ams, symbols_textord, \"Z\", \"\\u2124\");\ndefineSymbol(symbols_text, ams, symbols_textord, \"Z\", \"\\u2124\");\ndefineSymbol(symbols_math, main, mathord, \"h\", \"\\u210E\"); // italic h, Planck constant\n\ndefineSymbol(symbols_text, main, mathord, \"h\", \"\\u210E\"); // The next loop loads wide (surrogate pair) characters.\n// We support some letters in the Unicode range U+1D400 to U+1D7FF,\n// Mathematical Alphanumeric Symbols.\n// Some editors do not deal well with wide characters. So don't write the\n// string into this file. Instead, create the string from the surrogate pair.\n\nvar symbols_wideChar = \"\";\n\nfor (var symbols_i3 = 0; symbols_i3 < letters.length; symbols_i3++) {\n var _ch3 = letters.charAt(symbols_i3); // The hex numbers in the next line are a surrogate pair.\n // 0xD835 is the high surrogate for all letters in the range we support.\n // 0xDC00 is the low surrogate for bold A.\n\n\n symbols_wideChar = String.fromCharCode(0xD835, 0xDC00 + symbols_i3); // A-Z a-z bold\n\n defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);\n defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);\n symbols_wideChar = String.fromCharCode(0xD835, 0xDC34 + symbols_i3); // A-Z a-z italic\n\n defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);\n defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);\n symbols_wideChar = String.fromCharCode(0xD835, 0xDC68 + symbols_i3); // A-Z a-z bold italic\n\n defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);\n defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);\n symbols_wideChar = String.fromCharCode(0xD835, 0xDD04 + symbols_i3); // A-Z a-z Fractur\n\n defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);\n defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);\n symbols_wideChar = String.fromCharCode(0xD835, 0xDDA0 + symbols_i3); // A-Z a-z sans-serif\n\n defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);\n defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);\n symbols_wideChar = String.fromCharCode(0xD835, 0xDDD4 + symbols_i3); // A-Z a-z sans bold\n\n defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);\n defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);\n symbols_wideChar = String.fromCharCode(0xD835, 0xDE08 + symbols_i3); // A-Z a-z sans italic\n\n defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);\n defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);\n symbols_wideChar = String.fromCharCode(0xD835, 0xDE70 + symbols_i3); // A-Z a-z monospace\n\n defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);\n defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);\n\n if (symbols_i3 < 26) {\n // KaTeX fonts have only capital letters for blackboard bold and script.\n // See exception for k below.\n symbols_wideChar = String.fromCharCode(0xD835, 0xDD38 + symbols_i3); // A-Z double struck\n\n defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);\n defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);\n symbols_wideChar = String.fromCharCode(0xD835, 0xDC9C + symbols_i3); // A-Z script\n\n defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);\n defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);\n } // TODO: Add bold script when it is supported by a KaTeX font.\n\n} // \"k\" is the only double struck lower case letter in the KaTeX fonts.\n\n\nsymbols_wideChar = String.fromCharCode(0xD835, 0xDD5C); // k double struck\n\ndefineSymbol(symbols_math, main, mathord, \"k\", symbols_wideChar);\ndefineSymbol(symbols_text, main, symbols_textord, \"k\", symbols_wideChar); // Next, some wide character numerals\n\nfor (var symbols_i4 = 0; symbols_i4 < 10; symbols_i4++) {\n var _ch4 = symbols_i4.toString();\n\n symbols_wideChar = String.fromCharCode(0xD835, 0xDFCE + symbols_i4); // 0-9 bold\n\n defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar);\n defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar);\n symbols_wideChar = String.fromCharCode(0xD835, 0xDFE2 + symbols_i4); // 0-9 sans serif\n\n defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar);\n defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar);\n symbols_wideChar = String.fromCharCode(0xD835, 0xDFEC + symbols_i4); // 0-9 bold sans\n\n defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar);\n defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar);\n symbols_wideChar = String.fromCharCode(0xD835, 0xDFF6 + symbols_i4); // 0-9 monospace\n\n defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar);\n defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar);\n} // We add these Latin-1 letters as symbols for backwards-compatibility,\n// but they are not actually in the font, nor are they supported by the\n// Unicode accent mechanism, so they fall back to Times font and look ugly.\n// TODO(edemaine): Fix this.\n\n\nvar extraLatin = \"ÇÐÞçþ\";\n\nfor (var _i5 = 0; _i5 < extraLatin.length; _i5++) {\n var _ch5 = extraLatin.charAt(_i5);\n\n defineSymbol(symbols_math, main, mathord, _ch5, _ch5);\n defineSymbol(symbols_text, main, symbols_textord, _ch5, _ch5);\n}\n\ndefineSymbol(symbols_text, main, symbols_textord, \"ð\", \"ð\"); // Unicode versions of existing characters\n\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u2013\", \"–\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u2014\", \"—\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u2018\", \"‘\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u2019\", \"’\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u201C\", \"“\");\ndefineSymbol(symbols_text, main, symbols_textord, \"\\u201D\", \"”\");\n// CONCATENATED MODULE: ./src/wide-character.js\n/**\n * This file provides support for Unicode range U+1D400 to U+1D7FF,\n * Mathematical Alphanumeric Symbols.\n *\n * Function wideCharacterFont takes a wide character as input and returns\n * the font information necessary to render it properly.\n */\n\n/**\n * Data below is from https://www.unicode.org/charts/PDF/U1D400.pdf\n * That document sorts characters into groups by font type, say bold or italic.\n *\n * In the arrays below, each subarray consists three elements:\n * * The CSS class of that group when in math mode.\n * * The CSS class of that group when in text mode.\n * * The font name, so that KaTeX can get font metrics.\n */\n\nvar wideLatinLetterData = [[\"mathbf\", \"textbf\", \"Main-Bold\"], // A-Z bold upright\n[\"mathbf\", \"textbf\", \"Main-Bold\"], // a-z bold upright\n[\"mathdefault\", \"textit\", \"Math-Italic\"], // A-Z italic\n[\"mathdefault\", \"textit\", \"Math-Italic\"], // a-z italic\n[\"boldsymbol\", \"boldsymbol\", \"Main-BoldItalic\"], // A-Z bold italic\n[\"boldsymbol\", \"boldsymbol\", \"Main-BoldItalic\"], // a-z bold italic\n// Map fancy A-Z letters to script, not calligraphic.\n// This aligns with unicode-math and math fonts (except Cambria Math).\n[\"mathscr\", \"textscr\", \"Script-Regular\"], // A-Z script\n[\"\", \"\", \"\"], // a-z script. No font\n[\"\", \"\", \"\"], // A-Z bold script. No font\n[\"\", \"\", \"\"], // a-z bold script. No font\n[\"mathfrak\", \"textfrak\", \"Fraktur-Regular\"], // A-Z Fraktur\n[\"mathfrak\", \"textfrak\", \"Fraktur-Regular\"], // a-z Fraktur\n[\"mathbb\", \"textbb\", \"AMS-Regular\"], // A-Z double-struck\n[\"mathbb\", \"textbb\", \"AMS-Regular\"], // k double-struck\n[\"\", \"\", \"\"], // A-Z bold Fraktur No font metrics\n[\"\", \"\", \"\"], // a-z bold Fraktur. No font.\n[\"mathsf\", \"textsf\", \"SansSerif-Regular\"], // A-Z sans-serif\n[\"mathsf\", \"textsf\", \"SansSerif-Regular\"], // a-z sans-serif\n[\"mathboldsf\", \"textboldsf\", \"SansSerif-Bold\"], // A-Z bold sans-serif\n[\"mathboldsf\", \"textboldsf\", \"SansSerif-Bold\"], // a-z bold sans-serif\n[\"mathitsf\", \"textitsf\", \"SansSerif-Italic\"], // A-Z italic sans-serif\n[\"mathitsf\", \"textitsf\", \"SansSerif-Italic\"], // a-z italic sans-serif\n[\"\", \"\", \"\"], // A-Z bold italic sans. No font\n[\"\", \"\", \"\"], // a-z bold italic sans. No font\n[\"mathtt\", \"texttt\", \"Typewriter-Regular\"], // A-Z monospace\n[\"mathtt\", \"texttt\", \"Typewriter-Regular\"]];\nvar wideNumeralData = [[\"mathbf\", \"textbf\", \"Main-Bold\"], // 0-9 bold\n[\"\", \"\", \"\"], // 0-9 double-struck. No KaTeX font.\n[\"mathsf\", \"textsf\", \"SansSerif-Regular\"], // 0-9 sans-serif\n[\"mathboldsf\", \"textboldsf\", \"SansSerif-Bold\"], // 0-9 bold sans-serif\n[\"mathtt\", \"texttt\", \"Typewriter-Regular\"]];\nvar wide_character_wideCharacterFont = function wideCharacterFont(wideChar, mode) {\n // IE doesn't support codePointAt(). So work with the surrogate pair.\n var H = wideChar.charCodeAt(0); // high surrogate\n\n var L = wideChar.charCodeAt(1); // low surrogate\n\n var codePoint = (H - 0xD800) * 0x400 + (L - 0xDC00) + 0x10000;\n var j = mode === \"math\" ? 0 : 1; // column index for CSS class.\n\n if (0x1D400 <= codePoint && codePoint < 0x1D6A4) {\n // wideLatinLetterData contains exactly 26 chars on each row.\n // So we can calculate the relevant row. No traverse necessary.\n var i = Math.floor((codePoint - 0x1D400) / 26);\n return [wideLatinLetterData[i][2], wideLatinLetterData[i][j]];\n } else if (0x1D7CE <= codePoint && codePoint <= 0x1D7FF) {\n // Numerals, ten per row.\n var _i = Math.floor((codePoint - 0x1D7CE) / 10);\n\n return [wideNumeralData[_i][2], wideNumeralData[_i][j]];\n } else if (codePoint === 0x1D6A5 || codePoint === 0x1D6A6) {\n // dotless i or j\n return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]];\n } else if (0x1D6A6 < codePoint && codePoint < 0x1D7CE) {\n // Greek letters. Not supported, yet.\n return [\"\", \"\"];\n } else {\n // We don't support any wide characters outside 1D400–1D7FF.\n throw new src_ParseError(\"Unsupported character: \" + wideChar);\n }\n};\n// CONCATENATED MODULE: ./src/Options.js\n/**\n * This file contains information about the options that the Parser carries\n * around with it while parsing. Data is held in an `Options` object, and when\n * recursing, a new `Options` object can be created with the `.with*` and\n * `.reset` functions.\n */\n\nvar sizeStyleMap = [// Each element contains [textsize, scriptsize, scriptscriptsize].\n// The size mappings are taken from TeX with \\normalsize=10pt.\n[1, 1, 1], // size1: [5, 5, 5] \\tiny\n[2, 1, 1], // size2: [6, 5, 5]\n[3, 1, 1], // size3: [7, 5, 5] \\scriptsize\n[4, 2, 1], // size4: [8, 6, 5] \\footnotesize\n[5, 2, 1], // size5: [9, 6, 5] \\small\n[6, 3, 1], // size6: [10, 7, 5] \\normalsize\n[7, 4, 2], // size7: [12, 8, 6] \\large\n[8, 6, 3], // size8: [14.4, 10, 7] \\Large\n[9, 7, 6], // size9: [17.28, 12, 10] \\LARGE\n[10, 8, 7], // size10: [20.74, 14.4, 12] \\huge\n[11, 10, 9]];\nvar sizeMultipliers = [// fontMetrics.js:getGlobalMetrics also uses size indexes, so if\n// you change size indexes, change that function.\n0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.44, 1.728, 2.074, 2.488];\n\nvar sizeAtStyle = function sizeAtStyle(size, style) {\n return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1];\n}; // In these types, \"\" (empty string) means \"no change\".\n\n\n/**\n * This is the main options class. It contains the current style, size, color,\n * and font.\n *\n * Options objects should not be modified. To create a new Options with\n * different properties, call a `.having*` method.\n */\nvar Options_Options =\n/*#__PURE__*/\nfunction () {\n // A font family applies to a group of fonts (i.e. SansSerif), while a font\n // represents a specific font (i.e. SansSerif Bold).\n // See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm\n\n /**\n * The base size index.\n */\n function Options(data) {\n this.style = void 0;\n this.color = void 0;\n this.size = void 0;\n this.textSize = void 0;\n this.phantom = void 0;\n this.font = void 0;\n this.fontFamily = void 0;\n this.fontWeight = void 0;\n this.fontShape = void 0;\n this.sizeMultiplier = void 0;\n this.maxSize = void 0;\n this.minRuleThickness = void 0;\n this._fontMetrics = void 0;\n this.style = data.style;\n this.color = data.color;\n this.size = data.size || Options.BASESIZE;\n this.textSize = data.textSize || this.size;\n this.phantom = !!data.phantom;\n this.font = data.font || \"\";\n this.fontFamily = data.fontFamily || \"\";\n this.fontWeight = data.fontWeight || '';\n this.fontShape = data.fontShape || '';\n this.sizeMultiplier = sizeMultipliers[this.size - 1];\n this.maxSize = data.maxSize;\n this.minRuleThickness = data.minRuleThickness;\n this._fontMetrics = undefined;\n }\n /**\n * Returns a new options object with the same properties as \"this\". Properties\n * from \"extension\" will be copied to the new options object.\n */\n\n\n var _proto = Options.prototype;\n\n _proto.extend = function extend(extension) {\n var data = {\n style: this.style,\n size: this.size,\n textSize: this.textSize,\n color: this.color,\n phantom: this.phantom,\n font: this.font,\n fontFamily: this.fontFamily,\n fontWeight: this.fontWeight,\n fontShape: this.fontShape,\n maxSize: this.maxSize,\n minRuleThickness: this.minRuleThickness\n };\n\n for (var key in extension) {\n if (extension.hasOwnProperty(key)) {\n data[key] = extension[key];\n }\n }\n\n return new Options(data);\n }\n /**\n * Return an options object with the given style. If `this.style === style`,\n * returns `this`.\n */\n ;\n\n _proto.havingStyle = function havingStyle(style) {\n if (this.style === style) {\n return this;\n } else {\n return this.extend({\n style: style,\n size: sizeAtStyle(this.textSize, style)\n });\n }\n }\n /**\n * Return an options object with a cramped version of the current style. If\n * the current style is cramped, returns `this`.\n */\n ;\n\n _proto.havingCrampedStyle = function havingCrampedStyle() {\n return this.havingStyle(this.style.cramp());\n }\n /**\n * Return an options object with the given size and in at least `\\textstyle`.\n * Returns `this` if appropriate.\n */\n ;\n\n _proto.havingSize = function havingSize(size) {\n if (this.size === size && this.textSize === size) {\n return this;\n } else {\n return this.extend({\n style: this.style.text(),\n size: size,\n textSize: size,\n sizeMultiplier: sizeMultipliers[size - 1]\n });\n }\n }\n /**\n * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted,\n * changes to at least `\\textstyle`.\n */\n ;\n\n _proto.havingBaseStyle = function havingBaseStyle(style) {\n style = style || this.style.text();\n var wantSize = sizeAtStyle(Options.BASESIZE, style);\n\n if (this.size === wantSize && this.textSize === Options.BASESIZE && this.style === style) {\n return this;\n } else {\n return this.extend({\n style: style,\n size: wantSize\n });\n }\n }\n /**\n * Remove the effect of sizing changes such as \\Huge.\n * Keep the effect of the current style, such as \\scriptstyle.\n */\n ;\n\n _proto.havingBaseSizing = function havingBaseSizing() {\n var size;\n\n switch (this.style.id) {\n case 4:\n case 5:\n size = 3; // normalsize in scriptstyle\n\n break;\n\n case 6:\n case 7:\n size = 1; // normalsize in scriptscriptstyle\n\n break;\n\n default:\n size = 6;\n // normalsize in textstyle or displaystyle\n }\n\n return this.extend({\n style: this.style.text(),\n size: size\n });\n }\n /**\n * Create a new options object with the given color.\n */\n ;\n\n _proto.withColor = function withColor(color) {\n return this.extend({\n color: color\n });\n }\n /**\n * Create a new options object with \"phantom\" set to true.\n */\n ;\n\n _proto.withPhantom = function withPhantom() {\n return this.extend({\n phantom: true\n });\n }\n /**\n * Creates a new options object with the given math font or old text font.\n * @type {[type]}\n */\n ;\n\n _proto.withFont = function withFont(font) {\n return this.extend({\n font: font\n });\n }\n /**\n * Create a new options objects with the given fontFamily.\n */\n ;\n\n _proto.withTextFontFamily = function withTextFontFamily(fontFamily) {\n return this.extend({\n fontFamily: fontFamily,\n font: \"\"\n });\n }\n /**\n * Creates a new options object with the given font weight\n */\n ;\n\n _proto.withTextFontWeight = function withTextFontWeight(fontWeight) {\n return this.extend({\n fontWeight: fontWeight,\n font: \"\"\n });\n }\n /**\n * Creates a new options object with the given font weight\n */\n ;\n\n _proto.withTextFontShape = function withTextFontShape(fontShape) {\n return this.extend({\n fontShape: fontShape,\n font: \"\"\n });\n }\n /**\n * Return the CSS sizing classes required to switch from enclosing options\n * `oldOptions` to `this`. Returns an array of classes.\n */\n ;\n\n _proto.sizingClasses = function sizingClasses(oldOptions) {\n if (oldOptions.size !== this.size) {\n return [\"sizing\", \"reset-size\" + oldOptions.size, \"size\" + this.size];\n } else {\n return [];\n }\n }\n /**\n * Return the CSS sizing classes required to switch to the base size. Like\n * `this.havingSize(BASESIZE).sizingClasses(this)`.\n */\n ;\n\n _proto.baseSizingClasses = function baseSizingClasses() {\n if (this.size !== Options.BASESIZE) {\n return [\"sizing\", \"reset-size\" + this.size, \"size\" + Options.BASESIZE];\n } else {\n return [];\n }\n }\n /**\n * Return the font metrics for this size.\n */\n ;\n\n _proto.fontMetrics = function fontMetrics() {\n if (!this._fontMetrics) {\n this._fontMetrics = getGlobalMetrics(this.size);\n }\n\n return this._fontMetrics;\n }\n /**\n * Gets the CSS color of the current options object\n */\n ;\n\n _proto.getColor = function getColor() {\n if (this.phantom) {\n return \"transparent\";\n } else {\n return this.color;\n }\n };\n\n return Options;\n}();\n\nOptions_Options.BASESIZE = 6;\n/* harmony default export */ var src_Options = (Options_Options);\n// CONCATENATED MODULE: ./src/units.js\n/**\n * This file does conversion between units. In particular, it provides\n * calculateSize to convert other units into ems.\n */\n\n // This table gives the number of TeX pts in one of each *absolute* TeX unit.\n// Thus, multiplying a length by this number converts the length from units\n// into pts. Dividing the result by ptPerEm gives the number of ems\n// *assuming* a font size of ptPerEm (normal size, normal style).\n\nvar ptPerUnit = {\n // https://en.wikibooks.org/wiki/LaTeX/Lengths and\n // https://tex.stackexchange.com/a/8263\n \"pt\": 1,\n // TeX point\n \"mm\": 7227 / 2540,\n // millimeter\n \"cm\": 7227 / 254,\n // centimeter\n \"in\": 72.27,\n // inch\n \"bp\": 803 / 800,\n // big (PostScript) points\n \"pc\": 12,\n // pica\n \"dd\": 1238 / 1157,\n // didot\n \"cc\": 14856 / 1157,\n // cicero (12 didot)\n \"nd\": 685 / 642,\n // new didot\n \"nc\": 1370 / 107,\n // new cicero (12 new didot)\n \"sp\": 1 / 65536,\n // scaled point (TeX's internal smallest unit)\n // https://tex.stackexchange.com/a/41371\n \"px\": 803 / 800 // \\pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX\n\n}; // Dictionary of relative units, for fast validity testing.\n\nvar relativeUnit = {\n \"ex\": true,\n \"em\": true,\n \"mu\": true\n};\n\n/**\n * Determine whether the specified unit (either a string defining the unit\n * or a \"size\" parse node containing a unit field) is valid.\n */\nvar validUnit = function validUnit(unit) {\n if (typeof unit !== \"string\") {\n unit = unit.unit;\n }\n\n return unit in ptPerUnit || unit in relativeUnit || unit === \"ex\";\n};\n/*\n * Convert a \"size\" parse node (with numeric \"number\" and string \"unit\" fields,\n * as parsed by functions.js argType \"size\") into a CSS em value for the\n * current style/scale. `options` gives the current options.\n */\n\nvar units_calculateSize = function calculateSize(sizeValue, options) {\n var scale;\n\n if (sizeValue.unit in ptPerUnit) {\n // Absolute units\n scale = ptPerUnit[sizeValue.unit] // Convert unit to pt\n / options.fontMetrics().ptPerEm // Convert pt to CSS em\n / options.sizeMultiplier; // Unscale to make absolute units\n } else if (sizeValue.unit === \"mu\") {\n // `mu` units scale with scriptstyle/scriptscriptstyle.\n scale = options.fontMetrics().cssEmPerMu;\n } else {\n // Other relative units always refer to the *textstyle* font\n // in the current size.\n var unitOptions;\n\n if (options.style.isTight()) {\n // isTight() means current style is script/scriptscript.\n unitOptions = options.havingStyle(options.style.text());\n } else {\n unitOptions = options;\n } // TODO: In TeX these units are relative to the quad of the current\n // *text* font, e.g. cmr10. KaTeX instead uses values from the\n // comparably-sized *Computer Modern symbol* font. At 10pt, these\n // match. At 7pt and 5pt, they differ: cmr7=1.138894, cmsy7=1.170641;\n // cmr5=1.361133, cmsy5=1.472241. Consider $\\scriptsize a\\kern1emb$.\n // TeX \\showlists shows a kern of 1.13889 * fontsize;\n // KaTeX shows a kern of 1.171 * fontsize.\n\n\n if (sizeValue.unit === \"ex\") {\n scale = unitOptions.fontMetrics().xHeight;\n } else if (sizeValue.unit === \"em\") {\n scale = unitOptions.fontMetrics().quad;\n } else {\n throw new src_ParseError(\"Invalid unit: '\" + sizeValue.unit + \"'\");\n }\n\n if (unitOptions !== options) {\n scale *= unitOptions.sizeMultiplier / options.sizeMultiplier;\n }\n }\n\n return Math.min(sizeValue.number * scale, options.maxSize);\n};\n// CONCATENATED MODULE: ./src/buildCommon.js\n/* eslint no-console:0 */\n\n/**\n * This module contains general functions that can be used for building\n * different kinds of domTree nodes in a consistent manner.\n */\n\n\n\n\n\n\n\n// The following have to be loaded from Main-Italic font, using class mathit\nvar mathitLetters = [\"\\\\imath\", \"ı\", // dotless i\n\"\\\\jmath\", \"ȷ\", // dotless j\n\"\\\\pounds\", \"\\\\mathsterling\", \"\\\\textsterling\", \"£\"];\n/**\n * Looks up the given symbol in fontMetrics, after applying any symbol\n * replacements defined in symbol.js\n */\n\nvar buildCommon_lookupSymbol = function lookupSymbol(value, // TODO(#963): Use a union type for this.\nfontName, mode) {\n // Replace the value with its replaced value from symbol.js\n if (src_symbols[mode][value] && src_symbols[mode][value].replace) {\n value = src_symbols[mode][value].replace;\n }\n\n return {\n value: value,\n metrics: getCharacterMetrics(value, fontName, mode)\n };\n};\n/**\n * Makes a symbolNode after translation via the list of symbols in symbols.js.\n * Correctly pulls out metrics for the character, and optionally takes a list of\n * classes to be attached to the node.\n *\n * TODO: make argument order closer to makeSpan\n * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which\n * should if present come first in `classes`.\n * TODO(#953): Make `options` mandatory and always pass it in.\n */\n\n\nvar buildCommon_makeSymbol = function makeSymbol(value, fontName, mode, options, classes) {\n var lookup = buildCommon_lookupSymbol(value, fontName, mode);\n var metrics = lookup.metrics;\n value = lookup.value;\n var symbolNode;\n\n if (metrics) {\n var italic = metrics.italic;\n\n if (mode === \"text\" || options && options.font === \"mathit\") {\n italic = 0;\n }\n\n symbolNode = new domTree_SymbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, metrics.width, classes);\n } else {\n // TODO(emily): Figure out a good way to only print this in development\n typeof console !== \"undefined\" && console.warn(\"No character metrics \" + (\"for '\" + value + \"' in style '\" + fontName + \"' and mode '\" + mode + \"'\"));\n symbolNode = new domTree_SymbolNode(value, 0, 0, 0, 0, 0, classes);\n }\n\n if (options) {\n symbolNode.maxFontSize = options.sizeMultiplier;\n\n if (options.style.isTight()) {\n symbolNode.classes.push(\"mtight\");\n }\n\n var color = options.getColor();\n\n if (color) {\n symbolNode.style.color = color;\n }\n }\n\n return symbolNode;\n};\n/**\n * Makes a symbol in Main-Regular or AMS-Regular.\n * Used for rel, bin, open, close, inner, and punct.\n */\n\n\nvar buildCommon_mathsym = function mathsym(value, mode, options, classes) {\n if (classes === void 0) {\n classes = [];\n }\n\n // Decide what font to render the symbol in by its entry in the symbols\n // table.\n // Have a special case for when the value = \\ because the \\ is used as a\n // textord in unsupported command errors but cannot be parsed as a regular\n // text ordinal and is therefore not present as a symbol in the symbols\n // table for text, as well as a special case for boldsymbol because it\n // can be used for bold + and -\n if (options.font === \"boldsymbol\" && buildCommon_lookupSymbol(value, \"Main-Bold\", mode).metrics) {\n return buildCommon_makeSymbol(value, \"Main-Bold\", mode, options, classes.concat([\"mathbf\"]));\n } else if (value === \"\\\\\" || src_symbols[mode][value].font === \"main\") {\n return buildCommon_makeSymbol(value, \"Main-Regular\", mode, options, classes);\n } else {\n return buildCommon_makeSymbol(value, \"AMS-Regular\", mode, options, classes.concat([\"amsrm\"]));\n }\n};\n/**\n * Determines which of the two font names (Main-Italic and Math-Italic) and\n * corresponding style tags (maindefault or mathit) to use for default math font,\n * depending on the symbol.\n */\n\n\nvar buildCommon_mathdefault = function mathdefault(value, mode, options, classes) {\n if (/[0-9]/.test(value.charAt(0)) || // glyphs for \\imath and \\jmath do not exist in Math-Italic so we\n // need to use Main-Italic instead\n utils.contains(mathitLetters, value)) {\n return {\n fontName: \"Main-Italic\",\n fontClass: \"mathit\"\n };\n } else {\n return {\n fontName: \"Math-Italic\",\n fontClass: \"mathdefault\"\n };\n }\n};\n/**\n * Determines which of the font names (Main-Italic, Math-Italic, and Caligraphic)\n * and corresponding style tags (mathit, mathdefault, or mathcal) to use for font\n * \"mathnormal\", depending on the symbol. Use this function instead of fontMap for\n * font \"mathnormal\".\n */\n\n\nvar buildCommon_mathnormal = function mathnormal(value, mode, options, classes) {\n if (utils.contains(mathitLetters, value)) {\n return {\n fontName: \"Main-Italic\",\n fontClass: \"mathit\"\n };\n } else if (/[0-9]/.test(value.charAt(0))) {\n return {\n fontName: \"Caligraphic-Regular\",\n fontClass: \"mathcal\"\n };\n } else {\n return {\n fontName: \"Math-Italic\",\n fontClass: \"mathdefault\"\n };\n }\n};\n/**\n * Determines which of the two font names (Main-Bold and Math-BoldItalic) and\n * corresponding style tags (mathbf or boldsymbol) to use for font \"boldsymbol\",\n * depending on the symbol. Use this function instead of fontMap for font\n * \"boldsymbol\".\n */\n\n\nvar boldsymbol = function boldsymbol(value, mode, options, classes) {\n if (buildCommon_lookupSymbol(value, \"Math-BoldItalic\", mode).metrics) {\n return {\n fontName: \"Math-BoldItalic\",\n fontClass: \"boldsymbol\"\n };\n } else {\n // Some glyphs do not exist in Math-BoldItalic so we need to use\n // Main-Bold instead.\n return {\n fontName: \"Main-Bold\",\n fontClass: \"mathbf\"\n };\n }\n};\n/**\n * Makes either a mathord or textord in the correct font and color.\n */\n\n\nvar buildCommon_makeOrd = function makeOrd(group, options, type) {\n var mode = group.mode;\n var text = group.text;\n var classes = [\"mord\"]; // Math mode or Old font (i.e. \\rm)\n\n var isFont = mode === \"math\" || mode === \"text\" && options.font;\n var fontOrFamily = isFont ? options.font : options.fontFamily;\n\n if (text.charCodeAt(0) === 0xD835) {\n // surrogate pairs get special treatment\n var _wideCharacterFont = wide_character_wideCharacterFont(text, mode),\n wideFontName = _wideCharacterFont[0],\n wideFontClass = _wideCharacterFont[1];\n\n return buildCommon_makeSymbol(text, wideFontName, mode, options, classes.concat(wideFontClass));\n } else if (fontOrFamily) {\n var fontName;\n var fontClasses;\n\n if (fontOrFamily === \"boldsymbol\" || fontOrFamily === \"mathnormal\") {\n var fontData = fontOrFamily === \"boldsymbol\" ? boldsymbol(text, mode, options, classes) : buildCommon_mathnormal(text, mode, options, classes);\n fontName = fontData.fontName;\n fontClasses = [fontData.fontClass];\n } else if (utils.contains(mathitLetters, text)) {\n fontName = \"Main-Italic\";\n fontClasses = [\"mathit\"];\n } else if (isFont) {\n fontName = fontMap[fontOrFamily].fontName;\n fontClasses = [fontOrFamily];\n } else {\n fontName = retrieveTextFontName(fontOrFamily, options.fontWeight, options.fontShape);\n fontClasses = [fontOrFamily, options.fontWeight, options.fontShape];\n }\n\n if (buildCommon_lookupSymbol(text, fontName, mode).metrics) {\n return buildCommon_makeSymbol(text, fontName, mode, options, classes.concat(fontClasses));\n } else if (ligatures.hasOwnProperty(text) && fontName.substr(0, 10) === \"Typewriter\") {\n // Deconstruct ligatures in monospace fonts (\\texttt, \\tt).\n var parts = [];\n\n for (var i = 0; i < text.length; i++) {\n parts.push(buildCommon_makeSymbol(text[i], fontName, mode, options, classes.concat(fontClasses)));\n }\n\n return buildCommon_makeFragment(parts);\n }\n } // Makes a symbol in the default font for mathords and textords.\n\n\n if (type === \"mathord\") {\n var fontLookup = buildCommon_mathdefault(text, mode, options, classes);\n return buildCommon_makeSymbol(text, fontLookup.fontName, mode, options, classes.concat([fontLookup.fontClass]));\n } else if (type === \"textord\") {\n var font = src_symbols[mode][text] && src_symbols[mode][text].font;\n\n if (font === \"ams\") {\n var _fontName = retrieveTextFontName(\"amsrm\", options.fontWeight, options.fontShape);\n\n return buildCommon_makeSymbol(text, _fontName, mode, options, classes.concat(\"amsrm\", options.fontWeight, options.fontShape));\n } else if (font === \"main\" || !font) {\n var _fontName2 = retrieveTextFontName(\"textrm\", options.fontWeight, options.fontShape);\n\n return buildCommon_makeSymbol(text, _fontName2, mode, options, classes.concat(options.fontWeight, options.fontShape));\n } else {\n // fonts added by plugins\n var _fontName3 = retrieveTextFontName(font, options.fontWeight, options.fontShape); // We add font name as a css class\n\n\n return buildCommon_makeSymbol(text, _fontName3, mode, options, classes.concat(_fontName3, options.fontWeight, options.fontShape));\n }\n } else {\n throw new Error(\"unexpected type: \" + type + \" in makeOrd\");\n }\n};\n/**\n * Returns true if subsequent symbolNodes have the same classes, skew, maxFont,\n * and styles.\n */\n\n\nvar buildCommon_canCombine = function canCombine(prev, next) {\n if (createClass(prev.classes) !== createClass(next.classes) || prev.skew !== next.skew || prev.maxFontSize !== next.maxFontSize) {\n return false;\n }\n\n for (var style in prev.style) {\n if (prev.style.hasOwnProperty(style) && prev.style[style] !== next.style[style]) {\n return false;\n }\n }\n\n for (var _style in next.style) {\n if (next.style.hasOwnProperty(_style) && prev.style[_style] !== next.style[_style]) {\n return false;\n }\n }\n\n return true;\n};\n/**\n * Combine consequetive domTree.symbolNodes into a single symbolNode.\n * Note: this function mutates the argument.\n */\n\n\nvar buildCommon_tryCombineChars = function tryCombineChars(chars) {\n for (var i = 0; i < chars.length - 1; i++) {\n var prev = chars[i];\n var next = chars[i + 1];\n\n if (prev instanceof domTree_SymbolNode && next instanceof domTree_SymbolNode && buildCommon_canCombine(prev, next)) {\n prev.text += next.text;\n prev.height = Math.max(prev.height, next.height);\n prev.depth = Math.max(prev.depth, next.depth); // Use the last character's italic correction since we use\n // it to add padding to the right of the span created from\n // the combined characters.\n\n prev.italic = next.italic;\n chars.splice(i + 1, 1);\n i--;\n }\n }\n\n return chars;\n};\n/**\n * Calculate the height, depth, and maxFontSize of an element based on its\n * children.\n */\n\n\nvar sizeElementFromChildren = function sizeElementFromChildren(elem) {\n var height = 0;\n var depth = 0;\n var maxFontSize = 0;\n\n for (var i = 0; i < elem.children.length; i++) {\n var child = elem.children[i];\n\n if (child.height > height) {\n height = child.height;\n }\n\n if (child.depth > depth) {\n depth = child.depth;\n }\n\n if (child.maxFontSize > maxFontSize) {\n maxFontSize = child.maxFontSize;\n }\n }\n\n elem.height = height;\n elem.depth = depth;\n elem.maxFontSize = maxFontSize;\n};\n/**\n * Makes a span with the given list of classes, list of children, and options.\n *\n * TODO(#953): Ensure that `options` is always provided (currently some call\n * sites don't pass it) and make the type below mandatory.\n * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which\n * should if present come first in `classes`.\n */\n\n\nvar buildCommon_makeSpan = function makeSpan(classes, children, options, style) {\n var span = new domTree_Span(classes, children, options, style);\n sizeElementFromChildren(span);\n return span;\n}; // SVG one is simpler -- doesn't require height, depth, max-font setting.\n// This is also a separate method for typesafety.\n\n\nvar buildCommon_makeSvgSpan = function makeSvgSpan(classes, children, options, style) {\n return new domTree_Span(classes, children, options, style);\n};\n\nvar makeLineSpan = function makeLineSpan(className, options, thickness) {\n var line = buildCommon_makeSpan([className], [], options);\n line.height = Math.max(thickness || options.fontMetrics().defaultRuleThickness, options.minRuleThickness);\n line.style.borderBottomWidth = line.height + \"em\";\n line.maxFontSize = 1.0;\n return line;\n};\n/**\n * Makes an anchor with the given href, list of classes, list of children,\n * and options.\n */\n\n\nvar buildCommon_makeAnchor = function makeAnchor(href, classes, children, options) {\n var anchor = new domTree_Anchor(href, classes, children, options);\n sizeElementFromChildren(anchor);\n return anchor;\n};\n/**\n * Makes a document fragment with the given list of children.\n */\n\n\nvar buildCommon_makeFragment = function makeFragment(children) {\n var fragment = new tree_DocumentFragment(children);\n sizeElementFromChildren(fragment);\n return fragment;\n};\n/**\n * Wraps group in a span if it's a document fragment, allowing to apply classes\n * and styles\n */\n\n\nvar buildCommon_wrapFragment = function wrapFragment(group, options) {\n if (group instanceof tree_DocumentFragment) {\n return buildCommon_makeSpan([], [group], options);\n }\n\n return group;\n}; // These are exact object types to catch typos in the names of the optional fields.\n\n\n// Computes the updated `children` list and the overall depth.\n//\n// This helper function for makeVList makes it easier to enforce type safety by\n// allowing early exits (returns) in the logic.\nvar getVListChildrenAndDepth = function getVListChildrenAndDepth(params) {\n if (params.positionType === \"individualShift\") {\n var oldChildren = params.children;\n var children = [oldChildren[0]]; // Add in kerns to the list of params.children to get each element to be\n // shifted to the correct specified shift\n\n var _depth = -oldChildren[0].shift - oldChildren[0].elem.depth;\n\n var currPos = _depth;\n\n for (var i = 1; i < oldChildren.length; i++) {\n var diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth;\n var size = diff - (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth);\n currPos = currPos + diff;\n children.push({\n type: \"kern\",\n size: size\n });\n children.push(oldChildren[i]);\n }\n\n return {\n children: children,\n depth: _depth\n };\n }\n\n var depth;\n\n if (params.positionType === \"top\") {\n // We always start at the bottom, so calculate the bottom by adding up\n // all the sizes\n var bottom = params.positionData;\n\n for (var _i = 0; _i < params.children.length; _i++) {\n var child = params.children[_i];\n bottom -= child.type === \"kern\" ? child.size : child.elem.height + child.elem.depth;\n }\n\n depth = bottom;\n } else if (params.positionType === \"bottom\") {\n depth = -params.positionData;\n } else {\n var firstChild = params.children[0];\n\n if (firstChild.type !== \"elem\") {\n throw new Error('First child must have type \"elem\".');\n }\n\n if (params.positionType === \"shift\") {\n depth = -firstChild.elem.depth - params.positionData;\n } else if (params.positionType === \"firstBaseline\") {\n depth = -firstChild.elem.depth;\n } else {\n throw new Error(\"Invalid positionType \" + params.positionType + \".\");\n }\n }\n\n return {\n children: params.children,\n depth: depth\n };\n};\n/**\n * Makes a vertical list by stacking elements and kerns on top of each other.\n * Allows for many different ways of specifying the positioning method.\n *\n * See VListParam documentation above.\n */\n\n\nvar buildCommon_makeVList = function makeVList(params, options) {\n var _getVListChildrenAndD = getVListChildrenAndDepth(params),\n children = _getVListChildrenAndD.children,\n depth = _getVListChildrenAndD.depth; // Create a strut that is taller than any list item. The strut is added to\n // each item, where it will determine the item's baseline. Since it has\n // `overflow:hidden`, the strut's top edge will sit on the item's line box's\n // top edge and the strut's bottom edge will sit on the item's baseline,\n // with no additional line-height spacing. This allows the item baseline to\n // be positioned precisely without worrying about font ascent and\n // line-height.\n\n\n var pstrutSize = 0;\n\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n\n if (child.type === \"elem\") {\n var elem = child.elem;\n pstrutSize = Math.max(pstrutSize, elem.maxFontSize, elem.height);\n }\n }\n\n pstrutSize += 2;\n var pstrut = buildCommon_makeSpan([\"pstrut\"], []);\n pstrut.style.height = pstrutSize + \"em\"; // Create a new list of actual children at the correct offsets\n\n var realChildren = [];\n var minPos = depth;\n var maxPos = depth;\n var currPos = depth;\n\n for (var _i2 = 0; _i2 < children.length; _i2++) {\n var _child = children[_i2];\n\n if (_child.type === \"kern\") {\n currPos += _child.size;\n } else {\n var _elem = _child.elem;\n var classes = _child.wrapperClasses || [];\n var style = _child.wrapperStyle || {};\n var childWrap = buildCommon_makeSpan(classes, [pstrut, _elem], undefined, style);\n childWrap.style.top = -pstrutSize - currPos - _elem.depth + \"em\";\n\n if (_child.marginLeft) {\n childWrap.style.marginLeft = _child.marginLeft;\n }\n\n if (_child.marginRight) {\n childWrap.style.marginRight = _child.marginRight;\n }\n\n realChildren.push(childWrap);\n currPos += _elem.height + _elem.depth;\n }\n\n minPos = Math.min(minPos, currPos);\n maxPos = Math.max(maxPos, currPos);\n } // The vlist contents go in a table-cell with `vertical-align:bottom`.\n // This cell's bottom edge will determine the containing table's baseline\n // without overly expanding the containing line-box.\n\n\n var vlist = buildCommon_makeSpan([\"vlist\"], realChildren);\n vlist.style.height = maxPos + \"em\"; // A second row is used if necessary to represent the vlist's depth.\n\n var rows;\n\n if (minPos < 0) {\n // We will define depth in an empty span with display: table-cell.\n // It should render with the height that we define. But Chrome, in\n // contenteditable mode only, treats that span as if it contains some\n // text content. And that min-height over-rides our desired height.\n // So we put another empty span inside the depth strut span.\n var emptySpan = buildCommon_makeSpan([], []);\n var depthStrut = buildCommon_makeSpan([\"vlist\"], [emptySpan]);\n depthStrut.style.height = -minPos + \"em\"; // Safari wants the first row to have inline content; otherwise it\n // puts the bottom of the *second* row on the baseline.\n\n var topStrut = buildCommon_makeSpan([\"vlist-s\"], [new domTree_SymbolNode(\"\\u200B\")]);\n rows = [buildCommon_makeSpan([\"vlist-r\"], [vlist, topStrut]), buildCommon_makeSpan([\"vlist-r\"], [depthStrut])];\n } else {\n rows = [buildCommon_makeSpan([\"vlist-r\"], [vlist])];\n }\n\n var vtable = buildCommon_makeSpan([\"vlist-t\"], rows);\n\n if (rows.length === 2) {\n vtable.classes.push(\"vlist-t2\");\n }\n\n vtable.height = maxPos;\n vtable.depth = -minPos;\n return vtable;\n}; // Glue is a concept from TeX which is a flexible space between elements in\n// either a vertical or horizontal list. In KaTeX, at least for now, it's\n// static space between elements in a horizontal layout.\n\n\nvar buildCommon_makeGlue = function makeGlue(measurement, options) {\n // Make an empty span for the space\n var rule = buildCommon_makeSpan([\"mspace\"], [], options);\n var size = units_calculateSize(measurement, options);\n rule.style.marginRight = size + \"em\";\n return rule;\n}; // Takes font options, and returns the appropriate fontLookup name\n\n\nvar retrieveTextFontName = function retrieveTextFontName(fontFamily, fontWeight, fontShape) {\n var baseFontName = \"\";\n\n switch (fontFamily) {\n case \"amsrm\":\n baseFontName = \"AMS\";\n break;\n\n case \"textrm\":\n baseFontName = \"Main\";\n break;\n\n case \"textsf\":\n baseFontName = \"SansSerif\";\n break;\n\n case \"texttt\":\n baseFontName = \"Typewriter\";\n break;\n\n default:\n baseFontName = fontFamily;\n // use fonts added by a plugin\n }\n\n var fontStylesName;\n\n if (fontWeight === \"textbf\" && fontShape === \"textit\") {\n fontStylesName = \"BoldItalic\";\n } else if (fontWeight === \"textbf\") {\n fontStylesName = \"Bold\";\n } else if (fontWeight === \"textit\") {\n fontStylesName = \"Italic\";\n } else {\n fontStylesName = \"Regular\";\n }\n\n return baseFontName + \"-\" + fontStylesName;\n};\n/**\n * Maps TeX font commands to objects containing:\n * - variant: string used for \"mathvariant\" attribute in buildMathML.js\n * - fontName: the \"style\" parameter to fontMetrics.getCharacterMetrics\n */\n// A map between tex font commands an MathML mathvariant attribute values\n\n\nvar fontMap = {\n // styles\n \"mathbf\": {\n variant: \"bold\",\n fontName: \"Main-Bold\"\n },\n \"mathrm\": {\n variant: \"normal\",\n fontName: \"Main-Regular\"\n },\n \"textit\": {\n variant: \"italic\",\n fontName: \"Main-Italic\"\n },\n \"mathit\": {\n variant: \"italic\",\n fontName: \"Main-Italic\"\n },\n // Default math font, \"mathnormal\" and \"boldsymbol\" are missing because they\n // require the use of several fonts: Main-Italic and Math-Italic for default\n // math font, Main-Italic, Math-Italic, Caligraphic for \"mathnormal\", and\n // Math-BoldItalic and Main-Bold for \"boldsymbol\". This is handled by a\n // special case in makeOrd which ends up calling mathdefault, mathnormal,\n // and boldsymbol.\n // families\n \"mathbb\": {\n variant: \"double-struck\",\n fontName: \"AMS-Regular\"\n },\n \"mathcal\": {\n variant: \"script\",\n fontName: \"Caligraphic-Regular\"\n },\n \"mathfrak\": {\n variant: \"fraktur\",\n fontName: \"Fraktur-Regular\"\n },\n \"mathscr\": {\n variant: \"script\",\n fontName: \"Script-Regular\"\n },\n \"mathsf\": {\n variant: \"sans-serif\",\n fontName: \"SansSerif-Regular\"\n },\n \"mathtt\": {\n variant: \"monospace\",\n fontName: \"Typewriter-Regular\"\n }\n};\nvar svgData = {\n // path, width, height\n vec: [\"vec\", 0.471, 0.714],\n // values from the font glyph\n oiintSize1: [\"oiintSize1\", 0.957, 0.499],\n // oval to overlay the integrand\n oiintSize2: [\"oiintSize2\", 1.472, 0.659],\n oiiintSize1: [\"oiiintSize1\", 1.304, 0.499],\n oiiintSize2: [\"oiiintSize2\", 1.98, 0.659]\n};\n\nvar buildCommon_staticSvg = function staticSvg(value, options) {\n // Create a span with inline SVG for the element.\n var _svgData$value = svgData[value],\n pathName = _svgData$value[0],\n width = _svgData$value[1],\n height = _svgData$value[2];\n var path = new domTree_PathNode(pathName);\n var svgNode = new SvgNode([path], {\n \"width\": width + \"em\",\n \"height\": height + \"em\",\n // Override CSS rule `.katex svg { width: 100% }`\n \"style\": \"width:\" + width + \"em\",\n \"viewBox\": \"0 0 \" + 1000 * width + \" \" + 1000 * height,\n \"preserveAspectRatio\": \"xMinYMin\"\n });\n var span = buildCommon_makeSvgSpan([\"overlay\"], [svgNode], options);\n span.height = height;\n span.style.height = height + \"em\";\n span.style.width = width + \"em\";\n return span;\n};\n\n/* harmony default export */ var buildCommon = ({\n fontMap: fontMap,\n makeSymbol: buildCommon_makeSymbol,\n mathsym: buildCommon_mathsym,\n makeSpan: buildCommon_makeSpan,\n makeSvgSpan: buildCommon_makeSvgSpan,\n makeLineSpan: makeLineSpan,\n makeAnchor: buildCommon_makeAnchor,\n makeFragment: buildCommon_makeFragment,\n wrapFragment: buildCommon_wrapFragment,\n makeVList: buildCommon_makeVList,\n makeOrd: buildCommon_makeOrd,\n makeGlue: buildCommon_makeGlue,\n staticSvg: buildCommon_staticSvg,\n svgData: svgData,\n tryCombineChars: buildCommon_tryCombineChars\n});\n// CONCATENATED MODULE: ./src/parseNode.js\n\n\n/**\n * Asserts that the node is of the given type and returns it with stricter\n * typing. Throws if the node's type does not match.\n */\nfunction assertNodeType(node, type) {\n var typedNode = checkNodeType(node, type);\n\n if (!typedNode) {\n throw new Error(\"Expected node of type \" + type + \", but got \" + (node ? \"node of type \" + node.type : String(node)));\n } // $FlowFixMe: Unsure why.\n\n\n return typedNode;\n}\n/**\n * Returns the node more strictly typed iff it is of the given type. Otherwise,\n * returns null.\n */\n\nfunction checkNodeType(node, type) {\n if (node && node.type === type) {\n // The definition of ParseNode doesn't communicate to flow that\n // `type: TYPE` (as that's not explicitly mentioned anywhere), though that\n // happens to be true for all our value types.\n // $FlowFixMe\n return node;\n }\n\n return null;\n}\n/**\n * Asserts that the node is of the given type and returns it with stricter\n * typing. Throws if the node's type does not match.\n */\n\nfunction assertAtomFamily(node, family) {\n var typedNode = checkAtomFamily(node, family);\n\n if (!typedNode) {\n throw new Error(\"Expected node of type \\\"atom\\\" and family \\\"\" + family + \"\\\", but got \" + (node ? node.type === \"atom\" ? \"atom of family \" + node.family : \"node of type \" + node.type : String(node)));\n }\n\n return typedNode;\n}\n/**\n * Returns the node more strictly typed iff it is of the given type. Otherwise,\n * returns null.\n */\n\nfunction checkAtomFamily(node, family) {\n return node && node.type === \"atom\" && node.family === family ? node : null;\n}\n/**\n * Returns the node more strictly typed iff it is of the given type. Otherwise,\n * returns null.\n */\n\nfunction assertSymbolNodeType(node) {\n var typedNode = checkSymbolNodeType(node);\n\n if (!typedNode) {\n throw new Error(\"Expected node of symbol group type, but got \" + (node ? \"node of type \" + node.type : String(node)));\n }\n\n return typedNode;\n}\n/**\n * Returns the node more strictly typed iff it is of the given type. Otherwise,\n * returns null.\n */\n\nfunction checkSymbolNodeType(node) {\n if (node && (node.type === \"atom\" || NON_ATOMS.hasOwnProperty(node.type))) {\n // $FlowFixMe\n return node;\n }\n\n return null;\n}\n// CONCATENATED MODULE: ./src/spacingData.js\n/**\n * Describes spaces between different classes of atoms.\n */\nvar thinspace = {\n number: 3,\n unit: \"mu\"\n};\nvar mediumspace = {\n number: 4,\n unit: \"mu\"\n};\nvar thickspace = {\n number: 5,\n unit: \"mu\"\n}; // Making the type below exact with all optional fields doesn't work due to\n// - https://github.com/facebook/flow/issues/4582\n// - https://github.com/facebook/flow/issues/5688\n// However, since *all* fields are optional, $Shape<> works as suggested in 5688\n// above.\n\n// Spacing relationships for display and text styles\nvar spacings = {\n mord: {\n mop: thinspace,\n mbin: mediumspace,\n mrel: thickspace,\n minner: thinspace\n },\n mop: {\n mord: thinspace,\n mop: thinspace,\n mrel: thickspace,\n minner: thinspace\n },\n mbin: {\n mord: mediumspace,\n mop: mediumspace,\n mopen: mediumspace,\n minner: mediumspace\n },\n mrel: {\n mord: thickspace,\n mop: thickspace,\n mopen: thickspace,\n minner: thickspace\n },\n mopen: {},\n mclose: {\n mop: thinspace,\n mbin: mediumspace,\n mrel: thickspace,\n minner: thinspace\n },\n mpunct: {\n mord: thinspace,\n mop: thinspace,\n mrel: thickspace,\n mopen: thinspace,\n mclose: thinspace,\n mpunct: thinspace,\n minner: thinspace\n },\n minner: {\n mord: thinspace,\n mop: thinspace,\n mbin: mediumspace,\n mrel: thickspace,\n mopen: thinspace,\n mpunct: thinspace,\n minner: thinspace\n }\n}; // Spacing relationships for script and scriptscript styles\n\nvar tightSpacings = {\n mord: {\n mop: thinspace\n },\n mop: {\n mord: thinspace,\n mop: thinspace\n },\n mbin: {},\n mrel: {},\n mopen: {},\n mclose: {\n mop: thinspace\n },\n mpunct: {},\n minner: {\n mop: thinspace\n }\n};\n// CONCATENATED MODULE: ./src/defineFunction.js\n\n\n/**\n * All registered functions.\n * `functions.js` just exports this same dictionary again and makes it public.\n * `Parser.js` requires this dictionary.\n */\nvar _functions = {};\n/**\n * All HTML builders. Should be only used in the `define*` and the `build*ML`\n * functions.\n */\n\nvar _htmlGroupBuilders = {};\n/**\n * All MathML builders. Should be only used in the `define*` and the `build*ML`\n * functions.\n */\n\nvar _mathmlGroupBuilders = {};\nfunction defineFunction(_ref) {\n var type = _ref.type,\n names = _ref.names,\n props = _ref.props,\n handler = _ref.handler,\n htmlBuilder = _ref.htmlBuilder,\n mathmlBuilder = _ref.mathmlBuilder;\n // Set default values of functions\n var data = {\n type: type,\n numArgs: props.numArgs,\n argTypes: props.argTypes,\n greediness: props.greediness === undefined ? 1 : props.greediness,\n allowedInText: !!props.allowedInText,\n allowedInMath: props.allowedInMath === undefined ? true : props.allowedInMath,\n numOptionalArgs: props.numOptionalArgs || 0,\n infix: !!props.infix,\n handler: handler\n };\n\n for (var i = 0; i < names.length; ++i) {\n _functions[names[i]] = data;\n }\n\n if (type) {\n if (htmlBuilder) {\n _htmlGroupBuilders[type] = htmlBuilder;\n }\n\n if (mathmlBuilder) {\n _mathmlGroupBuilders[type] = mathmlBuilder;\n }\n }\n}\n/**\n * Use this to register only the HTML and MathML builders for a function (e.g.\n * if the function's ParseNode is generated in Parser.js rather than via a\n * stand-alone handler provided to `defineFunction`).\n */\n\nfunction defineFunctionBuilders(_ref2) {\n var type = _ref2.type,\n htmlBuilder = _ref2.htmlBuilder,\n mathmlBuilder = _ref2.mathmlBuilder;\n defineFunction({\n type: type,\n names: [],\n props: {\n numArgs: 0\n },\n handler: function handler() {\n throw new Error('Should never be called.');\n },\n htmlBuilder: htmlBuilder,\n mathmlBuilder: mathmlBuilder\n });\n} // Since the corresponding buildHTML/buildMathML function expects a\n// list of elements, we normalize for different kinds of arguments\n\nvar defineFunction_ordargument = function ordargument(arg) {\n var node = checkNodeType(arg, \"ordgroup\");\n return node ? node.body : [arg];\n};\n// CONCATENATED MODULE: ./src/buildHTML.js\n/**\n * This file does the main work of building a domTree structure from a parse\n * tree. The entry point is the `buildHTML` function, which takes a parse tree.\n * Then, the buildExpression, buildGroup, and various groupBuilders functions\n * are called, to produce a final HTML tree.\n */\n\n\n\n\n\n\n\n\n\nvar buildHTML_makeSpan = buildCommon.makeSpan; // Binary atoms (first class `mbin`) change into ordinary atoms (`mord`)\n// depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6,\n// and the text before Rule 19.\n\nvar binLeftCanceller = [\"leftmost\", \"mbin\", \"mopen\", \"mrel\", \"mop\", \"mpunct\"];\nvar binRightCanceller = [\"rightmost\", \"mrel\", \"mclose\", \"mpunct\"];\nvar styleMap = {\n \"display\": src_Style.DISPLAY,\n \"text\": src_Style.TEXT,\n \"script\": src_Style.SCRIPT,\n \"scriptscript\": src_Style.SCRIPTSCRIPT\n};\nvar DomEnum = {\n mord: \"mord\",\n mop: \"mop\",\n mbin: \"mbin\",\n mrel: \"mrel\",\n mopen: \"mopen\",\n mclose: \"mclose\",\n mpunct: \"mpunct\",\n minner: \"minner\"\n};\n\n/**\n * Take a list of nodes, build them in order, and return a list of the built\n * nodes. documentFragments are flattened into their contents, so the\n * returned list contains no fragments. `isRealGroup` is true if `expression`\n * is a real group (no atoms will be added on either side), as opposed to\n * a partial group (e.g. one created by \\color). `surrounding` is an array\n * consisting type of nodes that will be added to the left and right.\n */\nvar buildHTML_buildExpression = function buildExpression(expression, options, isRealGroup, surrounding) {\n if (surrounding === void 0) {\n surrounding = [null, null];\n }\n\n // Parse expressions into `groups`.\n var groups = [];\n\n for (var i = 0; i < expression.length; i++) {\n var output = buildHTML_buildGroup(expression[i], options);\n\n if (output instanceof tree_DocumentFragment) {\n var children = output.children;\n groups.push.apply(groups, children);\n } else {\n groups.push(output);\n }\n } // If `expression` is a partial group, let the parent handle spacings\n // to avoid processing groups multiple times.\n\n\n if (!isRealGroup) {\n return groups;\n }\n\n var glueOptions = options;\n\n if (expression.length === 1) {\n var node = checkNodeType(expression[0], \"sizing\") || checkNodeType(expression[0], \"styling\");\n\n if (!node) {// No match.\n } else if (node.type === \"sizing\") {\n glueOptions = options.havingSize(node.size);\n } else if (node.type === \"styling\") {\n glueOptions = options.havingStyle(styleMap[node.style]);\n }\n } // Dummy spans for determining spacings between surrounding atoms.\n // If `expression` has no atoms on the left or right, class \"leftmost\"\n // or \"rightmost\", respectively, is used to indicate it.\n\n\n var dummyPrev = buildHTML_makeSpan([surrounding[0] || \"leftmost\"], [], options);\n var dummyNext = buildHTML_makeSpan([surrounding[1] || \"rightmost\"], [], options); // TODO: These code assumes that a node's math class is the first element\n // of its `classes` array. A later cleanup should ensure this, for\n // instance by changing the signature of `makeSpan`.\n // Before determining what spaces to insert, perform bin cancellation.\n // Binary operators change to ordinary symbols in some contexts.\n\n traverseNonSpaceNodes(groups, function (node, prev) {\n var prevType = prev.classes[0];\n var type = node.classes[0];\n\n if (prevType === \"mbin\" && utils.contains(binRightCanceller, type)) {\n prev.classes[0] = \"mord\";\n } else if (type === \"mbin\" && utils.contains(binLeftCanceller, prevType)) {\n node.classes[0] = \"mord\";\n }\n }, {\n node: dummyPrev\n }, dummyNext);\n traverseNonSpaceNodes(groups, function (node, prev) {\n var prevType = getTypeOfDomTree(prev);\n var type = getTypeOfDomTree(node); // 'mtight' indicates that the node is script or scriptscript style.\n\n var space = prevType && type ? node.hasClass(\"mtight\") ? tightSpacings[prevType][type] : spacings[prevType][type] : null;\n\n if (space) {\n // Insert glue (spacing) after the `prev`.\n return buildCommon.makeGlue(space, glueOptions);\n }\n }, {\n node: dummyPrev\n }, dummyNext);\n return groups;\n}; // Depth-first traverse non-space `nodes`, calling `callback` with the current and\n// previous node as arguments, optionally returning a node to insert after the\n// previous node. `prev` is an object with the previous node and `insertAfter`\n// function to insert after it. `next` is a node that will be added to the right.\n// Used for bin cancellation and inserting spacings.\n\nvar traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, prev, next) {\n if (next) {\n // temporarily append the right node, if exists\n nodes.push(next);\n }\n\n var i = 0;\n\n for (; i < nodes.length; i++) {\n var node = nodes[i];\n var partialGroup = buildHTML_checkPartialGroup(node);\n\n if (partialGroup) {\n // Recursive DFS\n // $FlowFixMe: make nodes a $ReadOnlyArray by returning a new array\n traverseNonSpaceNodes(partialGroup.children, callback, prev);\n continue;\n } // Ignore explicit spaces (e.g., \\;, \\,) when determining what implicit\n // spacing should go between atoms of different classes\n\n\n if (node.classes[0] === \"mspace\") {\n continue;\n }\n\n var result = callback(node, prev.node);\n\n if (result) {\n if (prev.insertAfter) {\n prev.insertAfter(result);\n } else {\n // insert at front\n nodes.unshift(result);\n i++;\n }\n }\n\n prev.node = node;\n\n prev.insertAfter = function (index) {\n return function (n) {\n nodes.splice(index + 1, 0, n);\n i++;\n };\n }(i);\n }\n\n if (next) {\n nodes.pop();\n }\n}; // Check if given node is a partial group, i.e., does not affect spacing around.\n\n\nvar buildHTML_checkPartialGroup = function checkPartialGroup(node) {\n if (node instanceof tree_DocumentFragment || node instanceof domTree_Anchor) {\n return node;\n }\n\n return null;\n}; // Return the outermost node of a domTree.\n\n\nvar getOutermostNode = function getOutermostNode(node, side) {\n var partialGroup = buildHTML_checkPartialGroup(node);\n\n if (partialGroup) {\n var children = partialGroup.children;\n\n if (children.length) {\n if (side === \"right\") {\n return getOutermostNode(children[children.length - 1], \"right\");\n } else if (side === \"left\") {\n return getOutermostNode(children[0], \"left\");\n }\n }\n }\n\n return node;\n}; // Return math atom class (mclass) of a domTree.\n// If `side` is given, it will get the type of the outermost node at given side.\n\n\nvar getTypeOfDomTree = function getTypeOfDomTree(node, side) {\n if (!node) {\n return null;\n }\n\n if (side) {\n node = getOutermostNode(node, side);\n } // This makes a lot of assumptions as to where the type of atom\n // appears. We should do a better job of enforcing this.\n\n\n return DomEnum[node.classes[0]] || null;\n};\nvar makeNullDelimiter = function makeNullDelimiter(options, classes) {\n var moreClasses = [\"nulldelimiter\"].concat(options.baseSizingClasses());\n return buildHTML_makeSpan(classes.concat(moreClasses));\n};\n/**\n * buildGroup is the function that takes a group and calls the correct groupType\n * function for it. It also handles the interaction of size and style changes\n * between parents and children.\n */\n\nvar buildHTML_buildGroup = function buildGroup(group, options, baseOptions) {\n if (!group) {\n return buildHTML_makeSpan();\n }\n\n if (_htmlGroupBuilders[group.type]) {\n // Call the groupBuilders function\n var groupNode = _htmlGroupBuilders[group.type](group, options); // If the size changed between the parent and the current group, account\n // for that size difference.\n\n if (baseOptions && options.size !== baseOptions.size) {\n groupNode = buildHTML_makeSpan(options.sizingClasses(baseOptions), [groupNode], options);\n var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier;\n groupNode.height *= multiplier;\n groupNode.depth *= multiplier;\n }\n\n return groupNode;\n } else {\n throw new src_ParseError(\"Got group of unknown type: '\" + group.type + \"'\");\n }\n};\n/**\n * Combine an array of HTML DOM nodes (e.g., the output of `buildExpression`)\n * into an unbreakable HTML node of class .base, with proper struts to\n * guarantee correct vertical extent. `buildHTML` calls this repeatedly to\n * make up the entire expression as a sequence of unbreakable units.\n */\n\nfunction buildHTMLUnbreakable(children, options) {\n // Compute height and depth of this chunk.\n var body = buildHTML_makeSpan([\"base\"], children, options); // Add strut, which ensures that the top of the HTML element falls at\n // the height of the expression, and the bottom of the HTML element\n // falls at the depth of the expression.\n // We used to have separate top and bottom struts, where the bottom strut\n // would like to use `vertical-align: top`, but in IE 9 this lowers the\n // baseline of the box to the bottom of this strut (instead of staying in\n // the normal place) so we use an absolute value for vertical-align instead.\n\n var strut = buildHTML_makeSpan([\"strut\"]);\n strut.style.height = body.height + body.depth + \"em\";\n strut.style.verticalAlign = -body.depth + \"em\";\n body.children.unshift(strut);\n return body;\n}\n/**\n * Take an entire parse tree, and build it into an appropriate set of HTML\n * nodes.\n */\n\n\nfunction buildHTML(tree, options) {\n // Strip off outer tag wrapper for processing below.\n var tag = null;\n\n if (tree.length === 1 && tree[0].type === \"tag\") {\n tag = tree[0].tag;\n tree = tree[0].body;\n } // Build the expression contained in the tree\n\n\n var expression = buildHTML_buildExpression(tree, options, true);\n var children = []; // Create one base node for each chunk between potential line breaks.\n // The TeXBook [p.173] says \"A formula will be broken only after a\n // relation symbol like $=$ or $<$ or $\\rightarrow$, or after a binary\n // operation symbol like $+$ or $-$ or $\\times$, where the relation or\n // binary operation is on the ``outer level'' of the formula (i.e., not\n // enclosed in {...} and not part of an \\over construction).\"\n\n var parts = [];\n\n for (var i = 0; i < expression.length; i++) {\n parts.push(expression[i]);\n\n if (expression[i].hasClass(\"mbin\") || expression[i].hasClass(\"mrel\") || expression[i].hasClass(\"allowbreak\")) {\n // Put any post-operator glue on same line as operator.\n // Watch for \\nobreak along the way, and stop at \\newline.\n var nobreak = false;\n\n while (i < expression.length - 1 && expression[i + 1].hasClass(\"mspace\") && !expression[i + 1].hasClass(\"newline\")) {\n i++;\n parts.push(expression[i]);\n\n if (expression[i].hasClass(\"nobreak\")) {\n nobreak = true;\n }\n } // Don't allow break if \\nobreak among the post-operator glue.\n\n\n if (!nobreak) {\n children.push(buildHTMLUnbreakable(parts, options));\n parts = [];\n }\n } else if (expression[i].hasClass(\"newline\")) {\n // Write the line except the newline\n parts.pop();\n\n if (parts.length > 0) {\n children.push(buildHTMLUnbreakable(parts, options));\n parts = [];\n } // Put the newline at the top level\n\n\n children.push(expression[i]);\n }\n }\n\n if (parts.length > 0) {\n children.push(buildHTMLUnbreakable(parts, options));\n } // Now, if there was a tag, build it too and append it as a final child.\n\n\n var tagChild;\n\n if (tag) {\n tagChild = buildHTMLUnbreakable(buildHTML_buildExpression(tag, options, true));\n tagChild.classes = [\"tag\"];\n children.push(tagChild);\n }\n\n var htmlNode = buildHTML_makeSpan([\"katex-html\"], children);\n htmlNode.setAttribute(\"aria-hidden\", \"true\"); // Adjust the strut of the tag to be the maximum height of all children\n // (the height of the enclosing htmlNode) for proper vertical alignment.\n\n if (tagChild) {\n var strut = tagChild.children[0];\n strut.style.height = htmlNode.height + htmlNode.depth + \"em\";\n strut.style.verticalAlign = -htmlNode.depth + \"em\";\n }\n\n return htmlNode;\n}\n// CONCATENATED MODULE: ./src/mathMLTree.js\n/**\n * These objects store data about MathML nodes. This is the MathML equivalent\n * of the types in domTree.js. Since MathML handles its own rendering, and\n * since we're mainly using MathML to improve accessibility, we don't manage\n * any of the styling state that the plain DOM nodes do.\n *\n * The `toNode` and `toMarkup` functions work simlarly to how they do in\n * domTree.js, creating namespaced DOM nodes and HTML text markup respectively.\n */\n\n\nfunction newDocumentFragment(children) {\n return new tree_DocumentFragment(children);\n}\n/**\n * This node represents a general purpose MathML node of any type. The\n * constructor requires the type of node to create (for example, `\"mo\"` or\n * `\"mspace\"`, corresponding to `` and `` tags).\n */\n\nvar mathMLTree_MathNode =\n/*#__PURE__*/\nfunction () {\n function MathNode(type, children) {\n this.type = void 0;\n this.attributes = void 0;\n this.children = void 0;\n this.type = type;\n this.attributes = {};\n this.children = children || [];\n }\n /**\n * Sets an attribute on a MathML node. MathML depends on attributes to convey a\n * semantic content, so this is used heavily.\n */\n\n\n var _proto = MathNode.prototype;\n\n _proto.setAttribute = function setAttribute(name, value) {\n this.attributes[name] = value;\n }\n /**\n * Gets an attribute on a MathML node.\n */\n ;\n\n _proto.getAttribute = function getAttribute(name) {\n return this.attributes[name];\n }\n /**\n * Converts the math node into a MathML-namespaced DOM element.\n */\n ;\n\n _proto.toNode = function toNode() {\n var node = document.createElementNS(\"http://www.w3.org/1998/Math/MathML\", this.type);\n\n for (var attr in this.attributes) {\n if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {\n node.setAttribute(attr, this.attributes[attr]);\n }\n }\n\n for (var i = 0; i < this.children.length; i++) {\n node.appendChild(this.children[i].toNode());\n }\n\n return node;\n }\n /**\n * Converts the math node into an HTML markup string.\n */\n ;\n\n _proto.toMarkup = function toMarkup() {\n var markup = \"<\" + this.type; // Add the attributes\n\n for (var attr in this.attributes) {\n if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {\n markup += \" \" + attr + \"=\\\"\";\n markup += utils.escape(this.attributes[attr]);\n markup += \"\\\"\";\n }\n }\n\n markup += \">\";\n\n for (var i = 0; i < this.children.length; i++) {\n markup += this.children[i].toMarkup();\n }\n\n markup += \"\";\n return markup;\n }\n /**\n * Converts the math node into a string, similar to innerText, but escaped.\n */\n ;\n\n _proto.toText = function toText() {\n return this.children.map(function (child) {\n return child.toText();\n }).join(\"\");\n };\n\n return MathNode;\n}();\n/**\n * This node represents a piece of text.\n */\n\nvar mathMLTree_TextNode =\n/*#__PURE__*/\nfunction () {\n function TextNode(text) {\n this.text = void 0;\n this.text = text;\n }\n /**\n * Converts the text node into a DOM text node.\n */\n\n\n var _proto2 = TextNode.prototype;\n\n _proto2.toNode = function toNode() {\n return document.createTextNode(this.text);\n }\n /**\n * Converts the text node into escaped HTML markup\n * (representing the text itself).\n */\n ;\n\n _proto2.toMarkup = function toMarkup() {\n return utils.escape(this.toText());\n }\n /**\n * Converts the text node into a string\n * (representing the text iteself).\n */\n ;\n\n _proto2.toText = function toText() {\n return this.text;\n };\n\n return TextNode;\n}();\n/**\n * This node represents a space, but may render as or as text,\n * depending on the width.\n */\n\nvar SpaceNode =\n/*#__PURE__*/\nfunction () {\n /**\n * Create a Space node with width given in CSS ems.\n */\n function SpaceNode(width) {\n this.width = void 0;\n this.character = void 0;\n this.width = width; // See https://www.w3.org/TR/2000/WD-MathML2-20000328/chapter6.html\n // for a table of space-like characters. We use Unicode\n // representations instead of &LongNames; as it's not clear how to\n // make the latter via document.createTextNode.\n\n if (width >= 0.05555 && width <= 0.05556) {\n this.character = \"\\u200A\"; //  \n } else if (width >= 0.1666 && width <= 0.1667) {\n this.character = \"\\u2009\"; //  \n } else if (width >= 0.2222 && width <= 0.2223) {\n this.character = \"\\u2005\"; //  \n } else if (width >= 0.2777 && width <= 0.2778) {\n this.character = \"\\u2005\\u200A\"; //   \n } else if (width >= -0.05556 && width <= -0.05555) {\n this.character = \"\\u200A\\u2063\"; // ​\n } else if (width >= -0.1667 && width <= -0.1666) {\n this.character = \"\\u2009\\u2063\"; // ​\n } else if (width >= -0.2223 && width <= -0.2222) {\n this.character = \"\\u205F\\u2063\"; // ​\n } else if (width >= -0.2778 && width <= -0.2777) {\n this.character = \"\\u2005\\u2063\"; // ​\n } else {\n this.character = null;\n }\n }\n /**\n * Converts the math node into a MathML-namespaced DOM element.\n */\n\n\n var _proto3 = SpaceNode.prototype;\n\n _proto3.toNode = function toNode() {\n if (this.character) {\n return document.createTextNode(this.character);\n } else {\n var node = document.createElementNS(\"http://www.w3.org/1998/Math/MathML\", \"mspace\");\n node.setAttribute(\"width\", this.width + \"em\");\n return node;\n }\n }\n /**\n * Converts the math node into an HTML markup string.\n */\n ;\n\n _proto3.toMarkup = function toMarkup() {\n if (this.character) {\n return \"\" + this.character + \"\";\n } else {\n return \"\";\n }\n }\n /**\n * Converts the math node into a string, similar to innerText.\n */\n ;\n\n _proto3.toText = function toText() {\n if (this.character) {\n return this.character;\n } else {\n return \" \";\n }\n };\n\n return SpaceNode;\n}();\n\n/* harmony default export */ var mathMLTree = ({\n MathNode: mathMLTree_MathNode,\n TextNode: mathMLTree_TextNode,\n SpaceNode: SpaceNode,\n newDocumentFragment: newDocumentFragment\n});\n// CONCATENATED MODULE: ./src/buildMathML.js\n/**\n * This file converts a parse tree into a cooresponding MathML tree. The main\n * entry point is the `buildMathML` function, which takes a parse tree from the\n * parser.\n */\n\n\n\n\n\n\n\n\n\n/**\n * Takes a symbol and converts it into a MathML text node after performing\n * optional replacement from symbols.js.\n */\nvar buildMathML_makeText = function makeText(text, mode, options) {\n if (src_symbols[mode][text] && src_symbols[mode][text].replace && text.charCodeAt(0) !== 0xD835 && !(ligatures.hasOwnProperty(text) && options && (options.fontFamily && options.fontFamily.substr(4, 2) === \"tt\" || options.font && options.font.substr(4, 2) === \"tt\"))) {\n text = src_symbols[mode][text].replace;\n }\n\n return new mathMLTree.TextNode(text);\n};\n/**\n * Wrap the given array of nodes in an node if needed, i.e.,\n * unless the array has length 1. Always returns a single node.\n */\n\nvar buildMathML_makeRow = function makeRow(body) {\n if (body.length === 1) {\n return body[0];\n } else {\n return new mathMLTree.MathNode(\"mrow\", body);\n }\n};\n/**\n * Returns the math variant as a string or null if none is required.\n */\n\nvar buildMathML_getVariant = function getVariant(group, options) {\n // Handle \\text... font specifiers as best we can.\n // MathML has a limited list of allowable mathvariant specifiers; see\n // https://www.w3.org/TR/MathML3/chapter3.html#presm.commatt\n if (options.fontFamily === \"texttt\") {\n return \"monospace\";\n } else if (options.fontFamily === \"textsf\") {\n if (options.fontShape === \"textit\" && options.fontWeight === \"textbf\") {\n return \"sans-serif-bold-italic\";\n } else if (options.fontShape === \"textit\") {\n return \"sans-serif-italic\";\n } else if (options.fontWeight === \"textbf\") {\n return \"bold-sans-serif\";\n } else {\n return \"sans-serif\";\n }\n } else if (options.fontShape === \"textit\" && options.fontWeight === \"textbf\") {\n return \"bold-italic\";\n } else if (options.fontShape === \"textit\") {\n return \"italic\";\n } else if (options.fontWeight === \"textbf\") {\n return \"bold\";\n }\n\n var font = options.font;\n\n if (!font || font === \"mathnormal\") {\n return null;\n }\n\n var mode = group.mode;\n\n if (font === \"mathit\") {\n return \"italic\";\n } else if (font === \"boldsymbol\") {\n return \"bold-italic\";\n } else if (font === \"mathbf\") {\n return \"bold\";\n } else if (font === \"mathbb\") {\n return \"double-struck\";\n } else if (font === \"mathfrak\") {\n return \"fraktur\";\n } else if (font === \"mathscr\" || font === \"mathcal\") {\n // MathML makes no distinction between script and caligrahpic\n return \"script\";\n } else if (font === \"mathsf\") {\n return \"sans-serif\";\n } else if (font === \"mathtt\") {\n return \"monospace\";\n }\n\n var text = group.text;\n\n if (utils.contains([\"\\\\imath\", \"\\\\jmath\"], text)) {\n return null;\n }\n\n if (src_symbols[mode][text] && src_symbols[mode][text].replace) {\n text = src_symbols[mode][text].replace;\n }\n\n var fontName = buildCommon.fontMap[font].fontName;\n\n if (getCharacterMetrics(text, fontName, mode)) {\n return buildCommon.fontMap[font].variant;\n }\n\n return null;\n};\n/**\n * Takes a list of nodes, builds them, and returns a list of the generated\n * MathML nodes. Also combine consecutive outputs into a single\n * tag.\n */\n\nvar buildMathML_buildExpression = function buildExpression(expression, options, isOrdgroup) {\n if (expression.length === 1) {\n var group = buildMathML_buildGroup(expression[0], options);\n\n if (isOrdgroup && group instanceof mathMLTree_MathNode && group.type === \"mo\") {\n // When TeX writers want to suppress spacing on an operator,\n // they often put the operator by itself inside braces.\n group.setAttribute(\"lspace\", \"0em\");\n group.setAttribute(\"rspace\", \"0em\");\n }\n\n return [group];\n }\n\n var groups = [];\n var lastGroup;\n\n for (var i = 0; i < expression.length; i++) {\n var _group = buildMathML_buildGroup(expression[i], options);\n\n if (_group instanceof mathMLTree_MathNode && lastGroup instanceof mathMLTree_MathNode) {\n // Concatenate adjacent s\n if (_group.type === 'mtext' && lastGroup.type === 'mtext' && _group.getAttribute('mathvariant') === lastGroup.getAttribute('mathvariant')) {\n var _lastGroup$children;\n\n (_lastGroup$children = lastGroup.children).push.apply(_lastGroup$children, _group.children);\n\n continue; // Concatenate adjacent s\n } else if (_group.type === 'mn' && lastGroup.type === 'mn') {\n var _lastGroup$children2;\n\n (_lastGroup$children2 = lastGroup.children).push.apply(_lastGroup$children2, _group.children);\n\n continue; // Concatenate ... followed by .\n } else if (_group.type === 'mi' && _group.children.length === 1 && lastGroup.type === 'mn') {\n var child = _group.children[0];\n\n if (child instanceof mathMLTree_TextNode && child.text === '.') {\n var _lastGroup$children3;\n\n (_lastGroup$children3 = lastGroup.children).push.apply(_lastGroup$children3, _group.children);\n\n continue;\n }\n } else if (lastGroup.type === 'mi' && lastGroup.children.length === 1) {\n var lastChild = lastGroup.children[0];\n\n if (lastChild instanceof mathMLTree_TextNode && lastChild.text === \"\\u0338\" && (_group.type === 'mo' || _group.type === 'mi' || _group.type === 'mn')) {\n var _child = _group.children[0];\n\n if (_child instanceof mathMLTree_TextNode && _child.text.length > 0) {\n // Overlay with combining character long solidus\n _child.text = _child.text.slice(0, 1) + \"\\u0338\" + _child.text.slice(1);\n groups.pop();\n }\n }\n }\n }\n\n groups.push(_group);\n lastGroup = _group;\n }\n\n return groups;\n};\n/**\n * Equivalent to buildExpression, but wraps the elements in an \n * if there's more than one. Returns a single node instead of an array.\n */\n\nvar buildExpressionRow = function buildExpressionRow(expression, options, isOrdgroup) {\n return buildMathML_makeRow(buildMathML_buildExpression(expression, options, isOrdgroup));\n};\n/**\n * Takes a group from the parser and calls the appropriate groupBuilders function\n * on it to produce a MathML node.\n */\n\nvar buildMathML_buildGroup = function buildGroup(group, options) {\n if (!group) {\n return new mathMLTree.MathNode(\"mrow\");\n }\n\n if (_mathmlGroupBuilders[group.type]) {\n // Call the groupBuilders function\n var result = _mathmlGroupBuilders[group.type](group, options);\n return result;\n } else {\n throw new src_ParseError(\"Got group of unknown type: '\" + group.type + \"'\");\n }\n};\n/**\n * Takes a full parse tree and settings and builds a MathML representation of\n * it. In particular, we put the elements from building the parse tree into a\n * tag so we can also include that TeX source as an annotation.\n *\n * Note that we actually return a domTree element with a `` inside it so\n * we can do appropriate styling.\n */\n\nfunction buildMathML(tree, texExpression, options, forMathmlOnly) {\n var expression = buildMathML_buildExpression(tree, options); // Wrap up the expression in an mrow so it is presented in the semantics\n // tag correctly, unless it's a single or .\n\n var wrapper;\n\n if (expression.length === 1 && expression[0] instanceof mathMLTree_MathNode && utils.contains([\"mrow\", \"mtable\"], expression[0].type)) {\n wrapper = expression[0];\n } else {\n wrapper = new mathMLTree.MathNode(\"mrow\", expression);\n } // Build a TeX annotation of the source\n\n\n var annotation = new mathMLTree.MathNode(\"annotation\", [new mathMLTree.TextNode(texExpression)]);\n annotation.setAttribute(\"encoding\", \"application/x-tex\");\n var semantics = new mathMLTree.MathNode(\"semantics\", [wrapper, annotation]);\n var math = new mathMLTree.MathNode(\"math\", [semantics]);\n math.setAttribute(\"xmlns\", \"http://www.w3.org/1998/Math/MathML\"); // You can't style nodes, so we wrap the node in a span.\n // NOTE: The span class is not typed to have nodes as children, and\n // we don't want to make the children type more generic since the children\n // of span are expected to have more fields in `buildHtml` contexts.\n\n var wrapperClass = forMathmlOnly ? \"katex\" : \"katex-mathml\"; // $FlowFixMe\n\n return buildCommon.makeSpan([wrapperClass], [math]);\n}\n// CONCATENATED MODULE: ./src/buildTree.js\n\n\n\n\n\n\n\nvar buildTree_optionsFromSettings = function optionsFromSettings(settings) {\n return new src_Options({\n style: settings.displayMode ? src_Style.DISPLAY : src_Style.TEXT,\n maxSize: settings.maxSize,\n minRuleThickness: settings.minRuleThickness\n });\n};\n\nvar buildTree_displayWrap = function displayWrap(node, settings) {\n if (settings.displayMode) {\n var classes = [\"katex-display\"];\n\n if (settings.leqno) {\n classes.push(\"leqno\");\n }\n\n if (settings.fleqn) {\n classes.push(\"fleqn\");\n }\n\n node = buildCommon.makeSpan(classes, [node]);\n }\n\n return node;\n};\n\nvar buildTree_buildTree = function buildTree(tree, expression, settings) {\n var options = buildTree_optionsFromSettings(settings);\n var katexNode;\n\n if (settings.output === \"mathml\") {\n return buildMathML(tree, expression, options, true);\n } else if (settings.output === \"html\") {\n var htmlNode = buildHTML(tree, options);\n katexNode = buildCommon.makeSpan([\"katex\"], [htmlNode]);\n } else {\n var mathMLNode = buildMathML(tree, expression, options, false);\n\n var _htmlNode = buildHTML(tree, options);\n\n katexNode = buildCommon.makeSpan([\"katex\"], [mathMLNode, _htmlNode]);\n }\n\n return buildTree_displayWrap(katexNode, settings);\n};\nvar buildTree_buildHTMLTree = function buildHTMLTree(tree, expression, settings) {\n var options = buildTree_optionsFromSettings(settings);\n var htmlNode = buildHTML(tree, options);\n var katexNode = buildCommon.makeSpan([\"katex\"], [htmlNode]);\n return buildTree_displayWrap(katexNode, settings);\n};\n/* harmony default export */ var src_buildTree = (buildTree_buildTree);\n// CONCATENATED MODULE: ./src/stretchy.js\n/**\n * This file provides support to buildMathML.js and buildHTML.js\n * for stretchy wide elements rendered from SVG files\n * and other CSS trickery.\n */\n\n\n\n\nvar stretchyCodePoint = {\n widehat: \"^\",\n widecheck: \"ˇ\",\n widetilde: \"~\",\n utilde: \"~\",\n overleftarrow: \"\\u2190\",\n underleftarrow: \"\\u2190\",\n xleftarrow: \"\\u2190\",\n overrightarrow: \"\\u2192\",\n underrightarrow: \"\\u2192\",\n xrightarrow: \"\\u2192\",\n underbrace: \"\\u23DF\",\n overbrace: \"\\u23DE\",\n overgroup: \"\\u23E0\",\n undergroup: \"\\u23E1\",\n overleftrightarrow: \"\\u2194\",\n underleftrightarrow: \"\\u2194\",\n xleftrightarrow: \"\\u2194\",\n Overrightarrow: \"\\u21D2\",\n xRightarrow: \"\\u21D2\",\n overleftharpoon: \"\\u21BC\",\n xleftharpoonup: \"\\u21BC\",\n overrightharpoon: \"\\u21C0\",\n xrightharpoonup: \"\\u21C0\",\n xLeftarrow: \"\\u21D0\",\n xLeftrightarrow: \"\\u21D4\",\n xhookleftarrow: \"\\u21A9\",\n xhookrightarrow: \"\\u21AA\",\n xmapsto: \"\\u21A6\",\n xrightharpoondown: \"\\u21C1\",\n xleftharpoondown: \"\\u21BD\",\n xrightleftharpoons: \"\\u21CC\",\n xleftrightharpoons: \"\\u21CB\",\n xtwoheadleftarrow: \"\\u219E\",\n xtwoheadrightarrow: \"\\u21A0\",\n xlongequal: \"=\",\n xtofrom: \"\\u21C4\",\n xrightleftarrows: \"\\u21C4\",\n xrightequilibrium: \"\\u21CC\",\n // Not a perfect match.\n xleftequilibrium: \"\\u21CB\" // None better available.\n\n};\n\nvar stretchy_mathMLnode = function mathMLnode(label) {\n var node = new mathMLTree.MathNode(\"mo\", [new mathMLTree.TextNode(stretchyCodePoint[label.substr(1)])]);\n node.setAttribute(\"stretchy\", \"true\");\n return node;\n}; // Many of the KaTeX SVG images have been adapted from glyphs in KaTeX fonts.\n// Copyright (c) 2009-2010, Design Science, Inc. ()\n// Copyright (c) 2014-2017 Khan Academy ()\n// Licensed under the SIL Open Font License, Version 1.1.\n// See \\nhttp://scripts.sil.org/OFL\n// Very Long SVGs\n// Many of the KaTeX stretchy wide elements use a long SVG image and an\n// overflow: hidden tactic to achieve a stretchy image while avoiding\n// distortion of arrowheads or brace corners.\n// The SVG typically contains a very long (400 em) arrow.\n// The SVG is in a container span that has overflow: hidden, so the span\n// acts like a window that exposes only part of the SVG.\n// The SVG always has a longer, thinner aspect ratio than the container span.\n// After the SVG fills 100% of the height of the container span,\n// there is a long arrow shaft left over. That left-over shaft is not shown.\n// Instead, it is sliced off because the span's CSS has overflow: hidden.\n// Thus, the reader sees an arrow that matches the subject matter width\n// without distortion.\n// Some functions, such as \\cancel, need to vary their aspect ratio. These\n// functions do not get the overflow SVG treatment.\n// Second Brush Stroke\n// Low resolution monitors struggle to display images in fine detail.\n// So browsers apply anti-aliasing. A long straight arrow shaft therefore\n// will sometimes appear as if it has a blurred edge.\n// To mitigate this, these SVG files contain a second \"brush-stroke\" on the\n// arrow shafts. That is, a second long thin rectangular SVG path has been\n// written directly on top of each arrow shaft. This reinforcement causes\n// some of the screen pixels to display as black instead of the anti-aliased\n// gray pixel that a single path would generate. So we get arrow shafts\n// whose edges appear to be sharper.\n// In the katexImagesData object just below, the dimensions all\n// correspond to path geometry inside the relevant SVG.\n// For example, \\overrightarrow uses the same arrowhead as glyph U+2192\n// from the KaTeX Main font. The scaling factor is 1000.\n// That is, inside the font, that arrowhead is 522 units tall, which\n// corresponds to 0.522 em inside the document.\n\n\nvar katexImagesData = {\n // path(s), minWidth, height, align\n overrightarrow: [[\"rightarrow\"], 0.888, 522, \"xMaxYMin\"],\n overleftarrow: [[\"leftarrow\"], 0.888, 522, \"xMinYMin\"],\n underrightarrow: [[\"rightarrow\"], 0.888, 522, \"xMaxYMin\"],\n underleftarrow: [[\"leftarrow\"], 0.888, 522, \"xMinYMin\"],\n xrightarrow: [[\"rightarrow\"], 1.469, 522, \"xMaxYMin\"],\n xleftarrow: [[\"leftarrow\"], 1.469, 522, \"xMinYMin\"],\n Overrightarrow: [[\"doublerightarrow\"], 0.888, 560, \"xMaxYMin\"],\n xRightarrow: [[\"doublerightarrow\"], 1.526, 560, \"xMaxYMin\"],\n xLeftarrow: [[\"doubleleftarrow\"], 1.526, 560, \"xMinYMin\"],\n overleftharpoon: [[\"leftharpoon\"], 0.888, 522, \"xMinYMin\"],\n xleftharpoonup: [[\"leftharpoon\"], 0.888, 522, \"xMinYMin\"],\n xleftharpoondown: [[\"leftharpoondown\"], 0.888, 522, \"xMinYMin\"],\n overrightharpoon: [[\"rightharpoon\"], 0.888, 522, \"xMaxYMin\"],\n xrightharpoonup: [[\"rightharpoon\"], 0.888, 522, \"xMaxYMin\"],\n xrightharpoondown: [[\"rightharpoondown\"], 0.888, 522, \"xMaxYMin\"],\n xlongequal: [[\"longequal\"], 0.888, 334, \"xMinYMin\"],\n xtwoheadleftarrow: [[\"twoheadleftarrow\"], 0.888, 334, \"xMinYMin\"],\n xtwoheadrightarrow: [[\"twoheadrightarrow\"], 0.888, 334, \"xMaxYMin\"],\n overleftrightarrow: [[\"leftarrow\", \"rightarrow\"], 0.888, 522],\n overbrace: [[\"leftbrace\", \"midbrace\", \"rightbrace\"], 1.6, 548],\n underbrace: [[\"leftbraceunder\", \"midbraceunder\", \"rightbraceunder\"], 1.6, 548],\n underleftrightarrow: [[\"leftarrow\", \"rightarrow\"], 0.888, 522],\n xleftrightarrow: [[\"leftarrow\", \"rightarrow\"], 1.75, 522],\n xLeftrightarrow: [[\"doubleleftarrow\", \"doublerightarrow\"], 1.75, 560],\n xrightleftharpoons: [[\"leftharpoondownplus\", \"rightharpoonplus\"], 1.75, 716],\n xleftrightharpoons: [[\"leftharpoonplus\", \"rightharpoondownplus\"], 1.75, 716],\n xhookleftarrow: [[\"leftarrow\", \"righthook\"], 1.08, 522],\n xhookrightarrow: [[\"lefthook\", \"rightarrow\"], 1.08, 522],\n overlinesegment: [[\"leftlinesegment\", \"rightlinesegment\"], 0.888, 522],\n underlinesegment: [[\"leftlinesegment\", \"rightlinesegment\"], 0.888, 522],\n overgroup: [[\"leftgroup\", \"rightgroup\"], 0.888, 342],\n undergroup: [[\"leftgroupunder\", \"rightgroupunder\"], 0.888, 342],\n xmapsto: [[\"leftmapsto\", \"rightarrow\"], 1.5, 522],\n xtofrom: [[\"leftToFrom\", \"rightToFrom\"], 1.75, 528],\n // The next three arrows are from the mhchem package.\n // In mhchem.sty, min-length is 2.0em. But these arrows might appear in the\n // document as \\xrightarrow or \\xrightleftharpoons. Those have\n // min-length = 1.75em, so we set min-length on these next three to match.\n xrightleftarrows: [[\"baraboveleftarrow\", \"rightarrowabovebar\"], 1.75, 901],\n xrightequilibrium: [[\"baraboveshortleftharpoon\", \"rightharpoonaboveshortbar\"], 1.75, 716],\n xleftequilibrium: [[\"shortbaraboveleftharpoon\", \"shortrightharpoonabovebar\"], 1.75, 716]\n};\n\nvar groupLength = function groupLength(arg) {\n if (arg.type === \"ordgroup\") {\n return arg.body.length;\n } else {\n return 1;\n }\n};\n\nvar stretchy_svgSpan = function svgSpan(group, options) {\n // Create a span with inline SVG for the element.\n function buildSvgSpan_() {\n var viewBoxWidth = 400000; // default\n\n var label = group.label.substr(1);\n\n if (utils.contains([\"widehat\", \"widecheck\", \"widetilde\", \"utilde\"], label)) {\n // Each type in the `if` statement corresponds to one of the ParseNode\n // types below. This narrowing is required to access `grp.base`.\n var grp = group; // There are four SVG images available for each function.\n // Choose a taller image when there are more characters.\n\n var numChars = groupLength(grp.base);\n var viewBoxHeight;\n var pathName;\n\n var _height;\n\n if (numChars > 5) {\n if (label === \"widehat\" || label === \"widecheck\") {\n viewBoxHeight = 420;\n viewBoxWidth = 2364;\n _height = 0.42;\n pathName = label + \"4\";\n } else {\n viewBoxHeight = 312;\n viewBoxWidth = 2340;\n _height = 0.34;\n pathName = \"tilde4\";\n }\n } else {\n var imgIndex = [1, 1, 2, 2, 3, 3][numChars];\n\n if (label === \"widehat\" || label === \"widecheck\") {\n viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex];\n viewBoxHeight = [0, 239, 300, 360, 420][imgIndex];\n _height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex];\n pathName = label + imgIndex;\n } else {\n viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex];\n viewBoxHeight = [0, 260, 286, 306, 312][imgIndex];\n _height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex];\n pathName = \"tilde\" + imgIndex;\n }\n }\n\n var path = new domTree_PathNode(pathName);\n var svgNode = new SvgNode([path], {\n \"width\": \"100%\",\n \"height\": _height + \"em\",\n \"viewBox\": \"0 0 \" + viewBoxWidth + \" \" + viewBoxHeight,\n \"preserveAspectRatio\": \"none\"\n });\n return {\n span: buildCommon.makeSvgSpan([], [svgNode], options),\n minWidth: 0,\n height: _height\n };\n } else {\n var spans = [];\n var data = katexImagesData[label];\n var paths = data[0],\n _minWidth = data[1],\n _viewBoxHeight = data[2];\n\n var _height2 = _viewBoxHeight / 1000;\n\n var numSvgChildren = paths.length;\n var widthClasses;\n var aligns;\n\n if (numSvgChildren === 1) {\n // $FlowFixMe: All these cases must be of the 4-tuple type.\n var align1 = data[3];\n widthClasses = [\"hide-tail\"];\n aligns = [align1];\n } else if (numSvgChildren === 2) {\n widthClasses = [\"halfarrow-left\", \"halfarrow-right\"];\n aligns = [\"xMinYMin\", \"xMaxYMin\"];\n } else if (numSvgChildren === 3) {\n widthClasses = [\"brace-left\", \"brace-center\", \"brace-right\"];\n aligns = [\"xMinYMin\", \"xMidYMin\", \"xMaxYMin\"];\n } else {\n throw new Error(\"Correct katexImagesData or update code here to support\\n \" + numSvgChildren + \" children.\");\n }\n\n for (var i = 0; i < numSvgChildren; i++) {\n var _path = new domTree_PathNode(paths[i]);\n\n var _svgNode = new SvgNode([_path], {\n \"width\": \"400em\",\n \"height\": _height2 + \"em\",\n \"viewBox\": \"0 0 \" + viewBoxWidth + \" \" + _viewBoxHeight,\n \"preserveAspectRatio\": aligns[i] + \" slice\"\n });\n\n var _span = buildCommon.makeSvgSpan([widthClasses[i]], [_svgNode], options);\n\n if (numSvgChildren === 1) {\n return {\n span: _span,\n minWidth: _minWidth,\n height: _height2\n };\n } else {\n _span.style.height = _height2 + \"em\";\n spans.push(_span);\n }\n }\n\n return {\n span: buildCommon.makeSpan([\"stretchy\"], spans, options),\n minWidth: _minWidth,\n height: _height2\n };\n }\n } // buildSvgSpan_()\n\n\n var _buildSvgSpan_ = buildSvgSpan_(),\n span = _buildSvgSpan_.span,\n minWidth = _buildSvgSpan_.minWidth,\n height = _buildSvgSpan_.height; // Note that we are returning span.depth = 0.\n // Any adjustments relative to the baseline must be done in buildHTML.\n\n\n span.height = height;\n span.style.height = height + \"em\";\n\n if (minWidth > 0) {\n span.style.minWidth = minWidth + \"em\";\n }\n\n return span;\n};\n\nvar stretchy_encloseSpan = function encloseSpan(inner, label, pad, options) {\n // Return an image span for \\cancel, \\bcancel, \\xcancel, or \\fbox\n var img;\n var totalHeight = inner.height + inner.depth + 2 * pad;\n\n if (/fbox|color/.test(label)) {\n img = buildCommon.makeSpan([\"stretchy\", label], [], options);\n\n if (label === \"fbox\") {\n var color = options.color && options.getColor();\n\n if (color) {\n img.style.borderColor = color;\n }\n }\n } else {\n // \\cancel, \\bcancel, or \\xcancel\n // Since \\cancel's SVG is inline and it omits the viewBox attribute,\n // its stroke-width will not vary with span area.\n var lines = [];\n\n if (/^[bx]cancel$/.test(label)) {\n lines.push(new LineNode({\n \"x1\": \"0\",\n \"y1\": \"0\",\n \"x2\": \"100%\",\n \"y2\": \"100%\",\n \"stroke-width\": \"0.046em\"\n }));\n }\n\n if (/^x?cancel$/.test(label)) {\n lines.push(new LineNode({\n \"x1\": \"0\",\n \"y1\": \"100%\",\n \"x2\": \"100%\",\n \"y2\": \"0\",\n \"stroke-width\": \"0.046em\"\n }));\n }\n\n var svgNode = new SvgNode(lines, {\n \"width\": \"100%\",\n \"height\": totalHeight + \"em\"\n });\n img = buildCommon.makeSvgSpan([], [svgNode], options);\n }\n\n img.height = totalHeight;\n img.style.height = totalHeight + \"em\";\n return img;\n};\n\n/* harmony default export */ var stretchy = ({\n encloseSpan: stretchy_encloseSpan,\n mathMLnode: stretchy_mathMLnode,\n svgSpan: stretchy_svgSpan\n});\n// CONCATENATED MODULE: ./src/functions/accent.js\n\n\n\n\n\n\n\n\n\n// NOTE: Unlike most `htmlBuilder`s, this one handles not only \"accent\", but\nvar accent_htmlBuilder = function htmlBuilder(grp, options) {\n // Accents are handled in the TeXbook pg. 443, rule 12.\n var base;\n var group;\n var supSub = checkNodeType(grp, \"supsub\");\n var supSubGroup;\n\n if (supSub) {\n // If our base is a character box, and we have superscripts and\n // subscripts, the supsub will defer to us. In particular, we want\n // to attach the superscripts and subscripts to the inner body (so\n // that the position of the superscripts and subscripts won't be\n // affected by the height of the accent). We accomplish this by\n // sticking the base of the accent into the base of the supsub, and\n // rendering that, while keeping track of where the accent is.\n // The real accent group is the base of the supsub group\n group = assertNodeType(supSub.base, \"accent\"); // The character box is the base of the accent group\n\n base = group.base; // Stick the character box into the base of the supsub group\n\n supSub.base = base; // Rerender the supsub group with its new base, and store that\n // result.\n\n supSubGroup = assertSpan(buildHTML_buildGroup(supSub, options)); // reset original base\n\n supSub.base = group;\n } else {\n group = assertNodeType(grp, \"accent\");\n base = group.base;\n } // Build the base group\n\n\n var body = buildHTML_buildGroup(base, options.havingCrampedStyle()); // Does the accent need to shift for the skew of a character?\n\n var mustShift = group.isShifty && utils.isCharacterBox(base); // Calculate the skew of the accent. This is based on the line \"If the\n // nucleus is not a single character, let s = 0; otherwise set s to the\n // kern amount for the nucleus followed by the \\skewchar of its font.\"\n // Note that our skew metrics are just the kern between each character\n // and the skewchar.\n\n var skew = 0;\n\n if (mustShift) {\n // If the base is a character box, then we want the skew of the\n // innermost character. To do that, we find the innermost character:\n var baseChar = utils.getBaseElem(base); // Then, we render its group to get the symbol inside it\n\n var baseGroup = buildHTML_buildGroup(baseChar, options.havingCrampedStyle()); // Finally, we pull the skew off of the symbol.\n\n skew = assertSymbolDomNode(baseGroup).skew; // Note that we now throw away baseGroup, because the layers we\n // removed with getBaseElem might contain things like \\color which\n // we can't get rid of.\n // TODO(emily): Find a better way to get the skew\n } // calculate the amount of space between the body and the accent\n\n\n var clearance = Math.min(body.height, options.fontMetrics().xHeight); // Build the accent\n\n var accentBody;\n\n if (!group.isStretchy) {\n var accent;\n var width;\n\n if (group.label === \"\\\\vec\") {\n // Before version 0.9, \\vec used the combining font glyph U+20D7.\n // But browsers, especially Safari, are not consistent in how they\n // render combining characters when not preceded by a character.\n // So now we use an SVG.\n // If Safari reforms, we should consider reverting to the glyph.\n accent = buildCommon.staticSvg(\"vec\", options);\n width = buildCommon.svgData.vec[1];\n } else {\n accent = buildCommon.makeOrd({\n mode: group.mode,\n text: group.label\n }, options, \"textord\");\n accent = assertSymbolDomNode(accent); // Remove the italic correction of the accent, because it only serves to\n // shift the accent over to a place we don't want.\n\n accent.italic = 0;\n width = accent.width;\n }\n\n accentBody = buildCommon.makeSpan([\"accent-body\"], [accent]); // \"Full\" accents expand the width of the resulting symbol to be\n // at least the width of the accent, and overlap directly onto the\n // character without any vertical offset.\n\n var accentFull = group.label === \"\\\\textcircled\";\n\n if (accentFull) {\n accentBody.classes.push('accent-full');\n clearance = body.height;\n } // Shift the accent over by the skew.\n\n\n var left = skew; // CSS defines `.katex .accent .accent-body:not(.accent-full) { width: 0 }`\n // so that the accent doesn't contribute to the bounding box.\n // We need to shift the character by its width (effectively half\n // its width) to compensate.\n\n if (!accentFull) {\n left -= width / 2;\n }\n\n accentBody.style.left = left + \"em\"; // \\textcircled uses the \\bigcirc glyph, so it needs some\n // vertical adjustment to match LaTeX.\n\n if (group.label === \"\\\\textcircled\") {\n accentBody.style.top = \".2em\";\n }\n\n accentBody = buildCommon.makeVList({\n positionType: \"firstBaseline\",\n children: [{\n type: \"elem\",\n elem: body\n }, {\n type: \"kern\",\n size: -clearance\n }, {\n type: \"elem\",\n elem: accentBody\n }]\n }, options);\n } else {\n accentBody = stretchy.svgSpan(group, options);\n accentBody = buildCommon.makeVList({\n positionType: \"firstBaseline\",\n children: [{\n type: \"elem\",\n elem: body\n }, {\n type: \"elem\",\n elem: accentBody,\n wrapperClasses: [\"svg-align\"],\n wrapperStyle: skew > 0 ? {\n width: \"calc(100% - \" + 2 * skew + \"em)\",\n marginLeft: 2 * skew + \"em\"\n } : undefined\n }]\n }, options);\n }\n\n var accentWrap = buildCommon.makeSpan([\"mord\", \"accent\"], [accentBody], options);\n\n if (supSubGroup) {\n // Here, we replace the \"base\" child of the supsub with our newly\n // generated accent.\n supSubGroup.children[0] = accentWrap; // Since we don't rerun the height calculation after replacing the\n // accent, we manually recalculate height.\n\n supSubGroup.height = Math.max(accentWrap.height, supSubGroup.height); // Accents should always be ords, even when their innards are not.\n\n supSubGroup.classes[0] = \"mord\";\n return supSubGroup;\n } else {\n return accentWrap;\n }\n};\n\nvar accent_mathmlBuilder = function mathmlBuilder(group, options) {\n var accentNode = group.isStretchy ? stretchy.mathMLnode(group.label) : new mathMLTree.MathNode(\"mo\", [buildMathML_makeText(group.label, group.mode)]);\n var node = new mathMLTree.MathNode(\"mover\", [buildMathML_buildGroup(group.base, options), accentNode]);\n node.setAttribute(\"accent\", \"true\");\n return node;\n};\n\nvar NON_STRETCHY_ACCENT_REGEX = new RegExp([\"\\\\acute\", \"\\\\grave\", \"\\\\ddot\", \"\\\\tilde\", \"\\\\bar\", \"\\\\breve\", \"\\\\check\", \"\\\\hat\", \"\\\\vec\", \"\\\\dot\", \"\\\\mathring\"].map(function (accent) {\n return \"\\\\\" + accent;\n}).join(\"|\")); // Accents\n\ndefineFunction({\n type: \"accent\",\n names: [\"\\\\acute\", \"\\\\grave\", \"\\\\ddot\", \"\\\\tilde\", \"\\\\bar\", \"\\\\breve\", \"\\\\check\", \"\\\\hat\", \"\\\\vec\", \"\\\\dot\", \"\\\\mathring\", \"\\\\widecheck\", \"\\\\widehat\", \"\\\\widetilde\", \"\\\\overrightarrow\", \"\\\\overleftarrow\", \"\\\\Overrightarrow\", \"\\\\overleftrightarrow\", \"\\\\overgroup\", \"\\\\overlinesegment\", \"\\\\overleftharpoon\", \"\\\\overrightharpoon\"],\n props: {\n numArgs: 1\n },\n handler: function handler(context, args) {\n var base = args[0];\n var isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName);\n var isShifty = !isStretchy || context.funcName === \"\\\\widehat\" || context.funcName === \"\\\\widetilde\" || context.funcName === \"\\\\widecheck\";\n return {\n type: \"accent\",\n mode: context.parser.mode,\n label: context.funcName,\n isStretchy: isStretchy,\n isShifty: isShifty,\n base: base\n };\n },\n htmlBuilder: accent_htmlBuilder,\n mathmlBuilder: accent_mathmlBuilder\n}); // Text-mode accents\n\ndefineFunction({\n type: \"accent\",\n names: [\"\\\\'\", \"\\\\`\", \"\\\\^\", \"\\\\~\", \"\\\\=\", \"\\\\u\", \"\\\\.\", '\\\\\"', \"\\\\r\", \"\\\\H\", \"\\\\v\", \"\\\\textcircled\"],\n props: {\n numArgs: 1,\n allowedInText: true,\n allowedInMath: false\n },\n handler: function handler(context, args) {\n var base = args[0];\n return {\n type: \"accent\",\n mode: context.parser.mode,\n label: context.funcName,\n isStretchy: false,\n isShifty: true,\n base: base\n };\n },\n htmlBuilder: accent_htmlBuilder,\n mathmlBuilder: accent_mathmlBuilder\n});\n// CONCATENATED MODULE: ./src/functions/accentunder.js\n// Horizontal overlap functions\n\n\n\n\n\n\ndefineFunction({\n type: \"accentUnder\",\n names: [\"\\\\underleftarrow\", \"\\\\underrightarrow\", \"\\\\underleftrightarrow\", \"\\\\undergroup\", \"\\\\underlinesegment\", \"\\\\utilde\"],\n props: {\n numArgs: 1\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser,\n funcName = _ref.funcName;\n var base = args[0];\n return {\n type: \"accentUnder\",\n mode: parser.mode,\n label: funcName,\n base: base\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n // Treat under accents much like underlines.\n var innerGroup = buildHTML_buildGroup(group.base, options);\n var accentBody = stretchy.svgSpan(group, options);\n var kern = group.label === \"\\\\utilde\" ? 0.12 : 0; // Generate the vlist, with the appropriate kerns\n\n var vlist = buildCommon.makeVList({\n positionType: \"bottom\",\n positionData: accentBody.height + kern,\n children: [{\n type: \"elem\",\n elem: accentBody,\n wrapperClasses: [\"svg-align\"]\n }, {\n type: \"kern\",\n size: kern\n }, {\n type: \"elem\",\n elem: innerGroup\n }]\n }, options);\n return buildCommon.makeSpan([\"mord\", \"accentunder\"], [vlist], options);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var accentNode = stretchy.mathMLnode(group.label);\n var node = new mathMLTree.MathNode(\"munder\", [buildMathML_buildGroup(group.base, options), accentNode]);\n node.setAttribute(\"accentunder\", \"true\");\n return node;\n }\n});\n// CONCATENATED MODULE: ./src/functions/arrow.js\n\n\n\n\n\n\n\n// Helper function\nvar arrow_paddedNode = function paddedNode(group) {\n var node = new mathMLTree.MathNode(\"mpadded\", group ? [group] : []);\n node.setAttribute(\"width\", \"+0.6em\");\n node.setAttribute(\"lspace\", \"0.3em\");\n return node;\n}; // Stretchy arrows with an optional argument\n\n\ndefineFunction({\n type: \"xArrow\",\n names: [\"\\\\xleftarrow\", \"\\\\xrightarrow\", \"\\\\xLeftarrow\", \"\\\\xRightarrow\", \"\\\\xleftrightarrow\", \"\\\\xLeftrightarrow\", \"\\\\xhookleftarrow\", \"\\\\xhookrightarrow\", \"\\\\xmapsto\", \"\\\\xrightharpoondown\", \"\\\\xrightharpoonup\", \"\\\\xleftharpoondown\", \"\\\\xleftharpoonup\", \"\\\\xrightleftharpoons\", \"\\\\xleftrightharpoons\", \"\\\\xlongequal\", \"\\\\xtwoheadrightarrow\", \"\\\\xtwoheadleftarrow\", \"\\\\xtofrom\", // The next 3 functions are here to support the mhchem extension.\n // Direct use of these functions is discouraged and may break someday.\n \"\\\\xrightleftarrows\", \"\\\\xrightequilibrium\", \"\\\\xleftequilibrium\"],\n props: {\n numArgs: 1,\n numOptionalArgs: 1\n },\n handler: function handler(_ref, args, optArgs) {\n var parser = _ref.parser,\n funcName = _ref.funcName;\n return {\n type: \"xArrow\",\n mode: parser.mode,\n label: funcName,\n body: args[0],\n below: optArgs[0]\n };\n },\n // Flow is unable to correctly infer the type of `group`, even though it's\n // unamibiguously determined from the passed-in `type` above.\n htmlBuilder: function htmlBuilder(group, options) {\n var style = options.style; // Build the argument groups in the appropriate style.\n // Ref: amsmath.dtx: \\hbox{$\\scriptstyle\\mkern#3mu{#6}\\mkern#4mu$}%\n // Some groups can return document fragments. Handle those by wrapping\n // them in a span.\n\n var newOptions = options.havingStyle(style.sup());\n var upperGroup = buildCommon.wrapFragment(buildHTML_buildGroup(group.body, newOptions, options), options);\n upperGroup.classes.push(\"x-arrow-pad\");\n var lowerGroup;\n\n if (group.below) {\n // Build the lower group\n newOptions = options.havingStyle(style.sub());\n lowerGroup = buildCommon.wrapFragment(buildHTML_buildGroup(group.below, newOptions, options), options);\n lowerGroup.classes.push(\"x-arrow-pad\");\n }\n\n var arrowBody = stretchy.svgSpan(group, options); // Re shift: Note that stretchy.svgSpan returned arrowBody.depth = 0.\n // The point we want on the math axis is at 0.5 * arrowBody.height.\n\n var arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height; // 2 mu kern. Ref: amsmath.dtx: #7\\if0#2\\else\\mkern#2mu\\fi\n\n var upperShift = -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111; // 0.111 em = 2 mu\n\n if (upperGroup.depth > 0.25 || group.label === \"\\\\xleftequilibrium\") {\n upperShift -= upperGroup.depth; // shift up if depth encroaches\n } // Generate the vlist\n\n\n var vlist;\n\n if (lowerGroup) {\n var lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111;\n vlist = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: [{\n type: \"elem\",\n elem: upperGroup,\n shift: upperShift\n }, {\n type: \"elem\",\n elem: arrowBody,\n shift: arrowShift\n }, {\n type: \"elem\",\n elem: lowerGroup,\n shift: lowerShift\n }]\n }, options);\n } else {\n vlist = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: [{\n type: \"elem\",\n elem: upperGroup,\n shift: upperShift\n }, {\n type: \"elem\",\n elem: arrowBody,\n shift: arrowShift\n }]\n }, options);\n } // $FlowFixMe: Replace this with passing \"svg-align\" into makeVList.\n\n\n vlist.children[0].children[0].children[1].classes.push(\"svg-align\");\n return buildCommon.makeSpan([\"mrel\", \"x-arrow\"], [vlist], options);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var arrowNode = stretchy.mathMLnode(group.label);\n var node;\n\n if (group.body) {\n var upperNode = arrow_paddedNode(buildMathML_buildGroup(group.body, options));\n\n if (group.below) {\n var lowerNode = arrow_paddedNode(buildMathML_buildGroup(group.below, options));\n node = new mathMLTree.MathNode(\"munderover\", [arrowNode, lowerNode, upperNode]);\n } else {\n node = new mathMLTree.MathNode(\"mover\", [arrowNode, upperNode]);\n }\n } else if (group.below) {\n var _lowerNode = arrow_paddedNode(buildMathML_buildGroup(group.below, options));\n\n node = new mathMLTree.MathNode(\"munder\", [arrowNode, _lowerNode]);\n } else {\n // This should never happen.\n // Parser.js throws an error if there is no argument.\n node = arrow_paddedNode();\n node = new mathMLTree.MathNode(\"mover\", [arrowNode, node]);\n }\n\n return node;\n }\n});\n// CONCATENATED MODULE: ./src/functions/char.js\n\n\n // \\@char is an internal function that takes a grouped decimal argument like\n// {123} and converts into symbol with code 123. It is used by the *macro*\n// \\char defined in macros.js.\n\ndefineFunction({\n type: \"textord\",\n names: [\"\\\\@char\"],\n props: {\n numArgs: 1,\n allowedInText: true\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser;\n var arg = assertNodeType(args[0], \"ordgroup\");\n var group = arg.body;\n var number = \"\";\n\n for (var i = 0; i < group.length; i++) {\n var node = assertNodeType(group[i], \"textord\");\n number += node.text;\n }\n\n var code = parseInt(number);\n\n if (isNaN(code)) {\n throw new src_ParseError(\"\\\\@char has non-numeric argument \" + number);\n }\n\n return {\n type: \"textord\",\n mode: parser.mode,\n text: String.fromCharCode(code)\n };\n }\n});\n// CONCATENATED MODULE: ./src/functions/color.js\n\n\n\n\n\n\n\nvar color_htmlBuilder = function htmlBuilder(group, options) {\n var elements = buildHTML_buildExpression(group.body, options.withColor(group.color), false); // \\color isn't supposed to affect the type of the elements it contains.\n // To accomplish this, we wrap the results in a fragment, so the inner\n // elements will be able to directly interact with their neighbors. For\n // example, `\\color{red}{2 +} 3` has the same spacing as `2 + 3`\n\n return buildCommon.makeFragment(elements);\n};\n\nvar color_mathmlBuilder = function mathmlBuilder(group, options) {\n var inner = buildMathML_buildExpression(group.body, options.withColor(group.color));\n var node = new mathMLTree.MathNode(\"mstyle\", inner);\n node.setAttribute(\"mathcolor\", group.color);\n return node;\n};\n\ndefineFunction({\n type: \"color\",\n names: [\"\\\\textcolor\"],\n props: {\n numArgs: 2,\n allowedInText: true,\n greediness: 3,\n argTypes: [\"color\", \"original\"]\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser;\n var color = assertNodeType(args[0], \"color-token\").color;\n var body = args[1];\n return {\n type: \"color\",\n mode: parser.mode,\n color: color,\n body: defineFunction_ordargument(body)\n };\n },\n htmlBuilder: color_htmlBuilder,\n mathmlBuilder: color_mathmlBuilder\n});\ndefineFunction({\n type: \"color\",\n names: [\"\\\\color\"],\n props: {\n numArgs: 1,\n allowedInText: true,\n greediness: 3,\n argTypes: [\"color\"]\n },\n handler: function handler(_ref2, args) {\n var parser = _ref2.parser,\n breakOnTokenText = _ref2.breakOnTokenText;\n var color = assertNodeType(args[0], \"color-token\").color; // Set macro \\current@color in current namespace to store the current\n // color, mimicking the behavior of color.sty.\n // This is currently used just to correctly color a \\right\n // that follows a \\color command.\n\n parser.gullet.macros.set(\"\\\\current@color\", color); // Parse out the implicit body that should be colored.\n\n var body = parser.parseExpression(true, breakOnTokenText);\n return {\n type: \"color\",\n mode: parser.mode,\n color: color,\n body: body\n };\n },\n htmlBuilder: color_htmlBuilder,\n mathmlBuilder: color_mathmlBuilder\n});\n// CONCATENATED MODULE: ./src/functions/cr.js\n// Row breaks within tabular environments, and line breaks at top level\n\n\n\n\n\n // \\\\ is a macro mapping to either \\cr or \\newline. Because they have the\n// same signature, we implement them as one megafunction, with newRow\n// indicating whether we're in the \\cr case, and newLine indicating whether\n// to break the line in the \\newline case.\n\ndefineFunction({\n type: \"cr\",\n names: [\"\\\\cr\", \"\\\\newline\"],\n props: {\n numArgs: 0,\n numOptionalArgs: 1,\n argTypes: [\"size\"],\n allowedInText: true\n },\n handler: function handler(_ref, args, optArgs) {\n var parser = _ref.parser,\n funcName = _ref.funcName;\n var size = optArgs[0];\n var newRow = funcName === \"\\\\cr\";\n var newLine = false;\n\n if (!newRow) {\n if (parser.settings.displayMode && parser.settings.useStrictBehavior(\"newLineInDisplayMode\", \"In LaTeX, \\\\\\\\ or \\\\newline \" + \"does nothing in display mode\")) {\n newLine = false;\n } else {\n newLine = true;\n }\n }\n\n return {\n type: \"cr\",\n mode: parser.mode,\n newLine: newLine,\n newRow: newRow,\n size: size && assertNodeType(size, \"size\").value\n };\n },\n // The following builders are called only at the top level,\n // not within tabular/array environments.\n htmlBuilder: function htmlBuilder(group, options) {\n if (group.newRow) {\n throw new src_ParseError(\"\\\\cr valid only within a tabular/array environment\");\n }\n\n var span = buildCommon.makeSpan([\"mspace\"], [], options);\n\n if (group.newLine) {\n span.classes.push(\"newline\");\n\n if (group.size) {\n span.style.marginTop = units_calculateSize(group.size, options) + \"em\";\n }\n }\n\n return span;\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var node = new mathMLTree.MathNode(\"mspace\");\n\n if (group.newLine) {\n node.setAttribute(\"linebreak\", \"newline\");\n\n if (group.size) {\n node.setAttribute(\"height\", units_calculateSize(group.size, options) + \"em\");\n }\n }\n\n return node;\n }\n});\n// CONCATENATED MODULE: ./src/delimiter.js\n/**\n * This file deals with creating delimiters of various sizes. The TeXbook\n * discusses these routines on page 441-442, in the \"Another subroutine sets box\n * x to a specified variable delimiter\" paragraph.\n *\n * There are three main routines here. `makeSmallDelim` makes a delimiter in the\n * normal font, but in either text, script, or scriptscript style.\n * `makeLargeDelim` makes a delimiter in textstyle, but in one of the Size1,\n * Size2, Size3, or Size4 fonts. `makeStackedDelim` makes a delimiter out of\n * smaller pieces that are stacked on top of one another.\n *\n * The functions take a parameter `center`, which determines if the delimiter\n * should be centered around the axis.\n *\n * Then, there are three exposed functions. `sizedDelim` makes a delimiter in\n * one of the given sizes. This is used for things like `\\bigl`.\n * `customSizedDelim` makes a delimiter with a given total height+depth. It is\n * called in places like `\\sqrt`. `leftRightDelim` makes an appropriate\n * delimiter which surrounds an expression of a given height an depth. It is\n * used in `\\left` and `\\right`.\n */\n\n\n\n\n\n\n\n\n\n/**\n * Get the metrics for a given symbol and font, after transformation (i.e.\n * after following replacement from symbols.js)\n */\nvar delimiter_getMetrics = function getMetrics(symbol, font, mode) {\n var replace = src_symbols.math[symbol] && src_symbols.math[symbol].replace;\n var metrics = getCharacterMetrics(replace || symbol, font, mode);\n\n if (!metrics) {\n throw new Error(\"Unsupported symbol \" + symbol + \" and font size \" + font + \".\");\n }\n\n return metrics;\n};\n/**\n * Puts a delimiter span in a given style, and adds appropriate height, depth,\n * and maxFontSizes.\n */\n\n\nvar delimiter_styleWrap = function styleWrap(delim, toStyle, options, classes) {\n var newOptions = options.havingBaseStyle(toStyle);\n var span = buildCommon.makeSpan(classes.concat(newOptions.sizingClasses(options)), [delim], options);\n var delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier;\n span.height *= delimSizeMultiplier;\n span.depth *= delimSizeMultiplier;\n span.maxFontSize = newOptions.sizeMultiplier;\n return span;\n};\n\nvar centerSpan = function centerSpan(span, options, style) {\n var newOptions = options.havingBaseStyle(style);\n var shift = (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * options.fontMetrics().axisHeight;\n span.classes.push(\"delimcenter\");\n span.style.top = shift + \"em\";\n span.height -= shift;\n span.depth += shift;\n};\n/**\n * Makes a small delimiter. This is a delimiter that comes in the Main-Regular\n * font, but is restyled to either be in textstyle, scriptstyle, or\n * scriptscriptstyle.\n */\n\n\nvar delimiter_makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode, classes) {\n var text = buildCommon.makeSymbol(delim, \"Main-Regular\", mode, options);\n var span = delimiter_styleWrap(text, style, options, classes);\n\n if (center) {\n centerSpan(span, options, style);\n }\n\n return span;\n};\n/**\n * Builds a symbol in the given font size (note size is an integer)\n */\n\n\nvar delimiter_mathrmSize = function mathrmSize(value, size, mode, options) {\n return buildCommon.makeSymbol(value, \"Size\" + size + \"-Regular\", mode, options);\n};\n/**\n * Makes a large delimiter. This is a delimiter that comes in the Size1, Size2,\n * Size3, or Size4 fonts. It is always rendered in textstyle.\n */\n\n\nvar delimiter_makeLargeDelim = function makeLargeDelim(delim, size, center, options, mode, classes) {\n var inner = delimiter_mathrmSize(delim, size, mode, options);\n var span = delimiter_styleWrap(buildCommon.makeSpan([\"delimsizing\", \"size\" + size], [inner], options), src_Style.TEXT, options, classes);\n\n if (center) {\n centerSpan(span, options, src_Style.TEXT);\n }\n\n return span;\n};\n/**\n * Make an inner span with the given offset and in the given font. This is used\n * in `makeStackedDelim` to make the stacking pieces for the delimiter.\n */\n\n\nvar delimiter_makeInner = function makeInner(symbol, font, mode) {\n var sizeClass; // Apply the correct CSS class to choose the right font.\n\n if (font === \"Size1-Regular\") {\n sizeClass = \"delim-size1\";\n } else\n /* if (font === \"Size4-Regular\") */\n {\n sizeClass = \"delim-size4\";\n }\n\n var inner = buildCommon.makeSpan([\"delimsizinginner\", sizeClass], [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]); // Since this will be passed into `makeVList` in the end, wrap the element\n // in the appropriate tag that VList uses.\n\n return {\n type: \"elem\",\n elem: inner\n };\n}; // Helper for makeStackedDelim\n\n\nvar lap = {\n type: \"kern\",\n size: -0.005\n};\n/**\n * Make a stacked delimiter out of a given delimiter, with the total height at\n * least `heightTotal`. This routine is mentioned on page 442 of the TeXbook.\n */\n\nvar delimiter_makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, options, mode, classes) {\n // There are four parts, the top, an optional middle, a repeated part, and a\n // bottom.\n var top;\n var middle;\n var repeat;\n var bottom;\n top = repeat = bottom = delim;\n middle = null; // Also keep track of what font the delimiters are in\n\n var font = \"Size1-Regular\"; // We set the parts and font based on the symbol. Note that we use\n // '\\u23d0' instead of '|' and '\\u2016' instead of '\\\\|' for the\n // repeats of the arrows\n\n if (delim === \"\\\\uparrow\") {\n repeat = bottom = \"\\u23D0\";\n } else if (delim === \"\\\\Uparrow\") {\n repeat = bottom = \"\\u2016\";\n } else if (delim === \"\\\\downarrow\") {\n top = repeat = \"\\u23D0\";\n } else if (delim === \"\\\\Downarrow\") {\n top = repeat = \"\\u2016\";\n } else if (delim === \"\\\\updownarrow\") {\n top = \"\\\\uparrow\";\n repeat = \"\\u23D0\";\n bottom = \"\\\\downarrow\";\n } else if (delim === \"\\\\Updownarrow\") {\n top = \"\\\\Uparrow\";\n repeat = \"\\u2016\";\n bottom = \"\\\\Downarrow\";\n } else if (delim === \"[\" || delim === \"\\\\lbrack\") {\n top = \"\\u23A1\";\n repeat = \"\\u23A2\";\n bottom = \"\\u23A3\";\n font = \"Size4-Regular\";\n } else if (delim === \"]\" || delim === \"\\\\rbrack\") {\n top = \"\\u23A4\";\n repeat = \"\\u23A5\";\n bottom = \"\\u23A6\";\n font = \"Size4-Regular\";\n } else if (delim === \"\\\\lfloor\" || delim === \"\\u230A\") {\n repeat = top = \"\\u23A2\";\n bottom = \"\\u23A3\";\n font = \"Size4-Regular\";\n } else if (delim === \"\\\\lceil\" || delim === \"\\u2308\") {\n top = \"\\u23A1\";\n repeat = bottom = \"\\u23A2\";\n font = \"Size4-Regular\";\n } else if (delim === \"\\\\rfloor\" || delim === \"\\u230B\") {\n repeat = top = \"\\u23A5\";\n bottom = \"\\u23A6\";\n font = \"Size4-Regular\";\n } else if (delim === \"\\\\rceil\" || delim === \"\\u2309\") {\n top = \"\\u23A4\";\n repeat = bottom = \"\\u23A5\";\n font = \"Size4-Regular\";\n } else if (delim === \"(\" || delim === \"\\\\lparen\") {\n top = \"\\u239B\";\n repeat = \"\\u239C\";\n bottom = \"\\u239D\";\n font = \"Size4-Regular\";\n } else if (delim === \")\" || delim === \"\\\\rparen\") {\n top = \"\\u239E\";\n repeat = \"\\u239F\";\n bottom = \"\\u23A0\";\n font = \"Size4-Regular\";\n } else if (delim === \"\\\\{\" || delim === \"\\\\lbrace\") {\n top = \"\\u23A7\";\n middle = \"\\u23A8\";\n bottom = \"\\u23A9\";\n repeat = \"\\u23AA\";\n font = \"Size4-Regular\";\n } else if (delim === \"\\\\}\" || delim === \"\\\\rbrace\") {\n top = \"\\u23AB\";\n middle = \"\\u23AC\";\n bottom = \"\\u23AD\";\n repeat = \"\\u23AA\";\n font = \"Size4-Regular\";\n } else if (delim === \"\\\\lgroup\" || delim === \"\\u27EE\") {\n top = \"\\u23A7\";\n bottom = \"\\u23A9\";\n repeat = \"\\u23AA\";\n font = \"Size4-Regular\";\n } else if (delim === \"\\\\rgroup\" || delim === \"\\u27EF\") {\n top = \"\\u23AB\";\n bottom = \"\\u23AD\";\n repeat = \"\\u23AA\";\n font = \"Size4-Regular\";\n } else if (delim === \"\\\\lmoustache\" || delim === \"\\u23B0\") {\n top = \"\\u23A7\";\n bottom = \"\\u23AD\";\n repeat = \"\\u23AA\";\n font = \"Size4-Regular\";\n } else if (delim === \"\\\\rmoustache\" || delim === \"\\u23B1\") {\n top = \"\\u23AB\";\n bottom = \"\\u23A9\";\n repeat = \"\\u23AA\";\n font = \"Size4-Regular\";\n } // Get the metrics of the four sections\n\n\n var topMetrics = delimiter_getMetrics(top, font, mode);\n var topHeightTotal = topMetrics.height + topMetrics.depth;\n var repeatMetrics = delimiter_getMetrics(repeat, font, mode);\n var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth;\n var bottomMetrics = delimiter_getMetrics(bottom, font, mode);\n var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth;\n var middleHeightTotal = 0;\n var middleFactor = 1;\n\n if (middle !== null) {\n var middleMetrics = delimiter_getMetrics(middle, font, mode);\n middleHeightTotal = middleMetrics.height + middleMetrics.depth;\n middleFactor = 2; // repeat symmetrically above and below middle\n } // Calcuate the minimal height that the delimiter can have.\n // It is at least the size of the top, bottom, and optional middle combined.\n\n\n var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal; // Compute the number of copies of the repeat symbol we will need\n\n var repeatCount = Math.max(0, Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal))); // Compute the total height of the delimiter including all the symbols\n\n var realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal; // The center of the delimiter is placed at the center of the axis. Note\n // that in this context, \"center\" means that the delimiter should be\n // centered around the axis in the current style, while normally it is\n // centered around the axis in textstyle.\n\n var axisHeight = options.fontMetrics().axisHeight;\n\n if (center) {\n axisHeight *= options.sizeMultiplier;\n } // Calculate the depth\n\n\n var depth = realHeightTotal / 2 - axisHeight; // This function differs from the TeX procedure in one way.\n // We shift each repeat element downwards by 0.005em, to prevent a gap\n // due to browser floating point rounding error.\n // Then, at the last element-to element joint, we add one extra repeat\n // element to cover the gap created by the shifts.\n // Find the shift needed to align the upper end of the extra element at a point\n // 0.005em above the lower end of the top element.\n\n var shiftOfExtraElement = (repeatCount + 1) * 0.005 - repeatHeightTotal; // Now, we start building the pieces that will go into the vlist\n // Keep a list of the inner pieces\n\n var inners = []; // Add the bottom symbol\n\n inners.push(delimiter_makeInner(bottom, font, mode));\n\n if (middle === null) {\n // Add that many symbols\n for (var i = 0; i < repeatCount; i++) {\n inners.push(lap); // overlap\n\n inners.push(delimiter_makeInner(repeat, font, mode));\n }\n } else {\n // When there is a middle bit, we need the middle part and two repeated\n // sections\n for (var _i = 0; _i < repeatCount; _i++) {\n inners.push(lap);\n inners.push(delimiter_makeInner(repeat, font, mode));\n } // Insert one extra repeat element.\n\n\n inners.push({\n type: \"kern\",\n size: shiftOfExtraElement\n });\n inners.push(delimiter_makeInner(repeat, font, mode));\n inners.push(lap); // Now insert the middle of the brace.\n\n inners.push(delimiter_makeInner(middle, font, mode));\n\n for (var _i2 = 0; _i2 < repeatCount; _i2++) {\n inners.push(lap);\n inners.push(delimiter_makeInner(repeat, font, mode));\n }\n } // To cover the gap create by the overlaps, insert one more repeat element,\n // at a position that juts 0.005 above the bottom of the top element.\n\n\n inners.push({\n type: \"kern\",\n size: shiftOfExtraElement\n });\n inners.push(delimiter_makeInner(repeat, font, mode));\n inners.push(lap); // Add the top symbol\n\n inners.push(delimiter_makeInner(top, font, mode)); // Finally, build the vlist\n\n var newOptions = options.havingBaseStyle(src_Style.TEXT);\n var inner = buildCommon.makeVList({\n positionType: \"bottom\",\n positionData: depth,\n children: inners\n }, newOptions);\n return delimiter_styleWrap(buildCommon.makeSpan([\"delimsizing\", \"mult\"], [inner], newOptions), src_Style.TEXT, options, classes);\n}; // All surds have 0.08em padding above the viniculum inside the SVG.\n// That keeps browser span height rounding error from pinching the line.\n\n\nvar vbPad = 80; // padding above the surd, measured inside the viewBox.\n\nvar emPad = 0.08; // padding, in ems, measured in the document.\n\nvar delimiter_sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraViniculum, options) {\n var path = sqrtPath(sqrtName, extraViniculum, viewBoxHeight);\n var pathNode = new domTree_PathNode(sqrtName, path);\n var svg = new SvgNode([pathNode], {\n // Note: 1000:1 ratio of viewBox to document em width.\n \"width\": \"400em\",\n \"height\": height + \"em\",\n \"viewBox\": \"0 0 400000 \" + viewBoxHeight,\n \"preserveAspectRatio\": \"xMinYMin slice\"\n });\n return buildCommon.makeSvgSpan([\"hide-tail\"], [svg], options);\n};\n/**\n * Make a sqrt image of the given height,\n */\n\n\nvar makeSqrtImage = function makeSqrtImage(height, options) {\n // Define a newOptions that removes the effect of size changes such as \\Huge.\n // We don't pick different a height surd for \\Huge. For it, we scale up.\n var newOptions = options.havingBaseSizing(); // Pick the desired surd glyph from a sequence of surds.\n\n var delim = traverseSequence(\"\\\\surd\", height * newOptions.sizeMultiplier, stackLargeDelimiterSequence, newOptions);\n var sizeMultiplier = newOptions.sizeMultiplier; // default\n // The standard sqrt SVGs each have a 0.04em thick viniculum.\n // If Settings.minRuleThickness is larger than that, we add extraViniculum.\n\n var extraViniculum = Math.max(0, options.minRuleThickness - options.fontMetrics().sqrtRuleThickness); // Create a span containing an SVG image of a sqrt symbol.\n\n var span;\n var spanHeight = 0;\n var texHeight = 0;\n var viewBoxHeight = 0;\n var advanceWidth; // We create viewBoxes with 80 units of \"padding\" above each surd.\n // Then browser rounding error on the parent span height will not\n // encroach on the ink of the viniculum. But that padding is not\n // included in the TeX-like `height` used for calculation of\n // vertical alignment. So texHeight = span.height < span.style.height.\n\n if (delim.type === \"small\") {\n // Get an SVG that is derived from glyph U+221A in font KaTeX-Main.\n // 1000 unit normal glyph height.\n viewBoxHeight = 1000 + 1000 * extraViniculum + vbPad;\n\n if (height < 1.0) {\n sizeMultiplier = 1.0; // mimic a \\textfont radical\n } else if (height < 1.4) {\n sizeMultiplier = 0.7; // mimic a \\scriptfont radical\n }\n\n spanHeight = (1.0 + extraViniculum + emPad) / sizeMultiplier;\n texHeight = (1.00 + extraViniculum) / sizeMultiplier;\n span = delimiter_sqrtSvg(\"sqrtMain\", spanHeight, viewBoxHeight, extraViniculum, options);\n span.style.minWidth = \"0.853em\";\n advanceWidth = 0.833 / sizeMultiplier; // from the font.\n } else if (delim.type === \"large\") {\n // These SVGs come from fonts: KaTeX_Size1, _Size2, etc.\n viewBoxHeight = (1000 + vbPad) * sizeToMaxHeight[delim.size];\n texHeight = (sizeToMaxHeight[delim.size] + extraViniculum) / sizeMultiplier;\n spanHeight = (sizeToMaxHeight[delim.size] + extraViniculum + emPad) / sizeMultiplier;\n span = delimiter_sqrtSvg(\"sqrtSize\" + delim.size, spanHeight, viewBoxHeight, extraViniculum, options);\n span.style.minWidth = \"1.02em\";\n advanceWidth = 1.0 / sizeMultiplier; // 1.0 from the font.\n } else {\n // Tall sqrt. In TeX, this would be stacked using multiple glyphs.\n // We'll use a single SVG to accomplish the same thing.\n spanHeight = height + extraViniculum + emPad;\n texHeight = height + extraViniculum;\n viewBoxHeight = Math.floor(1000 * height + extraViniculum) + vbPad;\n span = delimiter_sqrtSvg(\"sqrtTall\", spanHeight, viewBoxHeight, extraViniculum, options);\n span.style.minWidth = \"0.742em\";\n advanceWidth = 1.056;\n }\n\n span.height = texHeight;\n span.style.height = spanHeight + \"em\";\n return {\n span: span,\n advanceWidth: advanceWidth,\n // Calculate the actual line width.\n // This actually should depend on the chosen font -- e.g. \\boldmath\n // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and\n // have thicker rules.\n ruleWidth: (options.fontMetrics().sqrtRuleThickness + extraViniculum) * sizeMultiplier\n };\n}; // There are three kinds of delimiters, delimiters that stack when they become\n// too large\n\n\nvar stackLargeDelimiters = [\"(\", \"\\\\lparen\", \")\", \"\\\\rparen\", \"[\", \"\\\\lbrack\", \"]\", \"\\\\rbrack\", \"\\\\{\", \"\\\\lbrace\", \"\\\\}\", \"\\\\rbrace\", \"\\\\lfloor\", \"\\\\rfloor\", \"\\u230A\", \"\\u230B\", \"\\\\lceil\", \"\\\\rceil\", \"\\u2308\", \"\\u2309\", \"\\\\surd\"]; // delimiters that always stack\n\nvar stackAlwaysDelimiters = [\"\\\\uparrow\", \"\\\\downarrow\", \"\\\\updownarrow\", \"\\\\Uparrow\", \"\\\\Downarrow\", \"\\\\Updownarrow\", \"|\", \"\\\\|\", \"\\\\vert\", \"\\\\Vert\", \"\\\\lvert\", \"\\\\rvert\", \"\\\\lVert\", \"\\\\rVert\", \"\\\\lgroup\", \"\\\\rgroup\", \"\\u27EE\", \"\\u27EF\", \"\\\\lmoustache\", \"\\\\rmoustache\", \"\\u23B0\", \"\\u23B1\"]; // and delimiters that never stack\n\nvar stackNeverDelimiters = [\"<\", \">\", \"\\\\langle\", \"\\\\rangle\", \"/\", \"\\\\backslash\", \"\\\\lt\", \"\\\\gt\"]; // Metrics of the different sizes. Found by looking at TeX's output of\n// $\\bigl| // \\Bigl| \\biggl| \\Biggl| \\showlists$\n// Used to create stacked delimiters of appropriate sizes in makeSizedDelim.\n\nvar sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0];\n/**\n * Used to create a delimiter of a specific size, where `size` is 1, 2, 3, or 4.\n */\n\nvar delimiter_makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes) {\n // < and > turn into \\langle and \\rangle in delimiters\n if (delim === \"<\" || delim === \"\\\\lt\" || delim === \"\\u27E8\") {\n delim = \"\\\\langle\";\n } else if (delim === \">\" || delim === \"\\\\gt\" || delim === \"\\u27E9\") {\n delim = \"\\\\rangle\";\n } // Sized delimiters are never centered.\n\n\n if (utils.contains(stackLargeDelimiters, delim) || utils.contains(stackNeverDelimiters, delim)) {\n return delimiter_makeLargeDelim(delim, size, false, options, mode, classes);\n } else if (utils.contains(stackAlwaysDelimiters, delim)) {\n return delimiter_makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes);\n } else {\n throw new src_ParseError(\"Illegal delimiter: '\" + delim + \"'\");\n }\n};\n/**\n * There are three different sequences of delimiter sizes that the delimiters\n * follow depending on the kind of delimiter. This is used when creating custom\n * sized delimiters to decide whether to create a small, large, or stacked\n * delimiter.\n *\n * In real TeX, these sequences aren't explicitly defined, but are instead\n * defined inside the font metrics. Since there are only three sequences that\n * are possible for the delimiters that TeX defines, it is easier to just encode\n * them explicitly here.\n */\n\n\n// Delimiters that never stack try small delimiters and large delimiters only\nvar stackNeverDelimiterSequence = [{\n type: \"small\",\n style: src_Style.SCRIPTSCRIPT\n}, {\n type: \"small\",\n style: src_Style.SCRIPT\n}, {\n type: \"small\",\n style: src_Style.TEXT\n}, {\n type: \"large\",\n size: 1\n}, {\n type: \"large\",\n size: 2\n}, {\n type: \"large\",\n size: 3\n}, {\n type: \"large\",\n size: 4\n}]; // Delimiters that always stack try the small delimiters first, then stack\n\nvar stackAlwaysDelimiterSequence = [{\n type: \"small\",\n style: src_Style.SCRIPTSCRIPT\n}, {\n type: \"small\",\n style: src_Style.SCRIPT\n}, {\n type: \"small\",\n style: src_Style.TEXT\n}, {\n type: \"stack\"\n}]; // Delimiters that stack when large try the small and then large delimiters, and\n// stack afterwards\n\nvar stackLargeDelimiterSequence = [{\n type: \"small\",\n style: src_Style.SCRIPTSCRIPT\n}, {\n type: \"small\",\n style: src_Style.SCRIPT\n}, {\n type: \"small\",\n style: src_Style.TEXT\n}, {\n type: \"large\",\n size: 1\n}, {\n type: \"large\",\n size: 2\n}, {\n type: \"large\",\n size: 3\n}, {\n type: \"large\",\n size: 4\n}, {\n type: \"stack\"\n}];\n/**\n * Get the font used in a delimiter based on what kind of delimiter it is.\n * TODO(#963) Use more specific font family return type once that is introduced.\n */\n\nvar delimTypeToFont = function delimTypeToFont(type) {\n if (type.type === \"small\") {\n return \"Main-Regular\";\n } else if (type.type === \"large\") {\n return \"Size\" + type.size + \"-Regular\";\n } else if (type.type === \"stack\") {\n return \"Size4-Regular\";\n } else {\n throw new Error(\"Add support for delim type '\" + type.type + \"' here.\");\n }\n};\n/**\n * Traverse a sequence of types of delimiters to decide what kind of delimiter\n * should be used to create a delimiter of the given height+depth.\n */\n\n\nvar traverseSequence = function traverseSequence(delim, height, sequence, options) {\n // Here, we choose the index we should start at in the sequences. In smaller\n // sizes (which correspond to larger numbers in style.size) we start earlier\n // in the sequence. Thus, scriptscript starts at index 3-3=0, script starts\n // at index 3-2=1, text starts at 3-1=2, and display starts at min(2,3-0)=2\n var start = Math.min(2, 3 - options.style.size);\n\n for (var i = start; i < sequence.length; i++) {\n if (sequence[i].type === \"stack\") {\n // This is always the last delimiter, so we just break the loop now.\n break;\n }\n\n var metrics = delimiter_getMetrics(delim, delimTypeToFont(sequence[i]), \"math\");\n var heightDepth = metrics.height + metrics.depth; // Small delimiters are scaled down versions of the same font, so we\n // account for the style change size.\n\n if (sequence[i].type === \"small\") {\n var newOptions = options.havingBaseStyle(sequence[i].style);\n heightDepth *= newOptions.sizeMultiplier;\n } // Check if the delimiter at this size works for the given height.\n\n\n if (heightDepth > height) {\n return sequence[i];\n }\n } // If we reached the end of the sequence, return the last sequence element.\n\n\n return sequence[sequence.length - 1];\n};\n/**\n * Make a delimiter of a given height+depth, with optional centering. Here, we\n * traverse the sequences, and create a delimiter that the sequence tells us to.\n */\n\n\nvar delimiter_makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center, options, mode, classes) {\n if (delim === \"<\" || delim === \"\\\\lt\" || delim === \"\\u27E8\") {\n delim = \"\\\\langle\";\n } else if (delim === \">\" || delim === \"\\\\gt\" || delim === \"\\u27E9\") {\n delim = \"\\\\rangle\";\n } // Decide what sequence to use\n\n\n var sequence;\n\n if (utils.contains(stackNeverDelimiters, delim)) {\n sequence = stackNeverDelimiterSequence;\n } else if (utils.contains(stackLargeDelimiters, delim)) {\n sequence = stackLargeDelimiterSequence;\n } else {\n sequence = stackAlwaysDelimiterSequence;\n } // Look through the sequence\n\n\n var delimType = traverseSequence(delim, height, sequence, options); // Get the delimiter from font glyphs.\n // Depending on the sequence element we decided on, call the\n // appropriate function.\n\n if (delimType.type === \"small\") {\n return delimiter_makeSmallDelim(delim, delimType.style, center, options, mode, classes);\n } else if (delimType.type === \"large\") {\n return delimiter_makeLargeDelim(delim, delimType.size, center, options, mode, classes);\n } else\n /* if (delimType.type === \"stack\") */\n {\n return delimiter_makeStackedDelim(delim, height, center, options, mode, classes);\n }\n};\n/**\n * Make a delimiter for use with `\\left` and `\\right`, given a height and depth\n * of an expression that the delimiters surround.\n */\n\n\nvar makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, options, mode, classes) {\n // We always center \\left/\\right delimiters, so the axis is always shifted\n var axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; // Taken from TeX source, tex.web, function make_left_right\n\n var delimiterFactor = 901;\n var delimiterExtend = 5.0 / options.fontMetrics().ptPerEm;\n var maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight);\n var totalHeight = Math.max( // In real TeX, calculations are done using integral values which are\n // 65536 per pt, or 655360 per em. So, the division here truncates in\n // TeX but doesn't here, producing different results. If we wanted to\n // exactly match TeX's calculation, we could do\n // Math.floor(655360 * maxDistFromAxis / 500) *\n // delimiterFactor / 655360\n // (To see the difference, compare\n // x^{x^{\\left(\\rule{0.1em}{0.68em}\\right)}}\n // in TeX and KaTeX)\n maxDistFromAxis / 500 * delimiterFactor, 2 * maxDistFromAxis - delimiterExtend); // Finally, we defer to `makeCustomSizedDelim` with our calculated total\n // height\n\n return delimiter_makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes);\n};\n\n/* harmony default export */ var delimiter = ({\n sqrtImage: makeSqrtImage,\n sizedDelim: delimiter_makeSizedDelim,\n customSizedDelim: delimiter_makeCustomSizedDelim,\n leftRightDelim: makeLeftRightDelim\n});\n// CONCATENATED MODULE: ./src/functions/delimsizing.js\n\n\n\n\n\n\n\n\n\n// Extra data needed for the delimiter handler down below\nvar delimiterSizes = {\n \"\\\\bigl\": {\n mclass: \"mopen\",\n size: 1\n },\n \"\\\\Bigl\": {\n mclass: \"mopen\",\n size: 2\n },\n \"\\\\biggl\": {\n mclass: \"mopen\",\n size: 3\n },\n \"\\\\Biggl\": {\n mclass: \"mopen\",\n size: 4\n },\n \"\\\\bigr\": {\n mclass: \"mclose\",\n size: 1\n },\n \"\\\\Bigr\": {\n mclass: \"mclose\",\n size: 2\n },\n \"\\\\biggr\": {\n mclass: \"mclose\",\n size: 3\n },\n \"\\\\Biggr\": {\n mclass: \"mclose\",\n size: 4\n },\n \"\\\\bigm\": {\n mclass: \"mrel\",\n size: 1\n },\n \"\\\\Bigm\": {\n mclass: \"mrel\",\n size: 2\n },\n \"\\\\biggm\": {\n mclass: \"mrel\",\n size: 3\n },\n \"\\\\Biggm\": {\n mclass: \"mrel\",\n size: 4\n },\n \"\\\\big\": {\n mclass: \"mord\",\n size: 1\n },\n \"\\\\Big\": {\n mclass: \"mord\",\n size: 2\n },\n \"\\\\bigg\": {\n mclass: \"mord\",\n size: 3\n },\n \"\\\\Bigg\": {\n mclass: \"mord\",\n size: 4\n }\n};\nvar delimiters = [\"(\", \"\\\\lparen\", \")\", \"\\\\rparen\", \"[\", \"\\\\lbrack\", \"]\", \"\\\\rbrack\", \"\\\\{\", \"\\\\lbrace\", \"\\\\}\", \"\\\\rbrace\", \"\\\\lfloor\", \"\\\\rfloor\", \"\\u230A\", \"\\u230B\", \"\\\\lceil\", \"\\\\rceil\", \"\\u2308\", \"\\u2309\", \"<\", \">\", \"\\\\langle\", \"\\u27E8\", \"\\\\rangle\", \"\\u27E9\", \"\\\\lt\", \"\\\\gt\", \"\\\\lvert\", \"\\\\rvert\", \"\\\\lVert\", \"\\\\rVert\", \"\\\\lgroup\", \"\\\\rgroup\", \"\\u27EE\", \"\\u27EF\", \"\\\\lmoustache\", \"\\\\rmoustache\", \"\\u23B0\", \"\\u23B1\", \"/\", \"\\\\backslash\", \"|\", \"\\\\vert\", \"\\\\|\", \"\\\\Vert\", \"\\\\uparrow\", \"\\\\Uparrow\", \"\\\\downarrow\", \"\\\\Downarrow\", \"\\\\updownarrow\", \"\\\\Updownarrow\", \".\"];\n\n// Delimiter functions\nfunction checkDelimiter(delim, context) {\n var symDelim = checkSymbolNodeType(delim);\n\n if (symDelim && utils.contains(delimiters, symDelim.text)) {\n return symDelim;\n } else {\n throw new src_ParseError(\"Invalid delimiter: '\" + (symDelim ? symDelim.text : JSON.stringify(delim)) + \"' after '\" + context.funcName + \"'\", delim);\n }\n}\n\ndefineFunction({\n type: \"delimsizing\",\n names: [\"\\\\bigl\", \"\\\\Bigl\", \"\\\\biggl\", \"\\\\Biggl\", \"\\\\bigr\", \"\\\\Bigr\", \"\\\\biggr\", \"\\\\Biggr\", \"\\\\bigm\", \"\\\\Bigm\", \"\\\\biggm\", \"\\\\Biggm\", \"\\\\big\", \"\\\\Big\", \"\\\\bigg\", \"\\\\Bigg\"],\n props: {\n numArgs: 1\n },\n handler: function handler(context, args) {\n var delim = checkDelimiter(args[0], context);\n return {\n type: \"delimsizing\",\n mode: context.parser.mode,\n size: delimiterSizes[context.funcName].size,\n mclass: delimiterSizes[context.funcName].mclass,\n delim: delim.text\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n if (group.delim === \".\") {\n // Empty delimiters still count as elements, even though they don't\n // show anything.\n return buildCommon.makeSpan([group.mclass]);\n } // Use delimiter.sizedDelim to generate the delimiter.\n\n\n return delimiter.sizedDelim(group.delim, group.size, options, group.mode, [group.mclass]);\n },\n mathmlBuilder: function mathmlBuilder(group) {\n var children = [];\n\n if (group.delim !== \".\") {\n children.push(buildMathML_makeText(group.delim, group.mode));\n }\n\n var node = new mathMLTree.MathNode(\"mo\", children);\n\n if (group.mclass === \"mopen\" || group.mclass === \"mclose\") {\n // Only some of the delimsizing functions act as fences, and they\n // return \"mopen\" or \"mclose\" mclass.\n node.setAttribute(\"fence\", \"true\");\n } else {\n // Explicitly disable fencing if it's not a fence, to override the\n // defaults.\n node.setAttribute(\"fence\", \"false\");\n }\n\n return node;\n }\n});\n\nfunction assertParsed(group) {\n if (!group.body) {\n throw new Error(\"Bug: The leftright ParseNode wasn't fully parsed.\");\n }\n}\n\ndefineFunction({\n type: \"leftright-right\",\n names: [\"\\\\right\"],\n props: {\n numArgs: 1\n },\n handler: function handler(context, args) {\n // \\left case below triggers parsing of \\right in\n // `const right = parser.parseFunction();`\n // uses this return value.\n var color = context.parser.gullet.macros.get(\"\\\\current@color\");\n\n if (color && typeof color !== \"string\") {\n throw new src_ParseError(\"\\\\current@color set to non-string in \\\\right\");\n }\n\n return {\n type: \"leftright-right\",\n mode: context.parser.mode,\n delim: checkDelimiter(args[0], context).text,\n color: color // undefined if not set via \\color\n\n };\n }\n});\ndefineFunction({\n type: \"leftright\",\n names: [\"\\\\left\"],\n props: {\n numArgs: 1\n },\n handler: function handler(context, args) {\n var delim = checkDelimiter(args[0], context);\n var parser = context.parser; // Parse out the implicit body\n\n ++parser.leftrightDepth; // parseExpression stops before '\\\\right'\n\n var body = parser.parseExpression(false);\n --parser.leftrightDepth; // Check the next token\n\n parser.expect(\"\\\\right\", false);\n var right = assertNodeType(parser.parseFunction(), \"leftright-right\");\n return {\n type: \"leftright\",\n mode: parser.mode,\n body: body,\n left: delim.text,\n right: right.delim,\n rightColor: right.color\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n assertParsed(group); // Build the inner expression\n\n var inner = buildHTML_buildExpression(group.body, options, true, [\"mopen\", \"mclose\"]);\n var innerHeight = 0;\n var innerDepth = 0;\n var hadMiddle = false; // Calculate its height and depth\n\n for (var i = 0; i < inner.length; i++) {\n // Property `isMiddle` not defined on `span`. See comment in\n // \"middle\"'s htmlBuilder.\n // $FlowFixMe\n if (inner[i].isMiddle) {\n hadMiddle = true;\n } else {\n innerHeight = Math.max(inner[i].height, innerHeight);\n innerDepth = Math.max(inner[i].depth, innerDepth);\n }\n } // The size of delimiters is the same, regardless of what style we are\n // in. Thus, to correctly calculate the size of delimiter we need around\n // a group, we scale down the inner size based on the size.\n\n\n innerHeight *= options.sizeMultiplier;\n innerDepth *= options.sizeMultiplier;\n var leftDelim;\n\n if (group.left === \".\") {\n // Empty delimiters in \\left and \\right make null delimiter spaces.\n leftDelim = makeNullDelimiter(options, [\"mopen\"]);\n } else {\n // Otherwise, use leftRightDelim to generate the correct sized\n // delimiter.\n leftDelim = delimiter.leftRightDelim(group.left, innerHeight, innerDepth, options, group.mode, [\"mopen\"]);\n } // Add it to the beginning of the expression\n\n\n inner.unshift(leftDelim); // Handle middle delimiters\n\n if (hadMiddle) {\n for (var _i = 1; _i < inner.length; _i++) {\n var middleDelim = inner[_i]; // Property `isMiddle` not defined on `span`. See comment in\n // \"middle\"'s htmlBuilder.\n // $FlowFixMe\n\n var isMiddle = middleDelim.isMiddle;\n\n if (isMiddle) {\n // Apply the options that were active when \\middle was called\n inner[_i] = delimiter.leftRightDelim(isMiddle.delim, innerHeight, innerDepth, isMiddle.options, group.mode, []);\n }\n }\n }\n\n var rightDelim; // Same for the right delimiter, but using color specified by \\color\n\n if (group.right === \".\") {\n rightDelim = makeNullDelimiter(options, [\"mclose\"]);\n } else {\n var colorOptions = group.rightColor ? options.withColor(group.rightColor) : options;\n rightDelim = delimiter.leftRightDelim(group.right, innerHeight, innerDepth, colorOptions, group.mode, [\"mclose\"]);\n } // Add it to the end of the expression.\n\n\n inner.push(rightDelim);\n return buildCommon.makeSpan([\"minner\"], inner, options);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n assertParsed(group);\n var inner = buildMathML_buildExpression(group.body, options);\n\n if (group.left !== \".\") {\n var leftNode = new mathMLTree.MathNode(\"mo\", [buildMathML_makeText(group.left, group.mode)]);\n leftNode.setAttribute(\"fence\", \"true\");\n inner.unshift(leftNode);\n }\n\n if (group.right !== \".\") {\n var rightNode = new mathMLTree.MathNode(\"mo\", [buildMathML_makeText(group.right, group.mode)]);\n rightNode.setAttribute(\"fence\", \"true\");\n\n if (group.rightColor) {\n rightNode.setAttribute(\"mathcolor\", group.rightColor);\n }\n\n inner.push(rightNode);\n }\n\n return buildMathML_makeRow(inner);\n }\n});\ndefineFunction({\n type: \"middle\",\n names: [\"\\\\middle\"],\n props: {\n numArgs: 1\n },\n handler: function handler(context, args) {\n var delim = checkDelimiter(args[0], context);\n\n if (!context.parser.leftrightDepth) {\n throw new src_ParseError(\"\\\\middle without preceding \\\\left\", delim);\n }\n\n return {\n type: \"middle\",\n mode: context.parser.mode,\n delim: delim.text\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n var middleDelim;\n\n if (group.delim === \".\") {\n middleDelim = makeNullDelimiter(options, []);\n } else {\n middleDelim = delimiter.sizedDelim(group.delim, 1, options, group.mode, []);\n var isMiddle = {\n delim: group.delim,\n options: options\n }; // Property `isMiddle` not defined on `span`. It is only used in\n // this file above.\n // TODO: Fix this violation of the `span` type and possibly rename\n // things since `isMiddle` sounds like a boolean, but is a struct.\n // $FlowFixMe\n\n middleDelim.isMiddle = isMiddle;\n }\n\n return middleDelim;\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n // A Firefox \\middle will strech a character vertically only if it\n // is in the fence part of the operator dictionary at:\n // https://www.w3.org/TR/MathML3/appendixc.html.\n // So we need to avoid U+2223 and use plain \"|\" instead.\n var textNode = group.delim === \"\\\\vert\" || group.delim === \"|\" ? buildMathML_makeText(\"|\", \"text\") : buildMathML_makeText(group.delim, group.mode);\n var middleNode = new mathMLTree.MathNode(\"mo\", [textNode]);\n middleNode.setAttribute(\"fence\", \"true\"); // MathML gives 5/18em spacing to each element.\n // \\middle should get delimiter spacing instead.\n\n middleNode.setAttribute(\"lspace\", \"0.05em\");\n middleNode.setAttribute(\"rspace\", \"0.05em\");\n return middleNode;\n }\n});\n// CONCATENATED MODULE: ./src/functions/enclose.js\n\n\n\n\n\n\n\n\n\nvar enclose_htmlBuilder = function htmlBuilder(group, options) {\n // \\cancel, \\bcancel, \\xcancel, \\sout, \\fbox, \\colorbox, \\fcolorbox\n // Some groups can return document fragments. Handle those by wrapping\n // them in a span.\n var inner = buildCommon.wrapFragment(buildHTML_buildGroup(group.body, options), options);\n var label = group.label.substr(1);\n var scale = options.sizeMultiplier;\n var img;\n var imgShift = 0; // In the LaTeX cancel package, line geometry is slightly different\n // depending on whether the subject is wider than it is tall, or vice versa.\n // We don't know the width of a group, so as a proxy, we test if\n // the subject is a single character. This captures most of the\n // subjects that should get the \"tall\" treatment.\n\n var isSingleChar = utils.isCharacterBox(group.body);\n\n if (label === \"sout\") {\n img = buildCommon.makeSpan([\"stretchy\", \"sout\"]);\n img.height = options.fontMetrics().defaultRuleThickness / scale;\n imgShift = -0.5 * options.fontMetrics().xHeight;\n } else {\n // Add horizontal padding\n if (/cancel/.test(label)) {\n if (!isSingleChar) {\n inner.classes.push(\"cancel-pad\");\n }\n } else {\n inner.classes.push(\"boxpad\");\n } // Add vertical padding\n\n\n var vertPad = 0;\n var ruleThickness = 0; // ref: cancel package: \\advance\\totalheight2\\p@ % \"+2\"\n\n if (/box/.test(label)) {\n ruleThickness = Math.max(options.fontMetrics().fboxrule, // default\n options.minRuleThickness // User override.\n );\n vertPad = options.fontMetrics().fboxsep + (label === \"colorbox\" ? 0 : ruleThickness);\n } else {\n vertPad = isSingleChar ? 0.2 : 0;\n }\n\n img = stretchy.encloseSpan(inner, label, vertPad, options);\n\n if (/fbox|boxed|fcolorbox/.test(label)) {\n img.style.borderStyle = \"solid\";\n img.style.borderWidth = ruleThickness + \"em\";\n }\n\n imgShift = inner.depth + vertPad;\n\n if (group.backgroundColor) {\n img.style.backgroundColor = group.backgroundColor;\n\n if (group.borderColor) {\n img.style.borderColor = group.borderColor;\n }\n }\n }\n\n var vlist;\n\n if (group.backgroundColor) {\n vlist = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: [// Put the color background behind inner;\n {\n type: \"elem\",\n elem: img,\n shift: imgShift\n }, {\n type: \"elem\",\n elem: inner,\n shift: 0\n }]\n }, options);\n } else {\n vlist = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: [// Write the \\cancel stroke on top of inner.\n {\n type: \"elem\",\n elem: inner,\n shift: 0\n }, {\n type: \"elem\",\n elem: img,\n shift: imgShift,\n wrapperClasses: /cancel/.test(label) ? [\"svg-align\"] : []\n }]\n }, options);\n }\n\n if (/cancel/.test(label)) {\n // The cancel package documentation says that cancel lines add their height\n // to the expression, but tests show that isn't how it actually works.\n vlist.height = inner.height;\n vlist.depth = inner.depth;\n }\n\n if (/cancel/.test(label) && !isSingleChar) {\n // cancel does not create horiz space for its line extension.\n return buildCommon.makeSpan([\"mord\", \"cancel-lap\"], [vlist], options);\n } else {\n return buildCommon.makeSpan([\"mord\"], [vlist], options);\n }\n};\n\nvar enclose_mathmlBuilder = function mathmlBuilder(group, options) {\n var fboxsep = 0;\n var node = new mathMLTree.MathNode(group.label.indexOf(\"colorbox\") > -1 ? \"mpadded\" : \"menclose\", [buildMathML_buildGroup(group.body, options)]);\n\n switch (group.label) {\n case \"\\\\cancel\":\n node.setAttribute(\"notation\", \"updiagonalstrike\");\n break;\n\n case \"\\\\bcancel\":\n node.setAttribute(\"notation\", \"downdiagonalstrike\");\n break;\n\n case \"\\\\sout\":\n node.setAttribute(\"notation\", \"horizontalstrike\");\n break;\n\n case \"\\\\fbox\":\n node.setAttribute(\"notation\", \"box\");\n break;\n\n case \"\\\\fcolorbox\":\n case \"\\\\colorbox\":\n // doesn't have a good notation option. So use \n // instead. Set some attributes that come included with .\n fboxsep = options.fontMetrics().fboxsep * options.fontMetrics().ptPerEm;\n node.setAttribute(\"width\", \"+\" + 2 * fboxsep + \"pt\");\n node.setAttribute(\"height\", \"+\" + 2 * fboxsep + \"pt\");\n node.setAttribute(\"lspace\", fboxsep + \"pt\"); //\n\n node.setAttribute(\"voffset\", fboxsep + \"pt\");\n\n if (group.label === \"\\\\fcolorbox\") {\n var thk = Math.max(options.fontMetrics().fboxrule, // default\n options.minRuleThickness // user override\n );\n node.setAttribute(\"style\", \"border: \" + thk + \"em solid \" + String(group.borderColor));\n }\n\n break;\n\n case \"\\\\xcancel\":\n node.setAttribute(\"notation\", \"updiagonalstrike downdiagonalstrike\");\n break;\n }\n\n if (group.backgroundColor) {\n node.setAttribute(\"mathbackground\", group.backgroundColor);\n }\n\n return node;\n};\n\ndefineFunction({\n type: \"enclose\",\n names: [\"\\\\colorbox\"],\n props: {\n numArgs: 2,\n allowedInText: true,\n greediness: 3,\n argTypes: [\"color\", \"text\"]\n },\n handler: function handler(_ref, args, optArgs) {\n var parser = _ref.parser,\n funcName = _ref.funcName;\n var color = assertNodeType(args[0], \"color-token\").color;\n var body = args[1];\n return {\n type: \"enclose\",\n mode: parser.mode,\n label: funcName,\n backgroundColor: color,\n body: body\n };\n },\n htmlBuilder: enclose_htmlBuilder,\n mathmlBuilder: enclose_mathmlBuilder\n});\ndefineFunction({\n type: \"enclose\",\n names: [\"\\\\fcolorbox\"],\n props: {\n numArgs: 3,\n allowedInText: true,\n greediness: 3,\n argTypes: [\"color\", \"color\", \"text\"]\n },\n handler: function handler(_ref2, args, optArgs) {\n var parser = _ref2.parser,\n funcName = _ref2.funcName;\n var borderColor = assertNodeType(args[0], \"color-token\").color;\n var backgroundColor = assertNodeType(args[1], \"color-token\").color;\n var body = args[2];\n return {\n type: \"enclose\",\n mode: parser.mode,\n label: funcName,\n backgroundColor: backgroundColor,\n borderColor: borderColor,\n body: body\n };\n },\n htmlBuilder: enclose_htmlBuilder,\n mathmlBuilder: enclose_mathmlBuilder\n});\ndefineFunction({\n type: \"enclose\",\n names: [\"\\\\fbox\"],\n props: {\n numArgs: 1,\n argTypes: [\"hbox\"],\n allowedInText: true\n },\n handler: function handler(_ref3, args) {\n var parser = _ref3.parser;\n return {\n type: \"enclose\",\n mode: parser.mode,\n label: \"\\\\fbox\",\n body: args[0]\n };\n }\n});\ndefineFunction({\n type: \"enclose\",\n names: [\"\\\\cancel\", \"\\\\bcancel\", \"\\\\xcancel\", \"\\\\sout\"],\n props: {\n numArgs: 1\n },\n handler: function handler(_ref4, args, optArgs) {\n var parser = _ref4.parser,\n funcName = _ref4.funcName;\n var body = args[0];\n return {\n type: \"enclose\",\n mode: parser.mode,\n label: funcName,\n body: body\n };\n },\n htmlBuilder: enclose_htmlBuilder,\n mathmlBuilder: enclose_mathmlBuilder\n});\n// CONCATENATED MODULE: ./src/defineEnvironment.js\n\n\n/**\n * All registered environments.\n * `environments.js` exports this same dictionary again and makes it public.\n * `Parser.js` requires this dictionary via `environments.js`.\n */\nvar _environments = {};\nfunction defineEnvironment(_ref) {\n var type = _ref.type,\n names = _ref.names,\n props = _ref.props,\n handler = _ref.handler,\n htmlBuilder = _ref.htmlBuilder,\n mathmlBuilder = _ref.mathmlBuilder;\n // Set default values of environments.\n var data = {\n type: type,\n numArgs: props.numArgs || 0,\n greediness: 1,\n allowedInText: false,\n numOptionalArgs: 0,\n handler: handler\n };\n\n for (var i = 0; i < names.length; ++i) {\n // TODO: The value type of _environments should be a type union of all\n // possible `EnvSpec<>` possibilities instead of `EnvSpec<*>`, which is\n // an existential type.\n // $FlowFixMe\n _environments[names[i]] = data;\n }\n\n if (htmlBuilder) {\n _htmlGroupBuilders[type] = htmlBuilder;\n }\n\n if (mathmlBuilder) {\n _mathmlGroupBuilders[type] = mathmlBuilder;\n }\n}\n// CONCATENATED MODULE: ./src/environments/array.js\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction getHLines(parser) {\n // Return an array. The array length = number of hlines.\n // Each element in the array tells if the line is dashed.\n var hlineInfo = [];\n parser.consumeSpaces();\n var nxt = parser.fetch().text;\n\n while (nxt === \"\\\\hline\" || nxt === \"\\\\hdashline\") {\n parser.consume();\n hlineInfo.push(nxt === \"\\\\hdashline\");\n parser.consumeSpaces();\n nxt = parser.fetch().text;\n }\n\n return hlineInfo;\n}\n/**\n * Parse the body of the environment, with rows delimited by \\\\ and\n * columns delimited by &, and create a nested list in row-major order\n * with one group per cell. If given an optional argument style\n * (\"text\", \"display\", etc.), then each cell is cast into that style.\n */\n\n\nfunction parseArray(parser, _ref, style) {\n var hskipBeforeAndAfter = _ref.hskipBeforeAndAfter,\n addJot = _ref.addJot,\n cols = _ref.cols,\n arraystretch = _ref.arraystretch,\n colSeparationType = _ref.colSeparationType;\n // Parse body of array with \\\\ temporarily mapped to \\cr\n parser.gullet.beginGroup();\n parser.gullet.macros.set(\"\\\\\\\\\", \"\\\\cr\"); // Get current arraystretch if it's not set by the environment\n\n if (!arraystretch) {\n var stretch = parser.gullet.expandMacroAsText(\"\\\\arraystretch\");\n\n if (stretch == null) {\n // Default \\arraystretch from lttab.dtx\n arraystretch = 1;\n } else {\n arraystretch = parseFloat(stretch);\n\n if (!arraystretch || arraystretch < 0) {\n throw new src_ParseError(\"Invalid \\\\arraystretch: \" + stretch);\n }\n }\n } // Start group for first cell\n\n\n parser.gullet.beginGroup();\n var row = [];\n var body = [row];\n var rowGaps = [];\n var hLinesBeforeRow = []; // Test for \\hline at the top of the array.\n\n hLinesBeforeRow.push(getHLines(parser));\n\n while (true) {\n // eslint-disable-line no-constant-condition\n // Parse each cell in its own group (namespace)\n var cell = parser.parseExpression(false, \"\\\\cr\");\n parser.gullet.endGroup();\n parser.gullet.beginGroup();\n cell = {\n type: \"ordgroup\",\n mode: parser.mode,\n body: cell\n };\n\n if (style) {\n cell = {\n type: \"styling\",\n mode: parser.mode,\n style: style,\n body: [cell]\n };\n }\n\n row.push(cell);\n var next = parser.fetch().text;\n\n if (next === \"&\") {\n parser.consume();\n } else if (next === \"\\\\end\") {\n // Arrays terminate newlines with `\\crcr` which consumes a `\\cr` if\n // the last line is empty.\n // NOTE: Currently, `cell` is the last item added into `row`.\n if (row.length === 1 && cell.type === \"styling\" && cell.body[0].body.length === 0) {\n body.pop();\n }\n\n if (hLinesBeforeRow.length < body.length + 1) {\n hLinesBeforeRow.push([]);\n }\n\n break;\n } else if (next === \"\\\\cr\") {\n var cr = assertNodeType(parser.parseFunction(), \"cr\");\n rowGaps.push(cr.size); // check for \\hline(s) following the row separator\n\n hLinesBeforeRow.push(getHLines(parser));\n row = [];\n body.push(row);\n } else {\n throw new src_ParseError(\"Expected & or \\\\\\\\ or \\\\cr or \\\\end\", parser.nextToken);\n }\n } // End cell group\n\n\n parser.gullet.endGroup(); // End array group defining \\\\\n\n parser.gullet.endGroup();\n return {\n type: \"array\",\n mode: parser.mode,\n addJot: addJot,\n arraystretch: arraystretch,\n body: body,\n cols: cols,\n rowGaps: rowGaps,\n hskipBeforeAndAfter: hskipBeforeAndAfter,\n hLinesBeforeRow: hLinesBeforeRow,\n colSeparationType: colSeparationType\n };\n} // Decides on a style for cells in an array according to whether the given\n// environment name starts with the letter 'd'.\n\n\nfunction dCellStyle(envName) {\n if (envName.substr(0, 1) === \"d\") {\n return \"display\";\n } else {\n return \"text\";\n }\n}\n\nvar array_htmlBuilder = function htmlBuilder(group, options) {\n var r;\n var c;\n var nr = group.body.length;\n var hLinesBeforeRow = group.hLinesBeforeRow;\n var nc = 0;\n var body = new Array(nr);\n var hlines = [];\n var ruleThickness = Math.max( // From LaTeX \\showthe\\arrayrulewidth. Equals 0.04 em.\n options.fontMetrics().arrayRuleWidth, options.minRuleThickness // User override.\n ); // Horizontal spacing\n\n var pt = 1 / options.fontMetrics().ptPerEm;\n var arraycolsep = 5 * pt; // default value, i.e. \\arraycolsep in article.cls\n\n if (group.colSeparationType && group.colSeparationType === \"small\") {\n // We're in a {smallmatrix}. Default column space is \\thickspace,\n // i.e. 5/18em = 0.2778em, per amsmath.dtx for {smallmatrix}.\n // But that needs adjustment because LaTeX applies \\scriptstyle to the\n // entire array, including the colspace, but this function applies\n // \\scriptstyle only inside each element.\n var localMultiplier = options.havingStyle(src_Style.SCRIPT).sizeMultiplier;\n arraycolsep = 0.2778 * (localMultiplier / options.sizeMultiplier);\n } // Vertical spacing\n\n\n var baselineskip = 12 * pt; // see size10.clo\n // Default \\jot from ltmath.dtx\n // TODO(edemaine): allow overriding \\jot via \\setlength (#687)\n\n var jot = 3 * pt;\n var arrayskip = group.arraystretch * baselineskip;\n var arstrutHeight = 0.7 * arrayskip; // \\strutbox in ltfsstrc.dtx and\n\n var arstrutDepth = 0.3 * arrayskip; // \\@arstrutbox in lttab.dtx\n\n var totalHeight = 0; // Set a position for \\hline(s) at the top of the array, if any.\n\n function setHLinePos(hlinesInGap) {\n for (var i = 0; i < hlinesInGap.length; ++i) {\n if (i > 0) {\n totalHeight += 0.25;\n }\n\n hlines.push({\n pos: totalHeight,\n isDashed: hlinesInGap[i]\n });\n }\n }\n\n setHLinePos(hLinesBeforeRow[0]);\n\n for (r = 0; r < group.body.length; ++r) {\n var inrow = group.body[r];\n var height = arstrutHeight; // \\@array adds an \\@arstrut\n\n var depth = arstrutDepth; // to each tow (via the template)\n\n if (nc < inrow.length) {\n nc = inrow.length;\n }\n\n var outrow = new Array(inrow.length);\n\n for (c = 0; c < inrow.length; ++c) {\n var elt = buildHTML_buildGroup(inrow[c], options);\n\n if (depth < elt.depth) {\n depth = elt.depth;\n }\n\n if (height < elt.height) {\n height = elt.height;\n }\n\n outrow[c] = elt;\n }\n\n var rowGap = group.rowGaps[r];\n var gap = 0;\n\n if (rowGap) {\n gap = units_calculateSize(rowGap, options);\n\n if (gap > 0) {\n // \\@argarraycr\n gap += arstrutDepth;\n\n if (depth < gap) {\n depth = gap; // \\@xargarraycr\n }\n\n gap = 0;\n }\n } // In AMS multiline environments such as aligned and gathered, rows\n // correspond to lines that have additional \\jot added to the\n // \\baselineskip via \\openup.\n\n\n if (group.addJot) {\n depth += jot;\n }\n\n outrow.height = height;\n outrow.depth = depth;\n totalHeight += height;\n outrow.pos = totalHeight;\n totalHeight += depth + gap; // \\@yargarraycr\n\n body[r] = outrow; // Set a position for \\hline(s), if any.\n\n setHLinePos(hLinesBeforeRow[r + 1]);\n }\n\n var offset = totalHeight / 2 + options.fontMetrics().axisHeight;\n var colDescriptions = group.cols || [];\n var cols = [];\n var colSep;\n var colDescrNum;\n\n for (c = 0, colDescrNum = 0; // Continue while either there are more columns or more column\n // descriptions, so trailing separators don't get lost.\n c < nc || colDescrNum < colDescriptions.length; ++c, ++colDescrNum) {\n var colDescr = colDescriptions[colDescrNum] || {};\n var firstSeparator = true;\n\n while (colDescr.type === \"separator\") {\n // If there is more than one separator in a row, add a space\n // between them.\n if (!firstSeparator) {\n colSep = buildCommon.makeSpan([\"arraycolsep\"], []);\n colSep.style.width = options.fontMetrics().doubleRuleSep + \"em\";\n cols.push(colSep);\n }\n\n if (colDescr.separator === \"|\" || colDescr.separator === \":\") {\n var lineType = colDescr.separator === \"|\" ? \"solid\" : \"dashed\";\n var separator = buildCommon.makeSpan([\"vertical-separator\"], [], options);\n separator.style.height = totalHeight + \"em\";\n separator.style.borderRightWidth = ruleThickness + \"em\";\n separator.style.borderRightStyle = lineType;\n separator.style.margin = \"0 -\" + ruleThickness / 2 + \"em\";\n separator.style.verticalAlign = -(totalHeight - offset) + \"em\";\n cols.push(separator);\n } else {\n throw new src_ParseError(\"Invalid separator type: \" + colDescr.separator);\n }\n\n colDescrNum++;\n colDescr = colDescriptions[colDescrNum] || {};\n firstSeparator = false;\n }\n\n if (c >= nc) {\n continue;\n }\n\n var sepwidth = void 0;\n\n if (c > 0 || group.hskipBeforeAndAfter) {\n sepwidth = utils.deflt(colDescr.pregap, arraycolsep);\n\n if (sepwidth !== 0) {\n colSep = buildCommon.makeSpan([\"arraycolsep\"], []);\n colSep.style.width = sepwidth + \"em\";\n cols.push(colSep);\n }\n }\n\n var col = [];\n\n for (r = 0; r < nr; ++r) {\n var row = body[r];\n var elem = row[c];\n\n if (!elem) {\n continue;\n }\n\n var shift = row.pos - offset;\n elem.depth = row.depth;\n elem.height = row.height;\n col.push({\n type: \"elem\",\n elem: elem,\n shift: shift\n });\n }\n\n col = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: col\n }, options);\n col = buildCommon.makeSpan([\"col-align-\" + (colDescr.align || \"c\")], [col]);\n cols.push(col);\n\n if (c < nc - 1 || group.hskipBeforeAndAfter) {\n sepwidth = utils.deflt(colDescr.postgap, arraycolsep);\n\n if (sepwidth !== 0) {\n colSep = buildCommon.makeSpan([\"arraycolsep\"], []);\n colSep.style.width = sepwidth + \"em\";\n cols.push(colSep);\n }\n }\n }\n\n body = buildCommon.makeSpan([\"mtable\"], cols); // Add \\hline(s), if any.\n\n if (hlines.length > 0) {\n var line = buildCommon.makeLineSpan(\"hline\", options, ruleThickness);\n var dashes = buildCommon.makeLineSpan(\"hdashline\", options, ruleThickness);\n var vListElems = [{\n type: \"elem\",\n elem: body,\n shift: 0\n }];\n\n while (hlines.length > 0) {\n var hline = hlines.pop();\n var lineShift = hline.pos - offset;\n\n if (hline.isDashed) {\n vListElems.push({\n type: \"elem\",\n elem: dashes,\n shift: lineShift\n });\n } else {\n vListElems.push({\n type: \"elem\",\n elem: line,\n shift: lineShift\n });\n }\n }\n\n body = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: vListElems\n }, options);\n }\n\n return buildCommon.makeSpan([\"mord\"], [body], options);\n};\n\nvar alignMap = {\n c: \"center \",\n l: \"left \",\n r: \"right \"\n};\n\nvar array_mathmlBuilder = function mathmlBuilder(group, options) {\n var table = new mathMLTree.MathNode(\"mtable\", group.body.map(function (row) {\n return new mathMLTree.MathNode(\"mtr\", row.map(function (cell) {\n return new mathMLTree.MathNode(\"mtd\", [buildMathML_buildGroup(cell, options)]);\n }));\n })); // Set column alignment, row spacing, column spacing, and\n // array lines by setting attributes on the table element.\n // Set the row spacing. In MathML, we specify a gap distance.\n // We do not use rowGap[] because MathML automatically increases\n // cell height with the height/depth of the element content.\n // LaTeX \\arraystretch multiplies the row baseline-to-baseline distance.\n // We simulate this by adding (arraystretch - 1)em to the gap. This\n // does a reasonable job of adjusting arrays containing 1 em tall content.\n // The 0.16 and 0.09 values are found emprically. They produce an array\n // similar to LaTeX and in which content does not interfere with \\hines.\n\n var gap = group.arraystretch === 0.5 ? 0.1 // {smallmatrix}, {subarray}\n : 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0);\n table.setAttribute(\"rowspacing\", gap + \"em\"); // MathML table lines go only between cells.\n // To place a line on an edge we'll use , if necessary.\n\n var menclose = \"\";\n var align = \"\";\n\n if (group.cols) {\n // Find column alignment, column spacing, and vertical lines.\n var cols = group.cols;\n var columnLines = \"\";\n var prevTypeWasAlign = false;\n var iStart = 0;\n var iEnd = cols.length;\n\n if (cols[0].type === \"separator\") {\n menclose += \"top \";\n iStart = 1;\n }\n\n if (cols[cols.length - 1].type === \"separator\") {\n menclose += \"bottom \";\n iEnd -= 1;\n }\n\n for (var i = iStart; i < iEnd; i++) {\n if (cols[i].type === \"align\") {\n align += alignMap[cols[i].align];\n\n if (prevTypeWasAlign) {\n columnLines += \"none \";\n }\n\n prevTypeWasAlign = true;\n } else if (cols[i].type === \"separator\") {\n // MathML accepts only single lines between cells.\n // So we read only the first of consecutive separators.\n if (prevTypeWasAlign) {\n columnLines += cols[i].separator === \"|\" ? \"solid \" : \"dashed \";\n prevTypeWasAlign = false;\n }\n }\n }\n\n table.setAttribute(\"columnalign\", align.trim());\n\n if (/[sd]/.test(columnLines)) {\n table.setAttribute(\"columnlines\", columnLines.trim());\n }\n } // Set column spacing.\n\n\n if (group.colSeparationType === \"align\") {\n var _cols = group.cols || [];\n\n var spacing = \"\";\n\n for (var _i = 1; _i < _cols.length; _i++) {\n spacing += _i % 2 ? \"0em \" : \"1em \";\n }\n\n table.setAttribute(\"columnspacing\", spacing.trim());\n } else if (group.colSeparationType === \"alignat\") {\n table.setAttribute(\"columnspacing\", \"0em\");\n } else if (group.colSeparationType === \"small\") {\n table.setAttribute(\"columnspacing\", \"0.2778em\");\n } else {\n table.setAttribute(\"columnspacing\", \"1em\");\n } // Address \\hline and \\hdashline\n\n\n var rowLines = \"\";\n var hlines = group.hLinesBeforeRow;\n menclose += hlines[0].length > 0 ? \"left \" : \"\";\n menclose += hlines[hlines.length - 1].length > 0 ? \"right \" : \"\";\n\n for (var _i2 = 1; _i2 < hlines.length - 1; _i2++) {\n rowLines += hlines[_i2].length === 0 ? \"none \" // MathML accepts only a single line between rows. Read one element.\n : hlines[_i2][0] ? \"dashed \" : \"solid \";\n }\n\n if (/[sd]/.test(rowLines)) {\n table.setAttribute(\"rowlines\", rowLines.trim());\n }\n\n if (menclose !== \"\") {\n table = new mathMLTree.MathNode(\"menclose\", [table]);\n table.setAttribute(\"notation\", menclose.trim());\n }\n\n if (group.arraystretch && group.arraystretch < 1) {\n // A small array. Wrap in scriptstyle so row gap is not too large.\n table = new mathMLTree.MathNode(\"mstyle\", [table]);\n table.setAttribute(\"scriptlevel\", \"1\");\n }\n\n return table;\n}; // Convenience function for aligned and alignedat environments.\n\n\nvar array_alignedHandler = function alignedHandler(context, args) {\n var cols = [];\n var res = parseArray(context.parser, {\n cols: cols,\n addJot: true\n }, \"display\"); // Determining number of columns.\n // 1. If the first argument is given, we use it as a number of columns,\n // and makes sure that each row doesn't exceed that number.\n // 2. Otherwise, just count number of columns = maximum number\n // of cells in each row (\"aligned\" mode -- isAligned will be true).\n //\n // At the same time, prepend empty group {} at beginning of every second\n // cell in each row (starting with second cell) so that operators become\n // binary. This behavior is implemented in amsmath's \\start@aligned.\n\n var numMaths;\n var numCols = 0;\n var emptyGroup = {\n type: \"ordgroup\",\n mode: context.mode,\n body: []\n };\n var ordgroup = checkNodeType(args[0], \"ordgroup\");\n\n if (ordgroup) {\n var arg0 = \"\";\n\n for (var i = 0; i < ordgroup.body.length; i++) {\n var textord = assertNodeType(ordgroup.body[i], \"textord\");\n arg0 += textord.text;\n }\n\n numMaths = Number(arg0);\n numCols = numMaths * 2;\n }\n\n var isAligned = !numCols;\n res.body.forEach(function (row) {\n for (var _i3 = 1; _i3 < row.length; _i3 += 2) {\n // Modify ordgroup node within styling node\n var styling = assertNodeType(row[_i3], \"styling\");\n\n var _ordgroup = assertNodeType(styling.body[0], \"ordgroup\");\n\n _ordgroup.body.unshift(emptyGroup);\n }\n\n if (!isAligned) {\n // Case 1\n var curMaths = row.length / 2;\n\n if (numMaths < curMaths) {\n throw new src_ParseError(\"Too many math in a row: \" + (\"expected \" + numMaths + \", but got \" + curMaths), row[0]);\n }\n } else if (numCols < row.length) {\n // Case 2\n numCols = row.length;\n }\n }); // Adjusting alignment.\n // In aligned mode, we add one \\qquad between columns;\n // otherwise we add nothing.\n\n for (var _i4 = 0; _i4 < numCols; ++_i4) {\n var align = \"r\";\n var pregap = 0;\n\n if (_i4 % 2 === 1) {\n align = \"l\";\n } else if (_i4 > 0 && isAligned) {\n // \"aligned\" mode.\n pregap = 1; // add one \\quad\n }\n\n cols[_i4] = {\n type: \"align\",\n align: align,\n pregap: pregap,\n postgap: 0\n };\n }\n\n res.colSeparationType = isAligned ? \"align\" : \"alignat\";\n return res;\n}; // Arrays are part of LaTeX, defined in lttab.dtx so its documentation\n// is part of the source2e.pdf file of LaTeX2e source documentation.\n// {darray} is an {array} environment where cells are set in \\displaystyle,\n// as defined in nccmath.sty.\n\n\ndefineEnvironment({\n type: \"array\",\n names: [\"array\", \"darray\"],\n props: {\n numArgs: 1\n },\n handler: function handler(context, args) {\n // Since no types are specified above, the two possibilities are\n // - The argument is wrapped in {} or [], in which case Parser's\n // parseGroup() returns an \"ordgroup\" wrapping some symbol node.\n // - The argument is a bare symbol node.\n var symNode = checkSymbolNodeType(args[0]);\n var colalign = symNode ? [args[0]] : assertNodeType(args[0], \"ordgroup\").body;\n var cols = colalign.map(function (nde) {\n var node = assertSymbolNodeType(nde);\n var ca = node.text;\n\n if (\"lcr\".indexOf(ca) !== -1) {\n return {\n type: \"align\",\n align: ca\n };\n } else if (ca === \"|\") {\n return {\n type: \"separator\",\n separator: \"|\"\n };\n } else if (ca === \":\") {\n return {\n type: \"separator\",\n separator: \":\"\n };\n }\n\n throw new src_ParseError(\"Unknown column alignment: \" + ca, nde);\n });\n var res = {\n cols: cols,\n hskipBeforeAndAfter: true // \\@preamble in lttab.dtx\n\n };\n return parseArray(context.parser, res, dCellStyle(context.envName));\n },\n htmlBuilder: array_htmlBuilder,\n mathmlBuilder: array_mathmlBuilder\n}); // The matrix environments of amsmath builds on the array environment\n// of LaTeX, which is discussed above.\n\ndefineEnvironment({\n type: \"array\",\n names: [\"matrix\", \"pmatrix\", \"bmatrix\", \"Bmatrix\", \"vmatrix\", \"Vmatrix\"],\n props: {\n numArgs: 0\n },\n handler: function handler(context) {\n var delimiters = {\n \"matrix\": null,\n \"pmatrix\": [\"(\", \")\"],\n \"bmatrix\": [\"[\", \"]\"],\n \"Bmatrix\": [\"\\\\{\", \"\\\\}\"],\n \"vmatrix\": [\"|\", \"|\"],\n \"Vmatrix\": [\"\\\\Vert\", \"\\\\Vert\"]\n }[context.envName]; // \\hskip -\\arraycolsep in amsmath\n\n var payload = {\n hskipBeforeAndAfter: false\n };\n var res = parseArray(context.parser, payload, dCellStyle(context.envName));\n return delimiters ? {\n type: \"leftright\",\n mode: context.mode,\n body: [res],\n left: delimiters[0],\n right: delimiters[1],\n rightColor: undefined // \\right uninfluenced by \\color in array\n\n } : res;\n },\n htmlBuilder: array_htmlBuilder,\n mathmlBuilder: array_mathmlBuilder\n});\ndefineEnvironment({\n type: \"array\",\n names: [\"smallmatrix\"],\n props: {\n numArgs: 0\n },\n handler: function handler(context) {\n var payload = {\n arraystretch: 0.5\n };\n var res = parseArray(context.parser, payload, \"script\");\n res.colSeparationType = \"small\";\n return res;\n },\n htmlBuilder: array_htmlBuilder,\n mathmlBuilder: array_mathmlBuilder\n});\ndefineEnvironment({\n type: \"array\",\n names: [\"subarray\"],\n props: {\n numArgs: 1\n },\n handler: function handler(context, args) {\n // Parsing of {subarray} is similar to {array}\n var symNode = checkSymbolNodeType(args[0]);\n var colalign = symNode ? [args[0]] : assertNodeType(args[0], \"ordgroup\").body;\n var cols = colalign.map(function (nde) {\n var node = assertSymbolNodeType(nde);\n var ca = node.text; // {subarray} only recognizes \"l\" & \"c\"\n\n if (\"lc\".indexOf(ca) !== -1) {\n return {\n type: \"align\",\n align: ca\n };\n }\n\n throw new src_ParseError(\"Unknown column alignment: \" + ca, nde);\n });\n\n if (cols.length > 1) {\n throw new src_ParseError(\"{subarray} can contain only one column\");\n }\n\n var res = {\n cols: cols,\n hskipBeforeAndAfter: false,\n arraystretch: 0.5\n };\n res = parseArray(context.parser, res, \"script\");\n\n if (res.body[0].length > 1) {\n throw new src_ParseError(\"{subarray} can contain only one column\");\n }\n\n return res;\n },\n htmlBuilder: array_htmlBuilder,\n mathmlBuilder: array_mathmlBuilder\n}); // A cases environment (in amsmath.sty) is almost equivalent to\n// \\def\\arraystretch{1.2}%\n// \\left\\{\\begin{array}{@{}l@{\\quad}l@{}} … \\end{array}\\right.\n// {dcases} is a {cases} environment where cells are set in \\displaystyle,\n// as defined in mathtools.sty.\n\ndefineEnvironment({\n type: \"array\",\n names: [\"cases\", \"dcases\"],\n props: {\n numArgs: 0\n },\n handler: function handler(context) {\n var payload = {\n arraystretch: 1.2,\n cols: [{\n type: \"align\",\n align: \"l\",\n pregap: 0,\n // TODO(kevinb) get the current style.\n // For now we use the metrics for TEXT style which is what we were\n // doing before. Before attempting to get the current style we\n // should look at TeX's behavior especially for \\over and matrices.\n postgap: 1.0\n /* 1em quad */\n\n }, {\n type: \"align\",\n align: \"l\",\n pregap: 0,\n postgap: 0\n }]\n };\n var res = parseArray(context.parser, payload, dCellStyle(context.envName));\n return {\n type: \"leftright\",\n mode: context.mode,\n body: [res],\n left: \"\\\\{\",\n right: \".\",\n rightColor: undefined\n };\n },\n htmlBuilder: array_htmlBuilder,\n mathmlBuilder: array_mathmlBuilder\n}); // An aligned environment is like the align* environment\n// except it operates within math mode.\n// Note that we assume \\nomallineskiplimit to be zero,\n// so that \\strut@ is the same as \\strut.\n\ndefineEnvironment({\n type: \"array\",\n names: [\"aligned\"],\n props: {\n numArgs: 0\n },\n handler: array_alignedHandler,\n htmlBuilder: array_htmlBuilder,\n mathmlBuilder: array_mathmlBuilder\n}); // A gathered environment is like an array environment with one centered\n// column, but where rows are considered lines so get \\jot line spacing\n// and contents are set in \\displaystyle.\n\ndefineEnvironment({\n type: \"array\",\n names: [\"gathered\"],\n props: {\n numArgs: 0\n },\n handler: function handler(context) {\n var res = {\n cols: [{\n type: \"align\",\n align: \"c\"\n }],\n addJot: true\n };\n return parseArray(context.parser, res, \"display\");\n },\n htmlBuilder: array_htmlBuilder,\n mathmlBuilder: array_mathmlBuilder\n}); // alignat environment is like an align environment, but one must explicitly\n// specify maximum number of columns in each row, and can adjust spacing between\n// each columns.\n\ndefineEnvironment({\n type: \"array\",\n names: [\"alignedat\"],\n // One for numbered and for unnumbered;\n // but, KaTeX doesn't supports math numbering yet,\n // they make no difference for now.\n props: {\n numArgs: 1\n },\n handler: array_alignedHandler,\n htmlBuilder: array_htmlBuilder,\n mathmlBuilder: array_mathmlBuilder\n}); // Catch \\hline outside array environment\n\ndefineFunction({\n type: \"text\",\n // Doesn't matter what this is.\n names: [\"\\\\hline\", \"\\\\hdashline\"],\n props: {\n numArgs: 0,\n allowedInText: true,\n allowedInMath: true\n },\n handler: function handler(context, args) {\n throw new src_ParseError(context.funcName + \" valid only within array environment\");\n }\n});\n// CONCATENATED MODULE: ./src/environments.js\n\nvar environments = _environments;\n/* harmony default export */ var src_environments = (environments); // All environment definitions should be imported below\n\n\n// CONCATENATED MODULE: ./src/functions/environment.js\n\n\n\n // Environment delimiters. HTML/MathML rendering is defined in the corresponding\n// defineEnvironment definitions.\n// $FlowFixMe, \"environment\" handler returns an environment ParseNode\n\ndefineFunction({\n type: \"environment\",\n names: [\"\\\\begin\", \"\\\\end\"],\n props: {\n numArgs: 1,\n argTypes: [\"text\"]\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser,\n funcName = _ref.funcName;\n var nameGroup = args[0];\n\n if (nameGroup.type !== \"ordgroup\") {\n throw new src_ParseError(\"Invalid environment name\", nameGroup);\n }\n\n var envName = \"\";\n\n for (var i = 0; i < nameGroup.body.length; ++i) {\n envName += assertNodeType(nameGroup.body[i], \"textord\").text;\n }\n\n if (funcName === \"\\\\begin\") {\n // begin...end is similar to left...right\n if (!src_environments.hasOwnProperty(envName)) {\n throw new src_ParseError(\"No such environment: \" + envName, nameGroup);\n } // Build the environment object. Arguments and other information will\n // be made available to the begin and end methods using properties.\n\n\n var env = src_environments[envName];\n\n var _parser$parseArgument = parser.parseArguments(\"\\\\begin{\" + envName + \"}\", env),\n _args = _parser$parseArgument.args,\n optArgs = _parser$parseArgument.optArgs;\n\n var context = {\n mode: parser.mode,\n envName: envName,\n parser: parser\n };\n var result = env.handler(context, _args, optArgs);\n parser.expect(\"\\\\end\", false);\n var endNameToken = parser.nextToken;\n var end = assertNodeType(parser.parseFunction(), \"environment\");\n\n if (end.name !== envName) {\n throw new src_ParseError(\"Mismatch: \\\\begin{\" + envName + \"} matched by \\\\end{\" + end.name + \"}\", endNameToken);\n }\n\n return result;\n }\n\n return {\n type: \"environment\",\n mode: parser.mode,\n name: envName,\n nameGroup: nameGroup\n };\n }\n});\n// CONCATENATED MODULE: ./src/functions/mclass.js\n\n\n\n\n\n\nvar mclass_makeSpan = buildCommon.makeSpan;\n\nfunction mclass_htmlBuilder(group, options) {\n var elements = buildHTML_buildExpression(group.body, options, true);\n return mclass_makeSpan([group.mclass], elements, options);\n}\n\nfunction mclass_mathmlBuilder(group, options) {\n var node;\n var inner = buildMathML_buildExpression(group.body, options);\n\n if (group.mclass === \"minner\") {\n return mathMLTree.newDocumentFragment(inner);\n } else if (group.mclass === \"mord\") {\n if (group.isCharacterBox) {\n node = inner[0];\n node.type = \"mi\";\n } else {\n node = new mathMLTree.MathNode(\"mi\", inner);\n }\n } else {\n if (group.isCharacterBox) {\n node = inner[0];\n node.type = \"mo\";\n } else {\n node = new mathMLTree.MathNode(\"mo\", inner);\n } // Set spacing based on what is the most likely adjacent atom type.\n // See TeXbook p170.\n\n\n if (group.mclass === \"mbin\") {\n node.attributes.lspace = \"0.22em\"; // medium space\n\n node.attributes.rspace = \"0.22em\";\n } else if (group.mclass === \"mpunct\") {\n node.attributes.lspace = \"0em\";\n node.attributes.rspace = \"0.17em\"; // thinspace\n } else if (group.mclass === \"mopen\" || group.mclass === \"mclose\") {\n node.attributes.lspace = \"0em\";\n node.attributes.rspace = \"0em\";\n } // MathML default space is 5/18 em, so needs no action.\n // Ref: https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo\n\n }\n\n return node;\n} // Math class commands except \\mathop\n\n\ndefineFunction({\n type: \"mclass\",\n names: [\"\\\\mathord\", \"\\\\mathbin\", \"\\\\mathrel\", \"\\\\mathopen\", \"\\\\mathclose\", \"\\\\mathpunct\", \"\\\\mathinner\"],\n props: {\n numArgs: 1\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser,\n funcName = _ref.funcName;\n var body = args[0];\n return {\n type: \"mclass\",\n mode: parser.mode,\n mclass: \"m\" + funcName.substr(5),\n // TODO(kevinb): don't prefix with 'm'\n body: defineFunction_ordargument(body),\n isCharacterBox: utils.isCharacterBox(body)\n };\n },\n htmlBuilder: mclass_htmlBuilder,\n mathmlBuilder: mclass_mathmlBuilder\n});\nvar binrelClass = function binrelClass(arg) {\n // \\binrel@ spacing varies with (bin|rel|ord) of the atom in the argument.\n // (by rendering separately and with {}s before and after, and measuring\n // the change in spacing). We'll do roughly the same by detecting the\n // atom type directly.\n var atom = arg.type === \"ordgroup\" && arg.body.length ? arg.body[0] : arg;\n\n if (atom.type === \"atom\" && (atom.family === \"bin\" || atom.family === \"rel\")) {\n return \"m\" + atom.family;\n } else {\n return \"mord\";\n }\n}; // \\@binrel{x}{y} renders like y but as mbin/mrel/mord if x is mbin/mrel/mord.\n// This is equivalent to \\binrel@{x}\\binrel@@{y} in AMSTeX.\n\ndefineFunction({\n type: \"mclass\",\n names: [\"\\\\@binrel\"],\n props: {\n numArgs: 2\n },\n handler: function handler(_ref2, args) {\n var parser = _ref2.parser;\n return {\n type: \"mclass\",\n mode: parser.mode,\n mclass: binrelClass(args[0]),\n body: [args[1]],\n isCharacterBox: utils.isCharacterBox(args[1])\n };\n }\n}); // Build a relation or stacked op by placing one symbol on top of another\n\ndefineFunction({\n type: \"mclass\",\n names: [\"\\\\stackrel\", \"\\\\overset\", \"\\\\underset\"],\n props: {\n numArgs: 2\n },\n handler: function handler(_ref3, args) {\n var parser = _ref3.parser,\n funcName = _ref3.funcName;\n var baseArg = args[1];\n var shiftedArg = args[0];\n var mclass;\n\n if (funcName !== \"\\\\stackrel\") {\n // LaTeX applies \\binrel spacing to \\overset and \\underset.\n mclass = binrelClass(baseArg);\n } else {\n mclass = \"mrel\"; // for \\stackrel\n }\n\n var baseOp = {\n type: \"op\",\n mode: baseArg.mode,\n limits: true,\n alwaysHandleSupSub: true,\n parentIsSupSub: false,\n symbol: false,\n suppressBaseShift: funcName !== \"\\\\stackrel\",\n body: defineFunction_ordargument(baseArg)\n };\n var supsub = {\n type: \"supsub\",\n mode: shiftedArg.mode,\n base: baseOp,\n sup: funcName === \"\\\\underset\" ? null : shiftedArg,\n sub: funcName === \"\\\\underset\" ? shiftedArg : null\n };\n return {\n type: \"mclass\",\n mode: parser.mode,\n mclass: mclass,\n body: [supsub],\n isCharacterBox: utils.isCharacterBox(supsub)\n };\n },\n htmlBuilder: mclass_htmlBuilder,\n mathmlBuilder: mclass_mathmlBuilder\n});\n// CONCATENATED MODULE: ./src/functions/font.js\n// TODO(kevinb): implement \\\\sl and \\\\sc\n\n\n\n\n\n\nvar font_htmlBuilder = function htmlBuilder(group, options) {\n var font = group.font;\n var newOptions = options.withFont(font);\n return buildHTML_buildGroup(group.body, newOptions);\n};\n\nvar font_mathmlBuilder = function mathmlBuilder(group, options) {\n var font = group.font;\n var newOptions = options.withFont(font);\n return buildMathML_buildGroup(group.body, newOptions);\n};\n\nvar fontAliases = {\n \"\\\\Bbb\": \"\\\\mathbb\",\n \"\\\\bold\": \"\\\\mathbf\",\n \"\\\\frak\": \"\\\\mathfrak\",\n \"\\\\bm\": \"\\\\boldsymbol\"\n};\ndefineFunction({\n type: \"font\",\n names: [// styles, except \\boldsymbol defined below\n \"\\\\mathrm\", \"\\\\mathit\", \"\\\\mathbf\", \"\\\\mathnormal\", // families\n \"\\\\mathbb\", \"\\\\mathcal\", \"\\\\mathfrak\", \"\\\\mathscr\", \"\\\\mathsf\", \"\\\\mathtt\", // aliases, except \\bm defined below\n \"\\\\Bbb\", \"\\\\bold\", \"\\\\frak\"],\n props: {\n numArgs: 1,\n greediness: 2\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser,\n funcName = _ref.funcName;\n var body = args[0];\n var func = funcName;\n\n if (func in fontAliases) {\n func = fontAliases[func];\n }\n\n return {\n type: \"font\",\n mode: parser.mode,\n font: func.slice(1),\n body: body\n };\n },\n htmlBuilder: font_htmlBuilder,\n mathmlBuilder: font_mathmlBuilder\n});\ndefineFunction({\n type: \"mclass\",\n names: [\"\\\\boldsymbol\", \"\\\\bm\"],\n props: {\n numArgs: 1,\n greediness: 2\n },\n handler: function handler(_ref2, args) {\n var parser = _ref2.parser;\n var body = args[0];\n var isCharacterBox = utils.isCharacterBox(body); // amsbsy.sty's \\boldsymbol uses \\binrel spacing to inherit the\n // argument's bin|rel|ord status\n\n return {\n type: \"mclass\",\n mode: parser.mode,\n mclass: binrelClass(body),\n body: [{\n type: \"font\",\n mode: parser.mode,\n font: \"boldsymbol\",\n body: body\n }],\n isCharacterBox: isCharacterBox\n };\n }\n}); // Old font changing functions\n\ndefineFunction({\n type: \"font\",\n names: [\"\\\\rm\", \"\\\\sf\", \"\\\\tt\", \"\\\\bf\", \"\\\\it\"],\n props: {\n numArgs: 0,\n allowedInText: true\n },\n handler: function handler(_ref3, args) {\n var parser = _ref3.parser,\n funcName = _ref3.funcName,\n breakOnTokenText = _ref3.breakOnTokenText;\n var mode = parser.mode;\n var body = parser.parseExpression(true, breakOnTokenText);\n var style = \"math\" + funcName.slice(1);\n return {\n type: \"font\",\n mode: mode,\n font: style,\n body: {\n type: \"ordgroup\",\n mode: parser.mode,\n body: body\n }\n };\n },\n htmlBuilder: font_htmlBuilder,\n mathmlBuilder: font_mathmlBuilder\n});\n// CONCATENATED MODULE: ./src/functions/genfrac.js\n\n\n\n\n\n\n\n\n\n\n\nvar genfrac_adjustStyle = function adjustStyle(size, originalStyle) {\n // Figure out what style this fraction should be in based on the\n // function used\n var style = originalStyle;\n\n if (size === \"display\") {\n // Get display style as a default.\n // If incoming style is sub/sup, use style.text() to get correct size.\n style = style.id >= src_Style.SCRIPT.id ? style.text() : src_Style.DISPLAY;\n } else if (size === \"text\" && style.size === src_Style.DISPLAY.size) {\n // We're in a \\tfrac but incoming style is displaystyle, so:\n style = src_Style.TEXT;\n } else if (size === \"script\") {\n style = src_Style.SCRIPT;\n } else if (size === \"scriptscript\") {\n style = src_Style.SCRIPTSCRIPT;\n }\n\n return style;\n};\n\nvar genfrac_htmlBuilder = function htmlBuilder(group, options) {\n // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e).\n var style = genfrac_adjustStyle(group.size, options.style);\n var nstyle = style.fracNum();\n var dstyle = style.fracDen();\n var newOptions;\n newOptions = options.havingStyle(nstyle);\n var numerm = buildHTML_buildGroup(group.numer, newOptions, options);\n\n if (group.continued) {\n // \\cfrac inserts a \\strut into the numerator.\n // Get \\strut dimensions from TeXbook page 353.\n var hStrut = 8.5 / options.fontMetrics().ptPerEm;\n var dStrut = 3.5 / options.fontMetrics().ptPerEm;\n numerm.height = numerm.height < hStrut ? hStrut : numerm.height;\n numerm.depth = numerm.depth < dStrut ? dStrut : numerm.depth;\n }\n\n newOptions = options.havingStyle(dstyle);\n var denomm = buildHTML_buildGroup(group.denom, newOptions, options);\n var rule;\n var ruleWidth;\n var ruleSpacing;\n\n if (group.hasBarLine) {\n if (group.barSize) {\n ruleWidth = units_calculateSize(group.barSize, options);\n rule = buildCommon.makeLineSpan(\"frac-line\", options, ruleWidth);\n } else {\n rule = buildCommon.makeLineSpan(\"frac-line\", options);\n }\n\n ruleWidth = rule.height;\n ruleSpacing = rule.height;\n } else {\n rule = null;\n ruleWidth = 0;\n ruleSpacing = options.fontMetrics().defaultRuleThickness;\n } // Rule 15b\n\n\n var numShift;\n var clearance;\n var denomShift;\n\n if (style.size === src_Style.DISPLAY.size || group.size === \"display\") {\n numShift = options.fontMetrics().num1;\n\n if (ruleWidth > 0) {\n clearance = 3 * ruleSpacing;\n } else {\n clearance = 7 * ruleSpacing;\n }\n\n denomShift = options.fontMetrics().denom1;\n } else {\n if (ruleWidth > 0) {\n numShift = options.fontMetrics().num2;\n clearance = ruleSpacing;\n } else {\n numShift = options.fontMetrics().num3;\n clearance = 3 * ruleSpacing;\n }\n\n denomShift = options.fontMetrics().denom2;\n }\n\n var frac;\n\n if (!rule) {\n // Rule 15c\n var candidateClearance = numShift - numerm.depth - (denomm.height - denomShift);\n\n if (candidateClearance < clearance) {\n numShift += 0.5 * (clearance - candidateClearance);\n denomShift += 0.5 * (clearance - candidateClearance);\n }\n\n frac = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: [{\n type: \"elem\",\n elem: denomm,\n shift: denomShift\n }, {\n type: \"elem\",\n elem: numerm,\n shift: -numShift\n }]\n }, options);\n } else {\n // Rule 15d\n var axisHeight = options.fontMetrics().axisHeight;\n\n if (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < clearance) {\n numShift += clearance - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth));\n }\n\n if (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < clearance) {\n denomShift += clearance - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift));\n }\n\n var midShift = -(axisHeight - 0.5 * ruleWidth);\n frac = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: [{\n type: \"elem\",\n elem: denomm,\n shift: denomShift\n }, {\n type: \"elem\",\n elem: rule,\n shift: midShift\n }, {\n type: \"elem\",\n elem: numerm,\n shift: -numShift\n }]\n }, options);\n } // Since we manually change the style sometimes (with \\dfrac or \\tfrac),\n // account for the possible size change here.\n\n\n newOptions = options.havingStyle(style);\n frac.height *= newOptions.sizeMultiplier / options.sizeMultiplier;\n frac.depth *= newOptions.sizeMultiplier / options.sizeMultiplier; // Rule 15e\n\n var delimSize;\n\n if (style.size === src_Style.DISPLAY.size) {\n delimSize = options.fontMetrics().delim1;\n } else {\n delimSize = options.fontMetrics().delim2;\n }\n\n var leftDelim;\n var rightDelim;\n\n if (group.leftDelim == null) {\n leftDelim = makeNullDelimiter(options, [\"mopen\"]);\n } else {\n leftDelim = delimiter.customSizedDelim(group.leftDelim, delimSize, true, options.havingStyle(style), group.mode, [\"mopen\"]);\n }\n\n if (group.continued) {\n rightDelim = buildCommon.makeSpan([]); // zero width for \\cfrac\n } else if (group.rightDelim == null) {\n rightDelim = makeNullDelimiter(options, [\"mclose\"]);\n } else {\n rightDelim = delimiter.customSizedDelim(group.rightDelim, delimSize, true, options.havingStyle(style), group.mode, [\"mclose\"]);\n }\n\n return buildCommon.makeSpan([\"mord\"].concat(newOptions.sizingClasses(options)), [leftDelim, buildCommon.makeSpan([\"mfrac\"], [frac]), rightDelim], options);\n};\n\nvar genfrac_mathmlBuilder = function mathmlBuilder(group, options) {\n var node = new mathMLTree.MathNode(\"mfrac\", [buildMathML_buildGroup(group.numer, options), buildMathML_buildGroup(group.denom, options)]);\n\n if (!group.hasBarLine) {\n node.setAttribute(\"linethickness\", \"0px\");\n } else if (group.barSize) {\n var ruleWidth = units_calculateSize(group.barSize, options);\n node.setAttribute(\"linethickness\", ruleWidth + \"em\");\n }\n\n var style = genfrac_adjustStyle(group.size, options.style);\n\n if (style.size !== options.style.size) {\n node = new mathMLTree.MathNode(\"mstyle\", [node]);\n var isDisplay = style.size === src_Style.DISPLAY.size ? \"true\" : \"false\";\n node.setAttribute(\"displaystyle\", isDisplay);\n node.setAttribute(\"scriptlevel\", \"0\");\n }\n\n if (group.leftDelim != null || group.rightDelim != null) {\n var withDelims = [];\n\n if (group.leftDelim != null) {\n var leftOp = new mathMLTree.MathNode(\"mo\", [new mathMLTree.TextNode(group.leftDelim.replace(\"\\\\\", \"\"))]);\n leftOp.setAttribute(\"fence\", \"true\");\n withDelims.push(leftOp);\n }\n\n withDelims.push(node);\n\n if (group.rightDelim != null) {\n var rightOp = new mathMLTree.MathNode(\"mo\", [new mathMLTree.TextNode(group.rightDelim.replace(\"\\\\\", \"\"))]);\n rightOp.setAttribute(\"fence\", \"true\");\n withDelims.push(rightOp);\n }\n\n return buildMathML_makeRow(withDelims);\n }\n\n return node;\n};\n\ndefineFunction({\n type: \"genfrac\",\n names: [\"\\\\cfrac\", \"\\\\dfrac\", \"\\\\frac\", \"\\\\tfrac\", \"\\\\dbinom\", \"\\\\binom\", \"\\\\tbinom\", \"\\\\\\\\atopfrac\", // can’t be entered directly\n \"\\\\\\\\bracefrac\", \"\\\\\\\\brackfrac\"],\n props: {\n numArgs: 2,\n greediness: 2\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser,\n funcName = _ref.funcName;\n var numer = args[0];\n var denom = args[1];\n var hasBarLine;\n var leftDelim = null;\n var rightDelim = null;\n var size = \"auto\";\n\n switch (funcName) {\n case \"\\\\cfrac\":\n case \"\\\\dfrac\":\n case \"\\\\frac\":\n case \"\\\\tfrac\":\n hasBarLine = true;\n break;\n\n case \"\\\\\\\\atopfrac\":\n hasBarLine = false;\n break;\n\n case \"\\\\dbinom\":\n case \"\\\\binom\":\n case \"\\\\tbinom\":\n hasBarLine = false;\n leftDelim = \"(\";\n rightDelim = \")\";\n break;\n\n case \"\\\\\\\\bracefrac\":\n hasBarLine = false;\n leftDelim = \"\\\\{\";\n rightDelim = \"\\\\}\";\n break;\n\n case \"\\\\\\\\brackfrac\":\n hasBarLine = false;\n leftDelim = \"[\";\n rightDelim = \"]\";\n break;\n\n default:\n throw new Error(\"Unrecognized genfrac command\");\n }\n\n switch (funcName) {\n case \"\\\\cfrac\":\n case \"\\\\dfrac\":\n case \"\\\\dbinom\":\n size = \"display\";\n break;\n\n case \"\\\\tfrac\":\n case \"\\\\tbinom\":\n size = \"text\";\n break;\n }\n\n return {\n type: \"genfrac\",\n mode: parser.mode,\n continued: funcName === \"\\\\cfrac\",\n numer: numer,\n denom: denom,\n hasBarLine: hasBarLine,\n leftDelim: leftDelim,\n rightDelim: rightDelim,\n size: size,\n barSize: null\n };\n },\n htmlBuilder: genfrac_htmlBuilder,\n mathmlBuilder: genfrac_mathmlBuilder\n}); // Infix generalized fractions -- these are not rendered directly, but replaced\n// immediately by one of the variants above.\n\ndefineFunction({\n type: \"infix\",\n names: [\"\\\\over\", \"\\\\choose\", \"\\\\atop\", \"\\\\brace\", \"\\\\brack\"],\n props: {\n numArgs: 0,\n infix: true\n },\n handler: function handler(_ref2) {\n var parser = _ref2.parser,\n funcName = _ref2.funcName,\n token = _ref2.token;\n var replaceWith;\n\n switch (funcName) {\n case \"\\\\over\":\n replaceWith = \"\\\\frac\";\n break;\n\n case \"\\\\choose\":\n replaceWith = \"\\\\binom\";\n break;\n\n case \"\\\\atop\":\n replaceWith = \"\\\\\\\\atopfrac\";\n break;\n\n case \"\\\\brace\":\n replaceWith = \"\\\\\\\\bracefrac\";\n break;\n\n case \"\\\\brack\":\n replaceWith = \"\\\\\\\\brackfrac\";\n break;\n\n default:\n throw new Error(\"Unrecognized infix genfrac command\");\n }\n\n return {\n type: \"infix\",\n mode: parser.mode,\n replaceWith: replaceWith,\n token: token\n };\n }\n});\nvar stylArray = [\"display\", \"text\", \"script\", \"scriptscript\"];\n\nvar delimFromValue = function delimFromValue(delimString) {\n var delim = null;\n\n if (delimString.length > 0) {\n delim = delimString;\n delim = delim === \".\" ? null : delim;\n }\n\n return delim;\n};\n\ndefineFunction({\n type: \"genfrac\",\n names: [\"\\\\genfrac\"],\n props: {\n numArgs: 6,\n greediness: 6,\n argTypes: [\"math\", \"math\", \"size\", \"text\", \"math\", \"math\"]\n },\n handler: function handler(_ref3, args) {\n var parser = _ref3.parser;\n var numer = args[4];\n var denom = args[5]; // Look into the parse nodes to get the desired delimiters.\n\n var leftNode = checkNodeType(args[0], \"atom\");\n\n if (leftNode) {\n leftNode = assertAtomFamily(args[0], \"open\");\n }\n\n var leftDelim = leftNode ? delimFromValue(leftNode.text) : null;\n var rightNode = checkNodeType(args[1], \"atom\");\n\n if (rightNode) {\n rightNode = assertAtomFamily(args[1], \"close\");\n }\n\n var rightDelim = rightNode ? delimFromValue(rightNode.text) : null;\n var barNode = assertNodeType(args[2], \"size\");\n var hasBarLine;\n var barSize = null;\n\n if (barNode.isBlank) {\n // \\genfrac acts differently than \\above.\n // \\genfrac treats an empty size group as a signal to use a\n // standard bar size. \\above would see size = 0 and omit the bar.\n hasBarLine = true;\n } else {\n barSize = barNode.value;\n hasBarLine = barSize.number > 0;\n } // Find out if we want displaystyle, textstyle, etc.\n\n\n var size = \"auto\";\n var styl = checkNodeType(args[3], \"ordgroup\");\n\n if (styl) {\n if (styl.body.length > 0) {\n var textOrd = assertNodeType(styl.body[0], \"textord\");\n size = stylArray[Number(textOrd.text)];\n }\n } else {\n styl = assertNodeType(args[3], \"textord\");\n size = stylArray[Number(styl.text)];\n }\n\n return {\n type: \"genfrac\",\n mode: parser.mode,\n numer: numer,\n denom: denom,\n continued: false,\n hasBarLine: hasBarLine,\n barSize: barSize,\n leftDelim: leftDelim,\n rightDelim: rightDelim,\n size: size\n };\n },\n htmlBuilder: genfrac_htmlBuilder,\n mathmlBuilder: genfrac_mathmlBuilder\n}); // \\above is an infix fraction that also defines a fraction bar size.\n\ndefineFunction({\n type: \"infix\",\n names: [\"\\\\above\"],\n props: {\n numArgs: 1,\n argTypes: [\"size\"],\n infix: true\n },\n handler: function handler(_ref4, args) {\n var parser = _ref4.parser,\n funcName = _ref4.funcName,\n token = _ref4.token;\n return {\n type: \"infix\",\n mode: parser.mode,\n replaceWith: \"\\\\\\\\abovefrac\",\n size: assertNodeType(args[0], \"size\").value,\n token: token\n };\n }\n});\ndefineFunction({\n type: \"genfrac\",\n names: [\"\\\\\\\\abovefrac\"],\n props: {\n numArgs: 3,\n argTypes: [\"math\", \"size\", \"math\"]\n },\n handler: function handler(_ref5, args) {\n var parser = _ref5.parser,\n funcName = _ref5.funcName;\n var numer = args[0];\n var barSize = assert(assertNodeType(args[1], \"infix\").size);\n var denom = args[2];\n var hasBarLine = barSize.number > 0;\n return {\n type: \"genfrac\",\n mode: parser.mode,\n numer: numer,\n denom: denom,\n continued: false,\n hasBarLine: hasBarLine,\n barSize: barSize,\n leftDelim: null,\n rightDelim: null,\n size: \"auto\"\n };\n },\n htmlBuilder: genfrac_htmlBuilder,\n mathmlBuilder: genfrac_mathmlBuilder\n});\n// CONCATENATED MODULE: ./src/functions/horizBrace.js\n\n\n\n\n\n\n\n\n// NOTE: Unlike most `htmlBuilder`s, this one handles not only \"horizBrace\", but\nvar horizBrace_htmlBuilder = function htmlBuilder(grp, options) {\n var style = options.style; // Pull out the `ParseNode<\"horizBrace\">` if `grp` is a \"supsub\" node.\n\n var supSubGroup;\n var group;\n var supSub = checkNodeType(grp, \"supsub\");\n\n if (supSub) {\n // Ref: LaTeX source2e: }}}}\\limits}\n // i.e. LaTeX treats the brace similar to an op and passes it\n // with \\limits, so we need to assign supsub style.\n supSubGroup = supSub.sup ? buildHTML_buildGroup(supSub.sup, options.havingStyle(style.sup()), options) : buildHTML_buildGroup(supSub.sub, options.havingStyle(style.sub()), options);\n group = assertNodeType(supSub.base, \"horizBrace\");\n } else {\n group = assertNodeType(grp, \"horizBrace\");\n } // Build the base group\n\n\n var body = buildHTML_buildGroup(group.base, options.havingBaseStyle(src_Style.DISPLAY)); // Create the stretchy element\n\n var braceBody = stretchy.svgSpan(group, options); // Generate the vlist, with the appropriate kerns ┏━━━━━━━━┓\n // This first vlist contains the content and the brace: equation\n\n var vlist;\n\n if (group.isOver) {\n vlist = buildCommon.makeVList({\n positionType: \"firstBaseline\",\n children: [{\n type: \"elem\",\n elem: body\n }, {\n type: \"kern\",\n size: 0.1\n }, {\n type: \"elem\",\n elem: braceBody\n }]\n }, options); // $FlowFixMe: Replace this with passing \"svg-align\" into makeVList.\n\n vlist.children[0].children[0].children[1].classes.push(\"svg-align\");\n } else {\n vlist = buildCommon.makeVList({\n positionType: \"bottom\",\n positionData: body.depth + 0.1 + braceBody.height,\n children: [{\n type: \"elem\",\n elem: braceBody\n }, {\n type: \"kern\",\n size: 0.1\n }, {\n type: \"elem\",\n elem: body\n }]\n }, options); // $FlowFixMe: Replace this with passing \"svg-align\" into makeVList.\n\n vlist.children[0].children[0].children[0].classes.push(\"svg-align\");\n }\n\n if (supSubGroup) {\n // To write the supsub, wrap the first vlist in another vlist:\n // They can't all go in the same vlist, because the note might be\n // wider than the equation. We want the equation to control the\n // brace width.\n // note long note long note\n // ┏━━━━━━━━┓ or ┏━━━┓ not ┏━━━━━━━━━┓\n // equation eqn eqn\n var vSpan = buildCommon.makeSpan([\"mord\", group.isOver ? \"mover\" : \"munder\"], [vlist], options);\n\n if (group.isOver) {\n vlist = buildCommon.makeVList({\n positionType: \"firstBaseline\",\n children: [{\n type: \"elem\",\n elem: vSpan\n }, {\n type: \"kern\",\n size: 0.2\n }, {\n type: \"elem\",\n elem: supSubGroup\n }]\n }, options);\n } else {\n vlist = buildCommon.makeVList({\n positionType: \"bottom\",\n positionData: vSpan.depth + 0.2 + supSubGroup.height + supSubGroup.depth,\n children: [{\n type: \"elem\",\n elem: supSubGroup\n }, {\n type: \"kern\",\n size: 0.2\n }, {\n type: \"elem\",\n elem: vSpan\n }]\n }, options);\n }\n }\n\n return buildCommon.makeSpan([\"mord\", group.isOver ? \"mover\" : \"munder\"], [vlist], options);\n};\n\nvar horizBrace_mathmlBuilder = function mathmlBuilder(group, options) {\n var accentNode = stretchy.mathMLnode(group.label);\n return new mathMLTree.MathNode(group.isOver ? \"mover\" : \"munder\", [buildMathML_buildGroup(group.base, options), accentNode]);\n}; // Horizontal stretchy braces\n\n\ndefineFunction({\n type: \"horizBrace\",\n names: [\"\\\\overbrace\", \"\\\\underbrace\"],\n props: {\n numArgs: 1\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser,\n funcName = _ref.funcName;\n return {\n type: \"horizBrace\",\n mode: parser.mode,\n label: funcName,\n isOver: /^\\\\over/.test(funcName),\n base: args[0]\n };\n },\n htmlBuilder: horizBrace_htmlBuilder,\n mathmlBuilder: horizBrace_mathmlBuilder\n});\n// CONCATENATED MODULE: ./src/functions/href.js\n\n\n\n\n\n\ndefineFunction({\n type: \"href\",\n names: [\"\\\\href\"],\n props: {\n numArgs: 2,\n argTypes: [\"url\", \"original\"],\n allowedInText: true\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser;\n var body = args[1];\n var href = assertNodeType(args[0], \"url\").url;\n\n if (!parser.settings.isTrusted({\n command: \"\\\\href\",\n url: href\n })) {\n return parser.formatUnsupportedCmd(\"\\\\href\");\n }\n\n return {\n type: \"href\",\n mode: parser.mode,\n href: href,\n body: defineFunction_ordargument(body)\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n var elements = buildHTML_buildExpression(group.body, options, false);\n return buildCommon.makeAnchor(group.href, [], elements, options);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var math = buildExpressionRow(group.body, options);\n\n if (!(math instanceof mathMLTree_MathNode)) {\n math = new mathMLTree_MathNode(\"mrow\", [math]);\n }\n\n math.setAttribute(\"href\", group.href);\n return math;\n }\n});\ndefineFunction({\n type: \"href\",\n names: [\"\\\\url\"],\n props: {\n numArgs: 1,\n argTypes: [\"url\"],\n allowedInText: true\n },\n handler: function handler(_ref2, args) {\n var parser = _ref2.parser;\n var href = assertNodeType(args[0], \"url\").url;\n\n if (!parser.settings.isTrusted({\n command: \"\\\\url\",\n url: href\n })) {\n return parser.formatUnsupportedCmd(\"\\\\url\");\n }\n\n var chars = [];\n\n for (var i = 0; i < href.length; i++) {\n var c = href[i];\n\n if (c === \"~\") {\n c = \"\\\\textasciitilde\";\n }\n\n chars.push({\n type: \"textord\",\n mode: \"text\",\n text: c\n });\n }\n\n var body = {\n type: \"text\",\n mode: parser.mode,\n font: \"\\\\texttt\",\n body: chars\n };\n return {\n type: \"href\",\n mode: parser.mode,\n href: href,\n body: defineFunction_ordargument(body)\n };\n }\n});\n// CONCATENATED MODULE: ./src/functions/htmlmathml.js\n\n\n\n\ndefineFunction({\n type: \"htmlmathml\",\n names: [\"\\\\html@mathml\"],\n props: {\n numArgs: 2,\n allowedInText: true\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser;\n return {\n type: \"htmlmathml\",\n mode: parser.mode,\n html: defineFunction_ordargument(args[0]),\n mathml: defineFunction_ordargument(args[1])\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n var elements = buildHTML_buildExpression(group.html, options, false);\n return buildCommon.makeFragment(elements);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n return buildExpressionRow(group.mathml, options);\n }\n});\n// CONCATENATED MODULE: ./src/functions/includegraphics.js\n\n\n\n\n\n\n\nvar includegraphics_sizeData = function sizeData(str) {\n if (/^[-+]? *(\\d+(\\.\\d*)?|\\.\\d+)$/.test(str)) {\n // str is a number with no unit specified.\n // default unit is bp, per graphix package.\n return {\n number: +str,\n unit: \"bp\"\n };\n } else {\n var match = /([-+]?) *(\\d+(?:\\.\\d*)?|\\.\\d+) *([a-z]{2})/.exec(str);\n\n if (!match) {\n throw new src_ParseError(\"Invalid size: '\" + str + \"' in \\\\includegraphics\");\n }\n\n var data = {\n number: +(match[1] + match[2]),\n // sign + magnitude, cast to number\n unit: match[3]\n };\n\n if (!validUnit(data)) {\n throw new src_ParseError(\"Invalid unit: '\" + data.unit + \"' in \\\\includegraphics.\");\n }\n\n return data;\n }\n};\n\ndefineFunction({\n type: \"includegraphics\",\n names: [\"\\\\includegraphics\"],\n props: {\n numArgs: 1,\n numOptionalArgs: 1,\n argTypes: [\"raw\", \"url\"],\n allowedInText: false\n },\n handler: function handler(_ref, args, optArgs) {\n var parser = _ref.parser;\n var width = {\n number: 0,\n unit: \"em\"\n };\n var height = {\n number: 0.9,\n unit: \"em\"\n }; // sorta character sized.\n\n var totalheight = {\n number: 0,\n unit: \"em\"\n };\n var alt = \"\";\n\n if (optArgs[0]) {\n var attributeStr = assertNodeType(optArgs[0], \"raw\").string; // Parser.js does not parse key/value pairs. We get a string.\n\n var attributes = attributeStr.split(\",\");\n\n for (var i = 0; i < attributes.length; i++) {\n var keyVal = attributes[i].split(\"=\");\n\n if (keyVal.length === 2) {\n var str = keyVal[1].trim();\n\n switch (keyVal[0].trim()) {\n case \"alt\":\n alt = str;\n break;\n\n case \"width\":\n width = includegraphics_sizeData(str);\n break;\n\n case \"height\":\n height = includegraphics_sizeData(str);\n break;\n\n case \"totalheight\":\n totalheight = includegraphics_sizeData(str);\n break;\n\n default:\n throw new src_ParseError(\"Invalid key: '\" + keyVal[0] + \"' in \\\\includegraphics.\");\n }\n }\n }\n }\n\n var src = assertNodeType(args[0], \"url\").url;\n\n if (alt === \"\") {\n // No alt given. Use the file name. Strip away the path.\n alt = src;\n alt = alt.replace(/^.*[\\\\/]/, '');\n alt = alt.substring(0, alt.lastIndexOf('.'));\n }\n\n if (!parser.settings.isTrusted({\n command: \"\\\\includegraphics\",\n url: src\n })) {\n return parser.formatUnsupportedCmd(\"\\\\includegraphics\");\n }\n\n return {\n type: \"includegraphics\",\n mode: parser.mode,\n alt: alt,\n width: width,\n height: height,\n totalheight: totalheight,\n src: src\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n var height = units_calculateSize(group.height, options);\n var depth = 0;\n\n if (group.totalheight.number > 0) {\n depth = units_calculateSize(group.totalheight, options) - height;\n depth = Number(depth.toFixed(2));\n }\n\n var width = 0;\n\n if (group.width.number > 0) {\n width = units_calculateSize(group.width, options);\n }\n\n var style = {\n height: height + depth + \"em\"\n };\n\n if (width > 0) {\n style.width = width + \"em\";\n }\n\n if (depth > 0) {\n style.verticalAlign = -depth + \"em\";\n }\n\n var node = new domTree_Img(group.src, group.alt, style);\n node.height = height;\n node.depth = depth;\n return node;\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var node = new mathMLTree.MathNode(\"mglyph\", []);\n node.setAttribute(\"alt\", group.alt);\n var height = units_calculateSize(group.height, options);\n var depth = 0;\n\n if (group.totalheight.number > 0) {\n depth = units_calculateSize(group.totalheight, options) - height;\n depth = depth.toFixed(2);\n node.setAttribute(\"valign\", \"-\" + depth + \"em\");\n }\n\n node.setAttribute(\"height\", height + depth + \"em\");\n\n if (group.width.number > 0) {\n var width = units_calculateSize(group.width, options);\n node.setAttribute(\"width\", width + \"em\");\n }\n\n node.setAttribute(\"src\", group.src);\n return node;\n }\n});\n// CONCATENATED MODULE: ./src/functions/kern.js\n// Horizontal spacing commands\n\n\n\n\n // TODO: \\hskip and \\mskip should support plus and minus in lengths\n\ndefineFunction({\n type: \"kern\",\n names: [\"\\\\kern\", \"\\\\mkern\", \"\\\\hskip\", \"\\\\mskip\"],\n props: {\n numArgs: 1,\n argTypes: [\"size\"],\n allowedInText: true\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser,\n funcName = _ref.funcName;\n var size = assertNodeType(args[0], \"size\");\n\n if (parser.settings.strict) {\n var mathFunction = funcName[1] === 'm'; // \\mkern, \\mskip\n\n var muUnit = size.value.unit === 'mu';\n\n if (mathFunction) {\n if (!muUnit) {\n parser.settings.reportNonstrict(\"mathVsTextUnits\", \"LaTeX's \" + funcName + \" supports only mu units, \" + (\"not \" + size.value.unit + \" units\"));\n }\n\n if (parser.mode !== \"math\") {\n parser.settings.reportNonstrict(\"mathVsTextUnits\", \"LaTeX's \" + funcName + \" works only in math mode\");\n }\n } else {\n // !mathFunction\n if (muUnit) {\n parser.settings.reportNonstrict(\"mathVsTextUnits\", \"LaTeX's \" + funcName + \" doesn't support mu units\");\n }\n }\n }\n\n return {\n type: \"kern\",\n mode: parser.mode,\n dimension: size.value\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n return buildCommon.makeGlue(group.dimension, options);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var dimension = units_calculateSize(group.dimension, options);\n return new mathMLTree.SpaceNode(dimension);\n }\n});\n// CONCATENATED MODULE: ./src/functions/lap.js\n// Horizontal overlap functions\n\n\n\n\n\ndefineFunction({\n type: \"lap\",\n names: [\"\\\\mathllap\", \"\\\\mathrlap\", \"\\\\mathclap\"],\n props: {\n numArgs: 1,\n allowedInText: true\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser,\n funcName = _ref.funcName;\n var body = args[0];\n return {\n type: \"lap\",\n mode: parser.mode,\n alignment: funcName.slice(5),\n body: body\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n // mathllap, mathrlap, mathclap\n var inner;\n\n if (group.alignment === \"clap\") {\n // ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/\n inner = buildCommon.makeSpan([], [buildHTML_buildGroup(group.body, options)]); // wrap, since CSS will center a .clap > .inner > span\n\n inner = buildCommon.makeSpan([\"inner\"], [inner], options);\n } else {\n inner = buildCommon.makeSpan([\"inner\"], [buildHTML_buildGroup(group.body, options)]);\n }\n\n var fix = buildCommon.makeSpan([\"fix\"], []);\n var node = buildCommon.makeSpan([group.alignment], [inner, fix], options); // At this point, we have correctly set horizontal alignment of the\n // two items involved in the lap.\n // Next, use a strut to set the height of the HTML bounding box.\n // Otherwise, a tall argument may be misplaced.\n\n var strut = buildCommon.makeSpan([\"strut\"]);\n strut.style.height = node.height + node.depth + \"em\";\n strut.style.verticalAlign = -node.depth + \"em\";\n node.children.unshift(strut); // Next, prevent vertical misplacement when next to something tall.\n\n node = buildCommon.makeVList({\n positionType: \"firstBaseline\",\n children: [{\n type: \"elem\",\n elem: node\n }]\n }, options); // Get the horizontal spacing correct relative to adjacent items.\n\n return buildCommon.makeSpan([\"mord\"], [node], options);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n // mathllap, mathrlap, mathclap\n var node = new mathMLTree.MathNode(\"mpadded\", [buildMathML_buildGroup(group.body, options)]);\n\n if (group.alignment !== \"rlap\") {\n var offset = group.alignment === \"llap\" ? \"-1\" : \"-0.5\";\n node.setAttribute(\"lspace\", offset + \"width\");\n }\n\n node.setAttribute(\"width\", \"0px\");\n return node;\n }\n});\n// CONCATENATED MODULE: ./src/functions/math.js\n\n // Switching from text mode back to math mode\n\ndefineFunction({\n type: \"styling\",\n names: [\"\\\\(\", \"$\"],\n props: {\n numArgs: 0,\n allowedInText: true,\n allowedInMath: false\n },\n handler: function handler(_ref, args) {\n var funcName = _ref.funcName,\n parser = _ref.parser;\n var outerMode = parser.mode;\n parser.switchMode(\"math\");\n var close = funcName === \"\\\\(\" ? \"\\\\)\" : \"$\";\n var body = parser.parseExpression(false, close);\n parser.expect(close);\n parser.switchMode(outerMode);\n return {\n type: \"styling\",\n mode: parser.mode,\n style: \"text\",\n body: body\n };\n }\n}); // Check for extra closing math delimiters\n\ndefineFunction({\n type: \"text\",\n // Doesn't matter what this is.\n names: [\"\\\\)\", \"\\\\]\"],\n props: {\n numArgs: 0,\n allowedInText: true,\n allowedInMath: false\n },\n handler: function handler(context, args) {\n throw new src_ParseError(\"Mismatched \" + context.funcName);\n }\n});\n// CONCATENATED MODULE: ./src/functions/mathchoice.js\n\n\n\n\n\n\nvar mathchoice_chooseMathStyle = function chooseMathStyle(group, options) {\n switch (options.style.size) {\n case src_Style.DISPLAY.size:\n return group.display;\n\n case src_Style.TEXT.size:\n return group.text;\n\n case src_Style.SCRIPT.size:\n return group.script;\n\n case src_Style.SCRIPTSCRIPT.size:\n return group.scriptscript;\n\n default:\n return group.text;\n }\n};\n\ndefineFunction({\n type: \"mathchoice\",\n names: [\"\\\\mathchoice\"],\n props: {\n numArgs: 4\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser;\n return {\n type: \"mathchoice\",\n mode: parser.mode,\n display: defineFunction_ordargument(args[0]),\n text: defineFunction_ordargument(args[1]),\n script: defineFunction_ordargument(args[2]),\n scriptscript: defineFunction_ordargument(args[3])\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n var body = mathchoice_chooseMathStyle(group, options);\n var elements = buildHTML_buildExpression(body, options, false);\n return buildCommon.makeFragment(elements);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var body = mathchoice_chooseMathStyle(group, options);\n return buildExpressionRow(body, options);\n }\n});\n// CONCATENATED MODULE: ./src/functions/utils/assembleSupSub.js\n\n\n// For an operator with limits, assemble the base, sup, and sub into a span.\nvar assembleSupSub_assembleSupSub = function assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift) {\n // IE 8 clips \\int if it is in a display: inline-block. We wrap it\n // in a new span so it is an inline, and works.\n base = buildCommon.makeSpan([], [base]);\n var sub;\n var sup; // We manually have to handle the superscripts and subscripts. This,\n // aside from the kern calculations, is copied from supsub.\n\n if (supGroup) {\n var elem = buildHTML_buildGroup(supGroup, options.havingStyle(style.sup()), options);\n sup = {\n elem: elem,\n kern: Math.max(options.fontMetrics().bigOpSpacing1, options.fontMetrics().bigOpSpacing3 - elem.depth)\n };\n }\n\n if (subGroup) {\n var _elem = buildHTML_buildGroup(subGroup, options.havingStyle(style.sub()), options);\n\n sub = {\n elem: _elem,\n kern: Math.max(options.fontMetrics().bigOpSpacing2, options.fontMetrics().bigOpSpacing4 - _elem.height)\n };\n } // Build the final group as a vlist of the possible subscript, base,\n // and possible superscript.\n\n\n var finalGroup;\n\n if (sup && sub) {\n var bottom = options.fontMetrics().bigOpSpacing5 + sub.elem.height + sub.elem.depth + sub.kern + base.depth + baseShift;\n finalGroup = buildCommon.makeVList({\n positionType: \"bottom\",\n positionData: bottom,\n children: [{\n type: \"kern\",\n size: options.fontMetrics().bigOpSpacing5\n }, {\n type: \"elem\",\n elem: sub.elem,\n marginLeft: -slant + \"em\"\n }, {\n type: \"kern\",\n size: sub.kern\n }, {\n type: \"elem\",\n elem: base\n }, {\n type: \"kern\",\n size: sup.kern\n }, {\n type: \"elem\",\n elem: sup.elem,\n marginLeft: slant + \"em\"\n }, {\n type: \"kern\",\n size: options.fontMetrics().bigOpSpacing5\n }]\n }, options);\n } else if (sub) {\n var top = base.height - baseShift; // Shift the limits by the slant of the symbol. Note\n // that we are supposed to shift the limits by 1/2 of the slant,\n // but since we are centering the limits adding a full slant of\n // margin will shift by 1/2 that.\n\n finalGroup = buildCommon.makeVList({\n positionType: \"top\",\n positionData: top,\n children: [{\n type: \"kern\",\n size: options.fontMetrics().bigOpSpacing5\n }, {\n type: \"elem\",\n elem: sub.elem,\n marginLeft: -slant + \"em\"\n }, {\n type: \"kern\",\n size: sub.kern\n }, {\n type: \"elem\",\n elem: base\n }]\n }, options);\n } else if (sup) {\n var _bottom = base.depth + baseShift;\n\n finalGroup = buildCommon.makeVList({\n positionType: \"bottom\",\n positionData: _bottom,\n children: [{\n type: \"elem\",\n elem: base\n }, {\n type: \"kern\",\n size: sup.kern\n }, {\n type: \"elem\",\n elem: sup.elem,\n marginLeft: slant + \"em\"\n }, {\n type: \"kern\",\n size: options.fontMetrics().bigOpSpacing5\n }]\n }, options);\n } else {\n // This case probably shouldn't occur (this would mean the\n // supsub was sending us a group with no superscript or\n // subscript) but be safe.\n return base;\n }\n\n return buildCommon.makeSpan([\"mop\", \"op-limits\"], [finalGroup], options);\n};\n// CONCATENATED MODULE: ./src/functions/op.js\n// Limits, symbols\n\n\n\n\n\n\n\n\n\n\n// Most operators have a large successor symbol, but these don't.\nvar noSuccessor = [\"\\\\smallint\"]; // NOTE: Unlike most `htmlBuilder`s, this one handles not only \"op\", but also\n// \"supsub\" since some of them (like \\int) can affect super/subscripting.\n\nvar op_htmlBuilder = function htmlBuilder(grp, options) {\n // Operators are handled in the TeXbook pg. 443-444, rule 13(a).\n var supGroup;\n var subGroup;\n var hasLimits = false;\n var group;\n var supSub = checkNodeType(grp, \"supsub\");\n\n if (supSub) {\n // If we have limits, supsub will pass us its group to handle. Pull\n // out the superscript and subscript and set the group to the op in\n // its base.\n supGroup = supSub.sup;\n subGroup = supSub.sub;\n group = assertNodeType(supSub.base, \"op\");\n hasLimits = true;\n } else {\n group = assertNodeType(grp, \"op\");\n }\n\n var style = options.style;\n var large = false;\n\n if (style.size === src_Style.DISPLAY.size && group.symbol && !utils.contains(noSuccessor, group.name)) {\n // Most symbol operators get larger in displaystyle (rule 13)\n large = true;\n }\n\n var base;\n\n if (group.symbol) {\n // If this is a symbol, create the symbol.\n var fontName = large ? \"Size2-Regular\" : \"Size1-Regular\";\n var stash = \"\";\n\n if (group.name === \"\\\\oiint\" || group.name === \"\\\\oiiint\") {\n // No font glyphs yet, so use a glyph w/o the oval.\n // TODO: When font glyphs are available, delete this code.\n stash = group.name.substr(1); // $FlowFixMe\n\n group.name = stash === \"oiint\" ? \"\\\\iint\" : \"\\\\iiint\";\n }\n\n base = buildCommon.makeSymbol(group.name, fontName, \"math\", options, [\"mop\", \"op-symbol\", large ? \"large-op\" : \"small-op\"]);\n\n if (stash.length > 0) {\n // We're in \\oiint or \\oiiint. Overlay the oval.\n // TODO: When font glyphs are available, delete this code.\n var italic = base.italic;\n var oval = buildCommon.staticSvg(stash + \"Size\" + (large ? \"2\" : \"1\"), options);\n base = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: [{\n type: \"elem\",\n elem: base,\n shift: 0\n }, {\n type: \"elem\",\n elem: oval,\n shift: large ? 0.08 : 0\n }]\n }, options); // $FlowFixMe\n\n group.name = \"\\\\\" + stash;\n base.classes.unshift(\"mop\"); // $FlowFixMe\n\n base.italic = italic;\n }\n } else if (group.body) {\n // If this is a list, compose that list.\n var inner = buildHTML_buildExpression(group.body, options, true);\n\n if (inner.length === 1 && inner[0] instanceof domTree_SymbolNode) {\n base = inner[0];\n base.classes[0] = \"mop\"; // replace old mclass\n } else {\n base = buildCommon.makeSpan([\"mop\"], buildCommon.tryCombineChars(inner), options);\n }\n } else {\n // Otherwise, this is a text operator. Build the text from the\n // operator's name.\n // TODO(emily): Add a space in the middle of some of these\n // operators, like \\limsup\n var output = [];\n\n for (var i = 1; i < group.name.length; i++) {\n output.push(buildCommon.mathsym(group.name[i], group.mode, options));\n }\n\n base = buildCommon.makeSpan([\"mop\"], output, options);\n } // If content of op is a single symbol, shift it vertically.\n\n\n var baseShift = 0;\n var slant = 0;\n\n if ((base instanceof domTree_SymbolNode || group.name === \"\\\\oiint\" || group.name === \"\\\\oiiint\") && !group.suppressBaseShift) {\n // We suppress the shift of the base of \\overset and \\underset. Otherwise,\n // shift the symbol so its center lies on the axis (rule 13). It\n // appears that our fonts have the centers of the symbols already\n // almost on the axis, so these numbers are very small. Note we\n // don't actually apply this here, but instead it is used either in\n // the vlist creation or separately when there are no limits.\n baseShift = (base.height - base.depth) / 2 - options.fontMetrics().axisHeight; // The slant of the symbol is just its italic correction.\n // $FlowFixMe\n\n slant = base.italic;\n }\n\n if (hasLimits) {\n return assembleSupSub_assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift);\n } else {\n if (baseShift) {\n base.style.position = \"relative\";\n base.style.top = baseShift + \"em\";\n }\n\n return base;\n }\n};\n\nvar op_mathmlBuilder = function mathmlBuilder(group, options) {\n var node;\n\n if (group.symbol) {\n // This is a symbol. Just add the symbol.\n node = new mathMLTree_MathNode(\"mo\", [buildMathML_makeText(group.name, group.mode)]);\n\n if (utils.contains(noSuccessor, group.name)) {\n node.setAttribute(\"largeop\", \"false\");\n }\n } else if (group.body) {\n // This is an operator with children. Add them.\n node = new mathMLTree_MathNode(\"mo\", buildMathML_buildExpression(group.body, options));\n } else {\n // This is a text operator. Add all of the characters from the\n // operator's name.\n node = new mathMLTree_MathNode(\"mi\", [new mathMLTree_TextNode(group.name.slice(1))]); // Append an .\n // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4\n\n var operator = new mathMLTree_MathNode(\"mo\", [buildMathML_makeText(\"\\u2061\", \"text\")]);\n\n if (group.parentIsSupSub) {\n node = new mathMLTree_MathNode(\"mo\", [node, operator]);\n } else {\n node = newDocumentFragment([node, operator]);\n }\n }\n\n return node;\n};\n\nvar singleCharBigOps = {\n \"\\u220F\": \"\\\\prod\",\n \"\\u2210\": \"\\\\coprod\",\n \"\\u2211\": \"\\\\sum\",\n \"\\u22C0\": \"\\\\bigwedge\",\n \"\\u22C1\": \"\\\\bigvee\",\n \"\\u22C2\": \"\\\\bigcap\",\n \"\\u22C3\": \"\\\\bigcup\",\n \"\\u2A00\": \"\\\\bigodot\",\n \"\\u2A01\": \"\\\\bigoplus\",\n \"\\u2A02\": \"\\\\bigotimes\",\n \"\\u2A04\": \"\\\\biguplus\",\n \"\\u2A06\": \"\\\\bigsqcup\"\n};\ndefineFunction({\n type: \"op\",\n names: [\"\\\\coprod\", \"\\\\bigvee\", \"\\\\bigwedge\", \"\\\\biguplus\", \"\\\\bigcap\", \"\\\\bigcup\", \"\\\\intop\", \"\\\\prod\", \"\\\\sum\", \"\\\\bigotimes\", \"\\\\bigoplus\", \"\\\\bigodot\", \"\\\\bigsqcup\", \"\\\\smallint\", \"\\u220F\", \"\\u2210\", \"\\u2211\", \"\\u22C0\", \"\\u22C1\", \"\\u22C2\", \"\\u22C3\", \"\\u2A00\", \"\\u2A01\", \"\\u2A02\", \"\\u2A04\", \"\\u2A06\"],\n props: {\n numArgs: 0\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser,\n funcName = _ref.funcName;\n var fName = funcName;\n\n if (fName.length === 1) {\n fName = singleCharBigOps[fName];\n }\n\n return {\n type: \"op\",\n mode: parser.mode,\n limits: true,\n parentIsSupSub: false,\n symbol: true,\n name: fName\n };\n },\n htmlBuilder: op_htmlBuilder,\n mathmlBuilder: op_mathmlBuilder\n}); // Note: calling defineFunction with a type that's already been defined only\n// works because the same htmlBuilder and mathmlBuilder are being used.\n\ndefineFunction({\n type: \"op\",\n names: [\"\\\\mathop\"],\n props: {\n numArgs: 1\n },\n handler: function handler(_ref2, args) {\n var parser = _ref2.parser;\n var body = args[0];\n return {\n type: \"op\",\n mode: parser.mode,\n limits: false,\n parentIsSupSub: false,\n symbol: false,\n body: defineFunction_ordargument(body)\n };\n },\n htmlBuilder: op_htmlBuilder,\n mathmlBuilder: op_mathmlBuilder\n}); // There are 2 flags for operators; whether they produce limits in\n// displaystyle, and whether they are symbols and should grow in\n// displaystyle. These four groups cover the four possible choices.\n\nvar singleCharIntegrals = {\n \"\\u222B\": \"\\\\int\",\n \"\\u222C\": \"\\\\iint\",\n \"\\u222D\": \"\\\\iiint\",\n \"\\u222E\": \"\\\\oint\",\n \"\\u222F\": \"\\\\oiint\",\n \"\\u2230\": \"\\\\oiiint\"\n}; // No limits, not symbols\n\ndefineFunction({\n type: \"op\",\n names: [\"\\\\arcsin\", \"\\\\arccos\", \"\\\\arctan\", \"\\\\arctg\", \"\\\\arcctg\", \"\\\\arg\", \"\\\\ch\", \"\\\\cos\", \"\\\\cosec\", \"\\\\cosh\", \"\\\\cot\", \"\\\\cotg\", \"\\\\coth\", \"\\\\csc\", \"\\\\ctg\", \"\\\\cth\", \"\\\\deg\", \"\\\\dim\", \"\\\\exp\", \"\\\\hom\", \"\\\\ker\", \"\\\\lg\", \"\\\\ln\", \"\\\\log\", \"\\\\sec\", \"\\\\sin\", \"\\\\sinh\", \"\\\\sh\", \"\\\\tan\", \"\\\\tanh\", \"\\\\tg\", \"\\\\th\"],\n props: {\n numArgs: 0\n },\n handler: function handler(_ref3) {\n var parser = _ref3.parser,\n funcName = _ref3.funcName;\n return {\n type: \"op\",\n mode: parser.mode,\n limits: false,\n parentIsSupSub: false,\n symbol: false,\n name: funcName\n };\n },\n htmlBuilder: op_htmlBuilder,\n mathmlBuilder: op_mathmlBuilder\n}); // Limits, not symbols\n\ndefineFunction({\n type: \"op\",\n names: [\"\\\\det\", \"\\\\gcd\", \"\\\\inf\", \"\\\\lim\", \"\\\\max\", \"\\\\min\", \"\\\\Pr\", \"\\\\sup\"],\n props: {\n numArgs: 0\n },\n handler: function handler(_ref4) {\n var parser = _ref4.parser,\n funcName = _ref4.funcName;\n return {\n type: \"op\",\n mode: parser.mode,\n limits: true,\n parentIsSupSub: false,\n symbol: false,\n name: funcName\n };\n },\n htmlBuilder: op_htmlBuilder,\n mathmlBuilder: op_mathmlBuilder\n}); // No limits, symbols\n\ndefineFunction({\n type: \"op\",\n names: [\"\\\\int\", \"\\\\iint\", \"\\\\iiint\", \"\\\\oint\", \"\\\\oiint\", \"\\\\oiiint\", \"\\u222B\", \"\\u222C\", \"\\u222D\", \"\\u222E\", \"\\u222F\", \"\\u2230\"],\n props: {\n numArgs: 0\n },\n handler: function handler(_ref5) {\n var parser = _ref5.parser,\n funcName = _ref5.funcName;\n var fName = funcName;\n\n if (fName.length === 1) {\n fName = singleCharIntegrals[fName];\n }\n\n return {\n type: \"op\",\n mode: parser.mode,\n limits: false,\n parentIsSupSub: false,\n symbol: true,\n name: fName\n };\n },\n htmlBuilder: op_htmlBuilder,\n mathmlBuilder: op_mathmlBuilder\n});\n// CONCATENATED MODULE: ./src/functions/operatorname.js\n\n\n\n\n\n\n\n\n// NOTE: Unlike most `htmlBuilder`s, this one handles not only\n// \"operatorname\", but also \"supsub\" since \\operatorname* can\nvar operatorname_htmlBuilder = function htmlBuilder(grp, options) {\n // Operators are handled in the TeXbook pg. 443-444, rule 13(a).\n var supGroup;\n var subGroup;\n var hasLimits = false;\n var group;\n var supSub = checkNodeType(grp, \"supsub\");\n\n if (supSub) {\n // If we have limits, supsub will pass us its group to handle. Pull\n // out the superscript and subscript and set the group to the op in\n // its base.\n supGroup = supSub.sup;\n subGroup = supSub.sub;\n group = assertNodeType(supSub.base, \"operatorname\");\n hasLimits = true;\n } else {\n group = assertNodeType(grp, \"operatorname\");\n }\n\n var base;\n\n if (group.body.length > 0) {\n var body = group.body.map(function (child) {\n // $FlowFixMe: Check if the node has a string `text` property.\n var childText = child.text;\n\n if (typeof childText === \"string\") {\n return {\n type: \"textord\",\n mode: child.mode,\n text: childText\n };\n } else {\n return child;\n }\n }); // Consolidate function names into symbol characters.\n\n var expression = buildHTML_buildExpression(body, options.withFont(\"mathrm\"), true);\n\n for (var i = 0; i < expression.length; i++) {\n var child = expression[i];\n\n if (child instanceof domTree_SymbolNode) {\n // Per amsopn package,\n // change minus to hyphen and \\ast to asterisk\n child.text = child.text.replace(/\\u2212/, \"-\").replace(/\\u2217/, \"*\");\n }\n }\n\n base = buildCommon.makeSpan([\"mop\"], expression, options);\n } else {\n base = buildCommon.makeSpan([\"mop\"], [], options);\n }\n\n if (hasLimits) {\n return assembleSupSub_assembleSupSub(base, supGroup, subGroup, options, options.style, 0, 0);\n } else {\n return base;\n }\n};\n\nvar operatorname_mathmlBuilder = function mathmlBuilder(group, options) {\n // The steps taken here are similar to the html version.\n var expression = buildMathML_buildExpression(group.body, options.withFont(\"mathrm\")); // Is expression a string or has it something like a fraction?\n\n var isAllString = true; // default\n\n for (var i = 0; i < expression.length; i++) {\n var node = expression[i];\n\n if (node instanceof mathMLTree.SpaceNode) {// Do nothing\n } else if (node instanceof mathMLTree.MathNode) {\n switch (node.type) {\n case \"mi\":\n case \"mn\":\n case \"ms\":\n case \"mspace\":\n case \"mtext\":\n break;\n // Do nothing yet.\n\n case \"mo\":\n {\n var child = node.children[0];\n\n if (node.children.length === 1 && child instanceof mathMLTree.TextNode) {\n child.text = child.text.replace(/\\u2212/, \"-\").replace(/\\u2217/, \"*\");\n } else {\n isAllString = false;\n }\n\n break;\n }\n\n default:\n isAllString = false;\n }\n } else {\n isAllString = false;\n }\n }\n\n if (isAllString) {\n // Write a single TextNode instead of multiple nested tags.\n var word = expression.map(function (node) {\n return node.toText();\n }).join(\"\");\n expression = [new mathMLTree.TextNode(word)];\n }\n\n var identifier = new mathMLTree.MathNode(\"mi\", expression);\n identifier.setAttribute(\"mathvariant\", \"normal\"); // \\u2061 is the same as ⁡\n // ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp\n\n var operator = new mathMLTree.MathNode(\"mo\", [buildMathML_makeText(\"\\u2061\", \"text\")]);\n\n if (group.parentIsSupSub) {\n return new mathMLTree.MathNode(\"mo\", [identifier, operator]);\n } else {\n return mathMLTree.newDocumentFragment([identifier, operator]);\n }\n}; // \\operatorname\n// amsopn.dtx: \\mathop{#1\\kern\\z@\\operator@font#3}\\newmcodes@\n\n\ndefineFunction({\n type: \"operatorname\",\n names: [\"\\\\operatorname\", \"\\\\operatorname*\"],\n props: {\n numArgs: 1\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser,\n funcName = _ref.funcName;\n var body = args[0];\n return {\n type: \"operatorname\",\n mode: parser.mode,\n body: defineFunction_ordargument(body),\n alwaysHandleSupSub: funcName === \"\\\\operatorname*\",\n limits: false,\n parentIsSupSub: false\n };\n },\n htmlBuilder: operatorname_htmlBuilder,\n mathmlBuilder: operatorname_mathmlBuilder\n});\n// CONCATENATED MODULE: ./src/functions/ordgroup.js\n\n\n\n\ndefineFunctionBuilders({\n type: \"ordgroup\",\n htmlBuilder: function htmlBuilder(group, options) {\n if (group.semisimple) {\n return buildCommon.makeFragment(buildHTML_buildExpression(group.body, options, false));\n }\n\n return buildCommon.makeSpan([\"mord\"], buildHTML_buildExpression(group.body, options, true), options);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n return buildExpressionRow(group.body, options, true);\n }\n});\n// CONCATENATED MODULE: ./src/functions/overline.js\n\n\n\n\n\ndefineFunction({\n type: \"overline\",\n names: [\"\\\\overline\"],\n props: {\n numArgs: 1\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser;\n var body = args[0];\n return {\n type: \"overline\",\n mode: parser.mode,\n body: body\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n // Overlines are handled in the TeXbook pg 443, Rule 9.\n // Build the inner group in the cramped style.\n var innerGroup = buildHTML_buildGroup(group.body, options.havingCrampedStyle()); // Create the line above the body\n\n var line = buildCommon.makeLineSpan(\"overline-line\", options); // Generate the vlist, with the appropriate kerns\n\n var defaultRuleThickness = options.fontMetrics().defaultRuleThickness;\n var vlist = buildCommon.makeVList({\n positionType: \"firstBaseline\",\n children: [{\n type: \"elem\",\n elem: innerGroup\n }, {\n type: \"kern\",\n size: 3 * defaultRuleThickness\n }, {\n type: \"elem\",\n elem: line\n }, {\n type: \"kern\",\n size: defaultRuleThickness\n }]\n }, options);\n return buildCommon.makeSpan([\"mord\", \"overline\"], [vlist], options);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var operator = new mathMLTree.MathNode(\"mo\", [new mathMLTree.TextNode(\"\\u203E\")]);\n operator.setAttribute(\"stretchy\", \"true\");\n var node = new mathMLTree.MathNode(\"mover\", [buildMathML_buildGroup(group.body, options), operator]);\n node.setAttribute(\"accent\", \"true\");\n return node;\n }\n});\n// CONCATENATED MODULE: ./src/functions/phantom.js\n\n\n\n\n\ndefineFunction({\n type: \"phantom\",\n names: [\"\\\\phantom\"],\n props: {\n numArgs: 1,\n allowedInText: true\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser;\n var body = args[0];\n return {\n type: \"phantom\",\n mode: parser.mode,\n body: defineFunction_ordargument(body)\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n var elements = buildHTML_buildExpression(group.body, options.withPhantom(), false); // \\phantom isn't supposed to affect the elements it contains.\n // See \"color\" for more details.\n\n return buildCommon.makeFragment(elements);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var inner = buildMathML_buildExpression(group.body, options);\n return new mathMLTree.MathNode(\"mphantom\", inner);\n }\n});\ndefineFunction({\n type: \"hphantom\",\n names: [\"\\\\hphantom\"],\n props: {\n numArgs: 1,\n allowedInText: true\n },\n handler: function handler(_ref2, args) {\n var parser = _ref2.parser;\n var body = args[0];\n return {\n type: \"hphantom\",\n mode: parser.mode,\n body: body\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n var node = buildCommon.makeSpan([], [buildHTML_buildGroup(group.body, options.withPhantom())]);\n node.height = 0;\n node.depth = 0;\n\n if (node.children) {\n for (var i = 0; i < node.children.length; i++) {\n node.children[i].height = 0;\n node.children[i].depth = 0;\n }\n } // See smash for comment re: use of makeVList\n\n\n node = buildCommon.makeVList({\n positionType: \"firstBaseline\",\n children: [{\n type: \"elem\",\n elem: node\n }]\n }, options); // For spacing, TeX treats \\smash as a math group (same spacing as ord).\n\n return buildCommon.makeSpan([\"mord\"], [node], options);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var inner = buildMathML_buildExpression(defineFunction_ordargument(group.body), options);\n var phantom = new mathMLTree.MathNode(\"mphantom\", inner);\n var node = new mathMLTree.MathNode(\"mpadded\", [phantom]);\n node.setAttribute(\"height\", \"0px\");\n node.setAttribute(\"depth\", \"0px\");\n return node;\n }\n});\ndefineFunction({\n type: \"vphantom\",\n names: [\"\\\\vphantom\"],\n props: {\n numArgs: 1,\n allowedInText: true\n },\n handler: function handler(_ref3, args) {\n var parser = _ref3.parser;\n var body = args[0];\n return {\n type: \"vphantom\",\n mode: parser.mode,\n body: body\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n var inner = buildCommon.makeSpan([\"inner\"], [buildHTML_buildGroup(group.body, options.withPhantom())]);\n var fix = buildCommon.makeSpan([\"fix\"], []);\n return buildCommon.makeSpan([\"mord\", \"rlap\"], [inner, fix], options);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var inner = buildMathML_buildExpression(defineFunction_ordargument(group.body), options);\n var phantom = new mathMLTree.MathNode(\"mphantom\", inner);\n var node = new mathMLTree.MathNode(\"mpadded\", [phantom]);\n node.setAttribute(\"width\", \"0px\");\n return node;\n }\n});\n// CONCATENATED MODULE: ./src/functions/raisebox.js\n\n\n\n\n\n\n // Box manipulation\n\ndefineFunction({\n type: \"raisebox\",\n names: [\"\\\\raisebox\"],\n props: {\n numArgs: 2,\n argTypes: [\"size\", \"hbox\"],\n allowedInText: true\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser;\n var amount = assertNodeType(args[0], \"size\").value;\n var body = args[1];\n return {\n type: \"raisebox\",\n mode: parser.mode,\n dy: amount,\n body: body\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n var body = buildHTML_buildGroup(group.body, options);\n var dy = units_calculateSize(group.dy, options);\n return buildCommon.makeVList({\n positionType: \"shift\",\n positionData: -dy,\n children: [{\n type: \"elem\",\n elem: body\n }]\n }, options);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var node = new mathMLTree.MathNode(\"mpadded\", [buildMathML_buildGroup(group.body, options)]);\n var dy = group.dy.number + group.dy.unit;\n node.setAttribute(\"voffset\", dy);\n return node;\n }\n});\n// CONCATENATED MODULE: ./src/functions/rule.js\n\n\n\n\n\ndefineFunction({\n type: \"rule\",\n names: [\"\\\\rule\"],\n props: {\n numArgs: 2,\n numOptionalArgs: 1,\n argTypes: [\"size\", \"size\", \"size\"]\n },\n handler: function handler(_ref, args, optArgs) {\n var parser = _ref.parser;\n var shift = optArgs[0];\n var width = assertNodeType(args[0], \"size\");\n var height = assertNodeType(args[1], \"size\");\n return {\n type: \"rule\",\n mode: parser.mode,\n shift: shift && assertNodeType(shift, \"size\").value,\n width: width.value,\n height: height.value\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n // Make an empty span for the rule\n var rule = buildCommon.makeSpan([\"mord\", \"rule\"], [], options); // Calculate the shift, width, and height of the rule, and account for units\n\n var width = units_calculateSize(group.width, options);\n var height = units_calculateSize(group.height, options);\n var shift = group.shift ? units_calculateSize(group.shift, options) : 0; // Style the rule to the right size\n\n rule.style.borderRightWidth = width + \"em\";\n rule.style.borderTopWidth = height + \"em\";\n rule.style.bottom = shift + \"em\"; // Record the height and width\n\n rule.width = width;\n rule.height = height + shift;\n rule.depth = -shift; // Font size is the number large enough that the browser will\n // reserve at least `absHeight` space above the baseline.\n // The 1.125 factor was empirically determined\n\n rule.maxFontSize = height * 1.125 * options.sizeMultiplier;\n return rule;\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var width = units_calculateSize(group.width, options);\n var height = units_calculateSize(group.height, options);\n var shift = group.shift ? units_calculateSize(group.shift, options) : 0;\n var color = options.color && options.getColor() || \"black\";\n var rule = new mathMLTree.MathNode(\"mspace\");\n rule.setAttribute(\"mathbackground\", color);\n rule.setAttribute(\"width\", width + \"em\");\n rule.setAttribute(\"height\", height + \"em\");\n var wrapper = new mathMLTree.MathNode(\"mpadded\", [rule]);\n\n if (shift >= 0) {\n wrapper.setAttribute(\"height\", \"+\" + shift + \"em\");\n } else {\n wrapper.setAttribute(\"height\", shift + \"em\");\n wrapper.setAttribute(\"depth\", \"+\" + -shift + \"em\");\n }\n\n wrapper.setAttribute(\"voffset\", shift + \"em\");\n return wrapper;\n }\n});\n// CONCATENATED MODULE: ./src/functions/sizing.js\n\n\n\n\n\nfunction sizingGroup(value, options, baseOptions) {\n var inner = buildHTML_buildExpression(value, options, false);\n var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; // Add size-resetting classes to the inner list and set maxFontSize\n // manually. Handle nested size changes.\n\n for (var i = 0; i < inner.length; i++) {\n var pos = inner[i].classes.indexOf(\"sizing\");\n\n if (pos < 0) {\n Array.prototype.push.apply(inner[i].classes, options.sizingClasses(baseOptions));\n } else if (inner[i].classes[pos + 1] === \"reset-size\" + options.size) {\n // This is a nested size change: e.g., inner[i] is the \"b\" in\n // `\\Huge a \\small b`. Override the old size (the `reset-` class)\n // but not the new size.\n inner[i].classes[pos + 1] = \"reset-size\" + baseOptions.size;\n }\n\n inner[i].height *= multiplier;\n inner[i].depth *= multiplier;\n }\n\n return buildCommon.makeFragment(inner);\n}\nvar sizeFuncs = [\"\\\\tiny\", \"\\\\sixptsize\", \"\\\\scriptsize\", \"\\\\footnotesize\", \"\\\\small\", \"\\\\normalsize\", \"\\\\large\", \"\\\\Large\", \"\\\\LARGE\", \"\\\\huge\", \"\\\\Huge\"];\nvar sizing_htmlBuilder = function htmlBuilder(group, options) {\n // Handle sizing operators like \\Huge. Real TeX doesn't actually allow\n // these functions inside of math expressions, so we do some special\n // handling.\n var newOptions = options.havingSize(group.size);\n return sizingGroup(group.body, newOptions, options);\n};\ndefineFunction({\n type: \"sizing\",\n names: sizeFuncs,\n props: {\n numArgs: 0,\n allowedInText: true\n },\n handler: function handler(_ref, args) {\n var breakOnTokenText = _ref.breakOnTokenText,\n funcName = _ref.funcName,\n parser = _ref.parser;\n var body = parser.parseExpression(false, breakOnTokenText);\n return {\n type: \"sizing\",\n mode: parser.mode,\n // Figure out what size to use based on the list of functions above\n size: sizeFuncs.indexOf(funcName) + 1,\n body: body\n };\n },\n htmlBuilder: sizing_htmlBuilder,\n mathmlBuilder: function mathmlBuilder(group, options) {\n var newOptions = options.havingSize(group.size);\n var inner = buildMathML_buildExpression(group.body, newOptions);\n var node = new mathMLTree.MathNode(\"mstyle\", inner); // TODO(emily): This doesn't produce the correct size for nested size\n // changes, because we don't keep state of what style we're currently\n // in, so we can't reset the size to normal before changing it. Now\n // that we're passing an options parameter we should be able to fix\n // this.\n\n node.setAttribute(\"mathsize\", newOptions.sizeMultiplier + \"em\");\n return node;\n }\n});\n// CONCATENATED MODULE: ./src/functions/smash.js\n// smash, with optional [tb], as in AMS\n\n\n\n\n\n\ndefineFunction({\n type: \"smash\",\n names: [\"\\\\smash\"],\n props: {\n numArgs: 1,\n numOptionalArgs: 1,\n allowedInText: true\n },\n handler: function handler(_ref, args, optArgs) {\n var parser = _ref.parser;\n var smashHeight = false;\n var smashDepth = false;\n var tbArg = optArgs[0] && assertNodeType(optArgs[0], \"ordgroup\");\n\n if (tbArg) {\n // Optional [tb] argument is engaged.\n // ref: amsmath: \\renewcommand{\\smash}[1][tb]{%\n // def\\mb@t{\\ht}\\def\\mb@b{\\dp}\\def\\mb@tb{\\ht\\z@\\z@\\dp}%\n var letter = \"\";\n\n for (var i = 0; i < tbArg.body.length; ++i) {\n var node = tbArg.body[i]; // $FlowFixMe: Not every node type has a `text` property.\n\n letter = node.text;\n\n if (letter === \"t\") {\n smashHeight = true;\n } else if (letter === \"b\") {\n smashDepth = true;\n } else {\n smashHeight = false;\n smashDepth = false;\n break;\n }\n }\n } else {\n smashHeight = true;\n smashDepth = true;\n }\n\n var body = args[0];\n return {\n type: \"smash\",\n mode: parser.mode,\n body: body,\n smashHeight: smashHeight,\n smashDepth: smashDepth\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n var node = buildCommon.makeSpan([], [buildHTML_buildGroup(group.body, options)]);\n\n if (!group.smashHeight && !group.smashDepth) {\n return node;\n }\n\n if (group.smashHeight) {\n node.height = 0; // In order to influence makeVList, we have to reset the children.\n\n if (node.children) {\n for (var i = 0; i < node.children.length; i++) {\n node.children[i].height = 0;\n }\n }\n }\n\n if (group.smashDepth) {\n node.depth = 0;\n\n if (node.children) {\n for (var _i = 0; _i < node.children.length; _i++) {\n node.children[_i].depth = 0;\n }\n }\n } // At this point, we've reset the TeX-like height and depth values.\n // But the span still has an HTML line height.\n // makeVList applies \"display: table-cell\", which prevents the browser\n // from acting on that line height. So we'll call makeVList now.\n\n\n var smashedNode = buildCommon.makeVList({\n positionType: \"firstBaseline\",\n children: [{\n type: \"elem\",\n elem: node\n }]\n }, options); // For spacing, TeX treats \\hphantom as a math group (same spacing as ord).\n\n return buildCommon.makeSpan([\"mord\"], [smashedNode], options);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var node = new mathMLTree.MathNode(\"mpadded\", [buildMathML_buildGroup(group.body, options)]);\n\n if (group.smashHeight) {\n node.setAttribute(\"height\", \"0px\");\n }\n\n if (group.smashDepth) {\n node.setAttribute(\"depth\", \"0px\");\n }\n\n return node;\n }\n});\n// CONCATENATED MODULE: ./src/functions/sqrt.js\n\n\n\n\n\n\n\ndefineFunction({\n type: \"sqrt\",\n names: [\"\\\\sqrt\"],\n props: {\n numArgs: 1,\n numOptionalArgs: 1\n },\n handler: function handler(_ref, args, optArgs) {\n var parser = _ref.parser;\n var index = optArgs[0];\n var body = args[0];\n return {\n type: \"sqrt\",\n mode: parser.mode,\n body: body,\n index: index\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n // Square roots are handled in the TeXbook pg. 443, Rule 11.\n // First, we do the same steps as in overline to build the inner group\n // and line\n var inner = buildHTML_buildGroup(group.body, options.havingCrampedStyle());\n\n if (inner.height === 0) {\n // Render a small surd.\n inner.height = options.fontMetrics().xHeight;\n } // Some groups can return document fragments. Handle those by wrapping\n // them in a span.\n\n\n inner = buildCommon.wrapFragment(inner, options); // Calculate the minimum size for the \\surd delimiter\n\n var metrics = options.fontMetrics();\n var theta = metrics.defaultRuleThickness;\n var phi = theta;\n\n if (options.style.id < src_Style.TEXT.id) {\n phi = options.fontMetrics().xHeight;\n } // Calculate the clearance between the body and line\n\n\n var lineClearance = theta + phi / 4;\n var minDelimiterHeight = inner.height + inner.depth + lineClearance + theta; // Create a sqrt SVG of the required minimum size\n\n var _delimiter$sqrtImage = delimiter.sqrtImage(minDelimiterHeight, options),\n img = _delimiter$sqrtImage.span,\n ruleWidth = _delimiter$sqrtImage.ruleWidth,\n advanceWidth = _delimiter$sqrtImage.advanceWidth;\n\n var delimDepth = img.height - ruleWidth; // Adjust the clearance based on the delimiter size\n\n if (delimDepth > inner.height + inner.depth + lineClearance) {\n lineClearance = (lineClearance + delimDepth - inner.height - inner.depth) / 2;\n } // Shift the sqrt image\n\n\n var imgShift = img.height - inner.height - lineClearance - ruleWidth;\n inner.style.paddingLeft = advanceWidth + \"em\"; // Overlay the image and the argument.\n\n var body = buildCommon.makeVList({\n positionType: \"firstBaseline\",\n children: [{\n type: \"elem\",\n elem: inner,\n wrapperClasses: [\"svg-align\"]\n }, {\n type: \"kern\",\n size: -(inner.height + imgShift)\n }, {\n type: \"elem\",\n elem: img\n }, {\n type: \"kern\",\n size: ruleWidth\n }]\n }, options);\n\n if (!group.index) {\n return buildCommon.makeSpan([\"mord\", \"sqrt\"], [body], options);\n } else {\n // Handle the optional root index\n // The index is always in scriptscript style\n var newOptions = options.havingStyle(src_Style.SCRIPTSCRIPT);\n var rootm = buildHTML_buildGroup(group.index, newOptions, options); // The amount the index is shifted by. This is taken from the TeX\n // source, in the definition of `\\r@@t`.\n\n var toShift = 0.6 * (body.height - body.depth); // Build a VList with the superscript shifted up correctly\n\n var rootVList = buildCommon.makeVList({\n positionType: \"shift\",\n positionData: -toShift,\n children: [{\n type: \"elem\",\n elem: rootm\n }]\n }, options); // Add a class surrounding it so we can add on the appropriate\n // kerning\n\n var rootVListWrap = buildCommon.makeSpan([\"root\"], [rootVList]);\n return buildCommon.makeSpan([\"mord\", \"sqrt\"], [rootVListWrap, body], options);\n }\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var body = group.body,\n index = group.index;\n return index ? new mathMLTree.MathNode(\"mroot\", [buildMathML_buildGroup(body, options), buildMathML_buildGroup(index, options)]) : new mathMLTree.MathNode(\"msqrt\", [buildMathML_buildGroup(body, options)]);\n }\n});\n// CONCATENATED MODULE: ./src/functions/styling.js\n\n\n\n\n\nvar styling_styleMap = {\n \"display\": src_Style.DISPLAY,\n \"text\": src_Style.TEXT,\n \"script\": src_Style.SCRIPT,\n \"scriptscript\": src_Style.SCRIPTSCRIPT\n};\ndefineFunction({\n type: \"styling\",\n names: [\"\\\\displaystyle\", \"\\\\textstyle\", \"\\\\scriptstyle\", \"\\\\scriptscriptstyle\"],\n props: {\n numArgs: 0,\n allowedInText: true\n },\n handler: function handler(_ref, args) {\n var breakOnTokenText = _ref.breakOnTokenText,\n funcName = _ref.funcName,\n parser = _ref.parser;\n // parse out the implicit body\n var body = parser.parseExpression(true, breakOnTokenText); // TODO: Refactor to avoid duplicating styleMap in multiple places (e.g.\n // here and in buildHTML and de-dupe the enumeration of all the styles).\n // $FlowFixMe: The names above exactly match the styles.\n\n var style = funcName.slice(1, funcName.length - 5);\n return {\n type: \"styling\",\n mode: parser.mode,\n // Figure out what style to use by pulling out the style from\n // the function name\n style: style,\n body: body\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n // Style changes are handled in the TeXbook on pg. 442, Rule 3.\n var newStyle = styling_styleMap[group.style];\n var newOptions = options.havingStyle(newStyle).withFont('');\n return sizingGroup(group.body, newOptions, options);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n // Figure out what style we're changing to.\n var newStyle = styling_styleMap[group.style];\n var newOptions = options.havingStyle(newStyle);\n var inner = buildMathML_buildExpression(group.body, newOptions);\n var node = new mathMLTree.MathNode(\"mstyle\", inner);\n var styleAttributes = {\n \"display\": [\"0\", \"true\"],\n \"text\": [\"0\", \"false\"],\n \"script\": [\"1\", \"false\"],\n \"scriptscript\": [\"2\", \"false\"]\n };\n var attr = styleAttributes[group.style];\n node.setAttribute(\"scriptlevel\", attr[0]);\n node.setAttribute(\"displaystyle\", attr[1]);\n return node;\n }\n});\n// CONCATENATED MODULE: ./src/functions/supsub.js\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * Sometimes, groups perform special rules when they have superscripts or\n * subscripts attached to them. This function lets the `supsub` group know that\n * Sometimes, groups perform special rules when they have superscripts or\n * its inner element should handle the superscripts and subscripts instead of\n * handling them itself.\n */\nvar supsub_htmlBuilderDelegate = function htmlBuilderDelegate(group, options) {\n var base = group.base;\n\n if (!base) {\n return null;\n } else if (base.type === \"op\") {\n // Operators handle supsubs differently when they have limits\n // (e.g. `\\displaystyle\\sum_2^3`)\n var delegate = base.limits && (options.style.size === src_Style.DISPLAY.size || base.alwaysHandleSupSub);\n return delegate ? op_htmlBuilder : null;\n } else if (base.type === \"operatorname\") {\n var _delegate = base.alwaysHandleSupSub && (options.style.size === src_Style.DISPLAY.size || base.limits);\n\n return _delegate ? operatorname_htmlBuilder : null;\n } else if (base.type === \"accent\") {\n return utils.isCharacterBox(base.base) ? accent_htmlBuilder : null;\n } else if (base.type === \"horizBrace\") {\n var isSup = !group.sub;\n return isSup === base.isOver ? horizBrace_htmlBuilder : null;\n } else {\n return null;\n }\n}; // Super scripts and subscripts, whose precise placement can depend on other\n// functions that precede them.\n\n\ndefineFunctionBuilders({\n type: \"supsub\",\n htmlBuilder: function htmlBuilder(group, options) {\n // Superscript and subscripts are handled in the TeXbook on page\n // 445-446, rules 18(a-f).\n // Here is where we defer to the inner group if it should handle\n // superscripts and subscripts itself.\n var builderDelegate = supsub_htmlBuilderDelegate(group, options);\n\n if (builderDelegate) {\n return builderDelegate(group, options);\n }\n\n var valueBase = group.base,\n valueSup = group.sup,\n valueSub = group.sub;\n var base = buildHTML_buildGroup(valueBase, options);\n var supm;\n var subm;\n var metrics = options.fontMetrics(); // Rule 18a\n\n var supShift = 0;\n var subShift = 0;\n var isCharacterBox = valueBase && utils.isCharacterBox(valueBase);\n\n if (valueSup) {\n var newOptions = options.havingStyle(options.style.sup());\n supm = buildHTML_buildGroup(valueSup, newOptions, options);\n\n if (!isCharacterBox) {\n supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options.sizeMultiplier;\n }\n }\n\n if (valueSub) {\n var _newOptions = options.havingStyle(options.style.sub());\n\n subm = buildHTML_buildGroup(valueSub, _newOptions, options);\n\n if (!isCharacterBox) {\n subShift = base.depth + _newOptions.fontMetrics().subDrop * _newOptions.sizeMultiplier / options.sizeMultiplier;\n }\n } // Rule 18c\n\n\n var minSupShift;\n\n if (options.style === src_Style.DISPLAY) {\n minSupShift = metrics.sup1;\n } else if (options.style.cramped) {\n minSupShift = metrics.sup3;\n } else {\n minSupShift = metrics.sup2;\n } // scriptspace is a font-size-independent size, so scale it\n // appropriately for use as the marginRight.\n\n\n var multiplier = options.sizeMultiplier;\n var marginRight = 0.5 / metrics.ptPerEm / multiplier + \"em\";\n var marginLeft = null;\n\n if (subm) {\n // Subscripts shouldn't be shifted by the base's italic correction.\n // Account for that by shifting the subscript back the appropriate\n // amount. Note we only do this when the base is a single symbol.\n var isOiint = group.base && group.base.type === \"op\" && group.base.name && (group.base.name === \"\\\\oiint\" || group.base.name === \"\\\\oiiint\");\n\n if (base instanceof domTree_SymbolNode || isOiint) {\n // $FlowFixMe\n marginLeft = -base.italic + \"em\";\n }\n }\n\n var supsub;\n\n if (supm && subm) {\n supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);\n subShift = Math.max(subShift, metrics.sub2);\n var ruleWidth = metrics.defaultRuleThickness; // Rule 18e\n\n var maxWidth = 4 * ruleWidth;\n\n if (supShift - supm.depth - (subm.height - subShift) < maxWidth) {\n subShift = maxWidth - (supShift - supm.depth) + subm.height;\n var psi = 0.8 * metrics.xHeight - (supShift - supm.depth);\n\n if (psi > 0) {\n supShift += psi;\n subShift -= psi;\n }\n }\n\n var vlistElem = [{\n type: \"elem\",\n elem: subm,\n shift: subShift,\n marginRight: marginRight,\n marginLeft: marginLeft\n }, {\n type: \"elem\",\n elem: supm,\n shift: -supShift,\n marginRight: marginRight\n }];\n supsub = buildCommon.makeVList({\n positionType: \"individualShift\",\n children: vlistElem\n }, options);\n } else if (subm) {\n // Rule 18b\n subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight);\n var _vlistElem = [{\n type: \"elem\",\n elem: subm,\n marginLeft: marginLeft,\n marginRight: marginRight\n }];\n supsub = buildCommon.makeVList({\n positionType: \"shift\",\n positionData: subShift,\n children: _vlistElem\n }, options);\n } else if (supm) {\n // Rule 18c, d\n supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);\n supsub = buildCommon.makeVList({\n positionType: \"shift\",\n positionData: -supShift,\n children: [{\n type: \"elem\",\n elem: supm,\n marginRight: marginRight\n }]\n }, options);\n } else {\n throw new Error(\"supsub must have either sup or sub.\");\n } // Wrap the supsub vlist in a span.msupsub to reset text-align.\n\n\n var mclass = getTypeOfDomTree(base, \"right\") || \"mord\";\n return buildCommon.makeSpan([mclass], [base, buildCommon.makeSpan([\"msupsub\"], [supsub])], options);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n // Is the inner group a relevant horizonal brace?\n var isBrace = false;\n var isOver;\n var isSup;\n var horizBrace = checkNodeType(group.base, \"horizBrace\");\n\n if (horizBrace) {\n isSup = !!group.sup;\n\n if (isSup === horizBrace.isOver) {\n isBrace = true;\n isOver = horizBrace.isOver;\n }\n }\n\n if (group.base && (group.base.type === \"op\" || group.base.type === \"operatorname\")) {\n group.base.parentIsSupSub = true;\n }\n\n var children = [buildMathML_buildGroup(group.base, options)];\n\n if (group.sub) {\n children.push(buildMathML_buildGroup(group.sub, options));\n }\n\n if (group.sup) {\n children.push(buildMathML_buildGroup(group.sup, options));\n }\n\n var nodeType;\n\n if (isBrace) {\n nodeType = isOver ? \"mover\" : \"munder\";\n } else if (!group.sub) {\n var base = group.base;\n\n if (base && base.type === \"op\" && base.limits && (options.style === src_Style.DISPLAY || base.alwaysHandleSupSub)) {\n nodeType = \"mover\";\n } else if (base && base.type === \"operatorname\" && base.alwaysHandleSupSub && (base.limits || options.style === src_Style.DISPLAY)) {\n nodeType = \"mover\";\n } else {\n nodeType = \"msup\";\n }\n } else if (!group.sup) {\n var _base = group.base;\n\n if (_base && _base.type === \"op\" && _base.limits && (options.style === src_Style.DISPLAY || _base.alwaysHandleSupSub)) {\n nodeType = \"munder\";\n } else if (_base && _base.type === \"operatorname\" && _base.alwaysHandleSupSub && (_base.limits || options.style === src_Style.DISPLAY)) {\n nodeType = \"munder\";\n } else {\n nodeType = \"msub\";\n }\n } else {\n var _base2 = group.base;\n\n if (_base2 && _base2.type === \"op\" && _base2.limits && options.style === src_Style.DISPLAY) {\n nodeType = \"munderover\";\n } else if (_base2 && _base2.type === \"operatorname\" && _base2.alwaysHandleSupSub && (options.style === src_Style.DISPLAY || _base2.limits)) {\n nodeType = \"munderover\";\n } else {\n nodeType = \"msubsup\";\n }\n }\n\n var node = new mathMLTree.MathNode(nodeType, children);\n return node;\n }\n});\n// CONCATENATED MODULE: ./src/functions/symbolsOp.js\n\n\n\n // Operator ParseNodes created in Parser.js from symbol Groups in src/symbols.js.\n\ndefineFunctionBuilders({\n type: \"atom\",\n htmlBuilder: function htmlBuilder(group, options) {\n return buildCommon.mathsym(group.text, group.mode, options, [\"m\" + group.family]);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var node = new mathMLTree.MathNode(\"mo\", [buildMathML_makeText(group.text, group.mode)]);\n\n if (group.family === \"bin\") {\n var variant = buildMathML_getVariant(group, options);\n\n if (variant === \"bold-italic\") {\n node.setAttribute(\"mathvariant\", variant);\n }\n } else if (group.family === \"punct\") {\n node.setAttribute(\"separator\", \"true\");\n } else if (group.family === \"open\" || group.family === \"close\") {\n // Delims built here should not stretch vertically.\n // See delimsizing.js for stretchy delims.\n node.setAttribute(\"stretchy\", \"false\");\n }\n\n return node;\n }\n});\n// CONCATENATED MODULE: ./src/functions/symbolsOrd.js\n\n\n\n\n// \"mathord\" and \"textord\" ParseNodes created in Parser.js from symbol Groups in\nvar defaultVariant = {\n \"mi\": \"italic\",\n \"mn\": \"normal\",\n \"mtext\": \"normal\"\n};\ndefineFunctionBuilders({\n type: \"mathord\",\n htmlBuilder: function htmlBuilder(group, options) {\n return buildCommon.makeOrd(group, options, \"mathord\");\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var node = new mathMLTree.MathNode(\"mi\", [buildMathML_makeText(group.text, group.mode, options)]);\n var variant = buildMathML_getVariant(group, options) || \"italic\";\n\n if (variant !== defaultVariant[node.type]) {\n node.setAttribute(\"mathvariant\", variant);\n }\n\n return node;\n }\n});\ndefineFunctionBuilders({\n type: \"textord\",\n htmlBuilder: function htmlBuilder(group, options) {\n return buildCommon.makeOrd(group, options, \"textord\");\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var text = buildMathML_makeText(group.text, group.mode, options);\n var variant = buildMathML_getVariant(group, options) || \"normal\";\n var node;\n\n if (group.mode === 'text') {\n node = new mathMLTree.MathNode(\"mtext\", [text]);\n } else if (/[0-9]/.test(group.text)) {\n // TODO(kevinb) merge adjacent nodes\n // do it as a post processing step\n node = new mathMLTree.MathNode(\"mn\", [text]);\n } else if (group.text === \"\\\\prime\") {\n node = new mathMLTree.MathNode(\"mo\", [text]);\n } else {\n node = new mathMLTree.MathNode(\"mi\", [text]);\n }\n\n if (variant !== defaultVariant[node.type]) {\n node.setAttribute(\"mathvariant\", variant);\n }\n\n return node;\n }\n});\n// CONCATENATED MODULE: ./src/functions/symbolsSpacing.js\n\n\n\n // A map of CSS-based spacing functions to their CSS class.\n\nvar cssSpace = {\n \"\\\\nobreak\": \"nobreak\",\n \"\\\\allowbreak\": \"allowbreak\"\n}; // A lookup table to determine whether a spacing function/symbol should be\n// treated like a regular space character. If a symbol or command is a key\n// in this table, then it should be a regular space character. Furthermore,\n// the associated value may have a `className` specifying an extra CSS class\n// to add to the created `span`.\n\nvar regularSpace = {\n \" \": {},\n \"\\\\ \": {},\n \"~\": {\n className: \"nobreak\"\n },\n \"\\\\space\": {},\n \"\\\\nobreakspace\": {\n className: \"nobreak\"\n }\n}; // ParseNode<\"spacing\"> created in Parser.js from the \"spacing\" symbol Groups in\n// src/symbols.js.\n\ndefineFunctionBuilders({\n type: \"spacing\",\n htmlBuilder: function htmlBuilder(group, options) {\n if (regularSpace.hasOwnProperty(group.text)) {\n var className = regularSpace[group.text].className || \"\"; // Spaces are generated by adding an actual space. Each of these\n // things has an entry in the symbols table, so these will be turned\n // into appropriate outputs.\n\n if (group.mode === \"text\") {\n var ord = buildCommon.makeOrd(group, options, \"textord\");\n ord.classes.push(className);\n return ord;\n } else {\n return buildCommon.makeSpan([\"mspace\", className], [buildCommon.mathsym(group.text, group.mode, options)], options);\n }\n } else if (cssSpace.hasOwnProperty(group.text)) {\n // Spaces based on just a CSS class.\n return buildCommon.makeSpan([\"mspace\", cssSpace[group.text]], [], options);\n } else {\n throw new src_ParseError(\"Unknown type of space \\\"\" + group.text + \"\\\"\");\n }\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var node;\n\n if (regularSpace.hasOwnProperty(group.text)) {\n node = new mathMLTree.MathNode(\"mtext\", [new mathMLTree.TextNode(\"\\xA0\")]);\n } else if (cssSpace.hasOwnProperty(group.text)) {\n // CSS-based MathML spaces (\\nobreak, \\allowbreak) are ignored\n return new mathMLTree.MathNode(\"mspace\");\n } else {\n throw new src_ParseError(\"Unknown type of space \\\"\" + group.text + \"\\\"\");\n }\n\n return node;\n }\n});\n// CONCATENATED MODULE: ./src/functions/tag.js\n\n\n\n\nvar tag_pad = function pad() {\n var padNode = new mathMLTree.MathNode(\"mtd\", []);\n padNode.setAttribute(\"width\", \"50%\");\n return padNode;\n};\n\ndefineFunctionBuilders({\n type: \"tag\",\n mathmlBuilder: function mathmlBuilder(group, options) {\n var table = new mathMLTree.MathNode(\"mtable\", [new mathMLTree.MathNode(\"mtr\", [tag_pad(), new mathMLTree.MathNode(\"mtd\", [buildExpressionRow(group.body, options)]), tag_pad(), new mathMLTree.MathNode(\"mtd\", [buildExpressionRow(group.tag, options)])])]);\n table.setAttribute(\"width\", \"100%\");\n return table; // TODO: Left-aligned tags.\n // Currently, the group and options passed here do not contain\n // enough info to set tag alignment. `leqno` is in Settings but it is\n // not passed to Options. On the HTML side, leqno is\n // set by a CSS class applied in buildTree.js. That would have worked\n // in MathML if browsers supported . Since they don't, we\n // need to rewrite the way this function is called.\n }\n});\n// CONCATENATED MODULE: ./src/functions/text.js\n\n\n\n // Non-mathy text, possibly in a font\n\nvar textFontFamilies = {\n \"\\\\text\": undefined,\n \"\\\\textrm\": \"textrm\",\n \"\\\\textsf\": \"textsf\",\n \"\\\\texttt\": \"texttt\",\n \"\\\\textnormal\": \"textrm\"\n};\nvar textFontWeights = {\n \"\\\\textbf\": \"textbf\",\n \"\\\\textmd\": \"textmd\"\n};\nvar textFontShapes = {\n \"\\\\textit\": \"textit\",\n \"\\\\textup\": \"textup\"\n};\n\nvar optionsWithFont = function optionsWithFont(group, options) {\n var font = group.font; // Checks if the argument is a font family or a font style.\n\n if (!font) {\n return options;\n } else if (textFontFamilies[font]) {\n return options.withTextFontFamily(textFontFamilies[font]);\n } else if (textFontWeights[font]) {\n return options.withTextFontWeight(textFontWeights[font]);\n } else {\n return options.withTextFontShape(textFontShapes[font]);\n }\n};\n\ndefineFunction({\n type: \"text\",\n names: [// Font families\n \"\\\\text\", \"\\\\textrm\", \"\\\\textsf\", \"\\\\texttt\", \"\\\\textnormal\", // Font weights\n \"\\\\textbf\", \"\\\\textmd\", // Font Shapes\n \"\\\\textit\", \"\\\\textup\"],\n props: {\n numArgs: 1,\n argTypes: [\"text\"],\n greediness: 2,\n allowedInText: true\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser,\n funcName = _ref.funcName;\n var body = args[0];\n return {\n type: \"text\",\n mode: parser.mode,\n body: defineFunction_ordargument(body),\n font: funcName\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n var newOptions = optionsWithFont(group, options);\n var inner = buildHTML_buildExpression(group.body, newOptions, true);\n return buildCommon.makeSpan([\"mord\", \"text\"], buildCommon.tryCombineChars(inner), newOptions);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var newOptions = optionsWithFont(group, options);\n return buildExpressionRow(group.body, newOptions);\n }\n});\n// CONCATENATED MODULE: ./src/functions/underline.js\n\n\n\n\n\ndefineFunction({\n type: \"underline\",\n names: [\"\\\\underline\"],\n props: {\n numArgs: 1,\n allowedInText: true\n },\n handler: function handler(_ref, args) {\n var parser = _ref.parser;\n return {\n type: \"underline\",\n mode: parser.mode,\n body: args[0]\n };\n },\n htmlBuilder: function htmlBuilder(group, options) {\n // Underlines are handled in the TeXbook pg 443, Rule 10.\n // Build the inner group.\n var innerGroup = buildHTML_buildGroup(group.body, options); // Create the line to go below the body\n\n var line = buildCommon.makeLineSpan(\"underline-line\", options); // Generate the vlist, with the appropriate kerns\n\n var defaultRuleThickness = options.fontMetrics().defaultRuleThickness;\n var vlist = buildCommon.makeVList({\n positionType: \"top\",\n positionData: innerGroup.height,\n children: [{\n type: \"kern\",\n size: defaultRuleThickness\n }, {\n type: \"elem\",\n elem: line\n }, {\n type: \"kern\",\n size: 3 * defaultRuleThickness\n }, {\n type: \"elem\",\n elem: innerGroup\n }]\n }, options);\n return buildCommon.makeSpan([\"mord\", \"underline\"], [vlist], options);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var operator = new mathMLTree.MathNode(\"mo\", [new mathMLTree.TextNode(\"\\u203E\")]);\n operator.setAttribute(\"stretchy\", \"true\");\n var node = new mathMLTree.MathNode(\"munder\", [buildMathML_buildGroup(group.body, options), operator]);\n node.setAttribute(\"accentunder\", \"true\");\n return node;\n }\n});\n// CONCATENATED MODULE: ./src/functions/verb.js\n\n\n\n\ndefineFunction({\n type: \"verb\",\n names: [\"\\\\verb\"],\n props: {\n numArgs: 0,\n allowedInText: true\n },\n handler: function handler(context, args, optArgs) {\n // \\verb and \\verb* are dealt with directly in Parser.js.\n // If we end up here, it's because of a failure to match the two delimiters\n // in the regex in Lexer.js. LaTeX raises the following error when \\verb is\n // terminated by end of line (or file).\n throw new src_ParseError(\"\\\\verb ended by end of line instead of matching delimiter\");\n },\n htmlBuilder: function htmlBuilder(group, options) {\n var text = makeVerb(group);\n var body = []; // \\verb enters text mode and therefore is sized like \\textstyle\n\n var newOptions = options.havingStyle(options.style.text());\n\n for (var i = 0; i < text.length; i++) {\n var c = text[i];\n\n if (c === '~') {\n c = '\\\\textasciitilde';\n }\n\n body.push(buildCommon.makeSymbol(c, \"Typewriter-Regular\", group.mode, newOptions, [\"mord\", \"texttt\"]));\n }\n\n return buildCommon.makeSpan([\"mord\", \"text\"].concat(newOptions.sizingClasses(options)), buildCommon.tryCombineChars(body), newOptions);\n },\n mathmlBuilder: function mathmlBuilder(group, options) {\n var text = new mathMLTree.TextNode(makeVerb(group));\n var node = new mathMLTree.MathNode(\"mtext\", [text]);\n node.setAttribute(\"mathvariant\", \"monospace\");\n return node;\n }\n});\n/**\n * Converts verb group into body string.\n *\n * \\verb* replaces each space with an open box \\u2423\n * \\verb replaces each space with a no-break space \\xA0\n */\n\nvar makeVerb = function makeVerb(group) {\n return group.body.replace(/ /g, group.star ? \"\\u2423\" : '\\xA0');\n};\n// CONCATENATED MODULE: ./src/functions.js\n/** Include this to ensure that all functions are defined. */\n\nvar functions = _functions;\n/* harmony default export */ var src_functions = (functions); // TODO(kevinb): have functions return an object and call defineFunction with\n// that object in this file instead of relying on side-effects.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// CONCATENATED MODULE: ./src/Lexer.js\n/**\n * The Lexer class handles tokenizing the input in various ways. Since our\n * parser expects us to be able to backtrack, the lexer allows lexing from any\n * given starting point.\n *\n * Its main exposed function is the `lex` function, which takes a position to\n * lex from and a type of token to lex. It defers to the appropriate `_innerLex`\n * function.\n *\n * The various `_innerLex` functions perform the actual lexing of different\n * kinds.\n */\n\n\n\n\n/* The following tokenRegex\n * - matches typical whitespace (but not NBSP etc.) using its first group\n * - does not match any control character \\x00-\\x1f except whitespace\n * - does not match a bare backslash\n * - matches any ASCII character except those just mentioned\n * - does not match the BMP private use area \\uE000-\\uF8FF\n * - does not match bare surrogate code units\n * - matches any BMP character except for those just described\n * - matches any valid Unicode surrogate pair\n * - matches a backslash followed by one or more letters\n * - matches a backslash followed by any BMP character, including newline\n * Just because the Lexer matches something doesn't mean it's valid input:\n * If there is no matching function or symbol definition, the Parser will\n * still reject the input.\n */\nvar spaceRegexString = \"[ \\r\\n\\t]\";\nvar controlWordRegexString = \"\\\\\\\\[a-zA-Z@]+\";\nvar controlSymbolRegexString = \"\\\\\\\\[^\\uD800-\\uDFFF]\";\nvar controlWordWhitespaceRegexString = \"\" + controlWordRegexString + spaceRegexString + \"*\";\nvar controlWordWhitespaceRegex = new RegExp(\"^(\" + controlWordRegexString + \")\" + spaceRegexString + \"*$\");\nvar combiningDiacriticalMarkString = \"[\\u0300-\\u036F]\";\nvar combiningDiacriticalMarksEndRegex = new RegExp(combiningDiacriticalMarkString + \"+$\");\nvar tokenRegexString = \"(\" + spaceRegexString + \"+)|\" + // whitespace\n\"([!-\\\\[\\\\]-\\u2027\\u202A-\\uD7FF\\uF900-\\uFFFF]\" + ( // single codepoint\ncombiningDiacriticalMarkString + \"*\") + // ...plus accents\n\"|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]\" + ( // surrogate pair\ncombiningDiacriticalMarkString + \"*\") + // ...plus accents\n\"|\\\\\\\\verb\\\\*([^]).*?\\\\3\" + // \\verb*\n\"|\\\\\\\\verb([^*a-zA-Z]).*?\\\\4\" + // \\verb unstarred\n\"|\\\\\\\\operatorname\\\\*\" + ( // \\operatorname*\n\"|\" + controlWordWhitespaceRegexString) + ( // \\macroName + spaces\n\"|\" + controlSymbolRegexString + \")\"); // \\\\, \\', etc.\n\n/** Main Lexer class */\n\nvar Lexer_Lexer =\n/*#__PURE__*/\nfunction () {\n // category codes, only supports comment characters (14) for now\n function Lexer(input, settings) {\n this.input = void 0;\n this.settings = void 0;\n this.tokenRegex = void 0;\n this.catcodes = void 0;\n // Separate accents from characters\n this.input = input;\n this.settings = settings;\n this.tokenRegex = new RegExp(tokenRegexString, 'g');\n this.catcodes = {\n \"%\": 14 // comment character\n\n };\n }\n\n var _proto = Lexer.prototype;\n\n _proto.setCatcode = function setCatcode(char, code) {\n this.catcodes[char] = code;\n }\n /**\n * This function lexes a single token.\n */\n ;\n\n _proto.lex = function lex() {\n var input = this.input;\n var pos = this.tokenRegex.lastIndex;\n\n if (pos === input.length) {\n return new Token_Token(\"EOF\", new SourceLocation(this, pos, pos));\n }\n\n var match = this.tokenRegex.exec(input);\n\n if (match === null || match.index !== pos) {\n throw new src_ParseError(\"Unexpected character: '\" + input[pos] + \"'\", new Token_Token(input[pos], new SourceLocation(this, pos, pos + 1)));\n }\n\n var text = match[2] || \" \";\n\n if (this.catcodes[text] === 14) {\n // comment character\n var nlIndex = input.indexOf('\\n', this.tokenRegex.lastIndex);\n\n if (nlIndex === -1) {\n this.tokenRegex.lastIndex = input.length; // EOF\n\n this.settings.reportNonstrict(\"commentAtEnd\", \"% comment has no terminating newline; LaTeX would \" + \"fail because of commenting the end of math mode (e.g. $)\");\n } else {\n this.tokenRegex.lastIndex = nlIndex + 1;\n }\n\n return this.lex();\n } // Trim any trailing whitespace from control word match\n\n\n var controlMatch = text.match(controlWordWhitespaceRegex);\n\n if (controlMatch) {\n text = controlMatch[1];\n }\n\n return new Token_Token(text, new SourceLocation(this, pos, this.tokenRegex.lastIndex));\n };\n\n return Lexer;\n}();\n\n\n// CONCATENATED MODULE: ./src/Namespace.js\n/**\n * A `Namespace` refers to a space of nameable things like macros or lengths,\n * which can be `set` either globally or local to a nested group, using an\n * undo stack similar to how TeX implements this functionality.\n * Performance-wise, `get` and local `set` take constant time, while global\n * `set` takes time proportional to the depth of group nesting.\n */\n\n\nvar Namespace_Namespace =\n/*#__PURE__*/\nfunction () {\n /**\n * Both arguments are optional. The first argument is an object of\n * built-in mappings which never change. The second argument is an object\n * of initial (global-level) mappings, which will constantly change\n * according to any global/top-level `set`s done.\n */\n function Namespace(builtins, globalMacros) {\n if (builtins === void 0) {\n builtins = {};\n }\n\n if (globalMacros === void 0) {\n globalMacros = {};\n }\n\n this.current = void 0;\n this.builtins = void 0;\n this.undefStack = void 0;\n this.current = globalMacros;\n this.builtins = builtins;\n this.undefStack = [];\n }\n /**\n * Start a new nested group, affecting future local `set`s.\n */\n\n\n var _proto = Namespace.prototype;\n\n _proto.beginGroup = function beginGroup() {\n this.undefStack.push({});\n }\n /**\n * End current nested group, restoring values before the group began.\n */\n ;\n\n _proto.endGroup = function endGroup() {\n if (this.undefStack.length === 0) {\n throw new src_ParseError(\"Unbalanced namespace destruction: attempt \" + \"to pop global namespace; please report this as a bug\");\n }\n\n var undefs = this.undefStack.pop();\n\n for (var undef in undefs) {\n if (undefs.hasOwnProperty(undef)) {\n if (undefs[undef] === undefined) {\n delete this.current[undef];\n } else {\n this.current[undef] = undefs[undef];\n }\n }\n }\n }\n /**\n * Detect whether `name` has a definition. Equivalent to\n * `get(name) != null`.\n */\n ;\n\n _proto.has = function has(name) {\n return this.current.hasOwnProperty(name) || this.builtins.hasOwnProperty(name);\n }\n /**\n * Get the current value of a name, or `undefined` if there is no value.\n *\n * Note: Do not use `if (namespace.get(...))` to detect whether a macro\n * is defined, as the definition may be the empty string which evaluates\n * to `false` in JavaScript. Use `if (namespace.get(...) != null)` or\n * `if (namespace.has(...))`.\n */\n ;\n\n _proto.get = function get(name) {\n if (this.current.hasOwnProperty(name)) {\n return this.current[name];\n } else {\n return this.builtins[name];\n }\n }\n /**\n * Set the current value of a name, and optionally set it globally too.\n * Local set() sets the current value and (when appropriate) adds an undo\n * operation to the undo stack. Global set() may change the undo\n * operation at every level, so takes time linear in their number.\n */\n ;\n\n _proto.set = function set(name, value, global) {\n if (global === void 0) {\n global = false;\n }\n\n if (global) {\n // Global set is equivalent to setting in all groups. Simulate this\n // by destroying any undos currently scheduled for this name,\n // and adding an undo with the *new* value (in case it later gets\n // locally reset within this environment).\n for (var i = 0; i < this.undefStack.length; i++) {\n delete this.undefStack[i][name];\n }\n\n if (this.undefStack.length > 0) {\n this.undefStack[this.undefStack.length - 1][name] = value;\n }\n } else {\n // Undo this set at end of this group (possibly to `undefined`),\n // unless an undo is already in place, in which case that older\n // value is the correct one.\n var top = this.undefStack[this.undefStack.length - 1];\n\n if (top && !top.hasOwnProperty(name)) {\n top[name] = this.current[name];\n }\n }\n\n this.current[name] = value;\n };\n\n return Namespace;\n}();\n\n\n// CONCATENATED MODULE: ./src/macros.js\n/**\n * Predefined macros for KaTeX.\n * This can be used to define some commands in terms of others.\n */\n\n\n\n\n\nvar builtinMacros = {};\n/* harmony default export */ var macros = (builtinMacros); // This function might one day accept an additional argument and do more things.\n\nfunction defineMacro(name, body) {\n builtinMacros[name] = body;\n} //////////////////////////////////////////////////////////////////////\n// macro tools\n// LaTeX's \\@firstoftwo{#1}{#2} expands to #1, skipping #2\n// TeX source: \\long\\def\\@firstoftwo#1#2{#1}\n\ndefineMacro(\"\\\\@firstoftwo\", function (context) {\n var args = context.consumeArgs(2);\n return {\n tokens: args[0],\n numArgs: 0\n };\n}); // LaTeX's \\@secondoftwo{#1}{#2} expands to #2, skipping #1\n// TeX source: \\long\\def\\@secondoftwo#1#2{#2}\n\ndefineMacro(\"\\\\@secondoftwo\", function (context) {\n var args = context.consumeArgs(2);\n return {\n tokens: args[1],\n numArgs: 0\n };\n}); // LaTeX's \\@ifnextchar{#1}{#2}{#3} looks ahead to the next (unexpanded)\n// symbol. If it matches #1, then the macro expands to #2; otherwise, #3.\n// Note, however, that it does not consume the next symbol in either case.\n\ndefineMacro(\"\\\\@ifnextchar\", function (context) {\n var args = context.consumeArgs(3); // symbol, if, else\n\n var nextToken = context.future();\n\n if (args[0].length === 1 && args[0][0].text === nextToken.text) {\n return {\n tokens: args[1],\n numArgs: 0\n };\n } else {\n return {\n tokens: args[2],\n numArgs: 0\n };\n }\n}); // LaTeX's \\@ifstar{#1}{#2} looks ahead to the next (unexpanded) symbol.\n// If it is `*`, then it consumes the symbol, and the macro expands to #1;\n// otherwise, the macro expands to #2 (without consuming the symbol).\n// TeX source: \\def\\@ifstar#1{\\@ifnextchar *{\\@firstoftwo{#1}}}\n\ndefineMacro(\"\\\\@ifstar\", \"\\\\@ifnextchar *{\\\\@firstoftwo{#1}}\"); // LaTeX's \\TextOrMath{#1}{#2} expands to #1 in text mode, #2 in math mode\n\ndefineMacro(\"\\\\TextOrMath\", function (context) {\n var args = context.consumeArgs(2);\n\n if (context.mode === 'text') {\n return {\n tokens: args[0],\n numArgs: 0\n };\n } else {\n return {\n tokens: args[1],\n numArgs: 0\n };\n }\n}); // Lookup table for parsing numbers in base 8 through 16\n\nvar digitToNumber = {\n \"0\": 0,\n \"1\": 1,\n \"2\": 2,\n \"3\": 3,\n \"4\": 4,\n \"5\": 5,\n \"6\": 6,\n \"7\": 7,\n \"8\": 8,\n \"9\": 9,\n \"a\": 10,\n \"A\": 10,\n \"b\": 11,\n \"B\": 11,\n \"c\": 12,\n \"C\": 12,\n \"d\": 13,\n \"D\": 13,\n \"e\": 14,\n \"E\": 14,\n \"f\": 15,\n \"F\": 15\n}; // TeX \\char makes a literal character (catcode 12) using the following forms:\n// (see The TeXBook, p. 43)\n// \\char123 -- decimal\n// \\char'123 -- octal\n// \\char\"123 -- hex\n// \\char`x -- character that can be written (i.e. isn't active)\n// \\char`\\x -- character that cannot be written (e.g. %)\n// These all refer to characters from the font, so we turn them into special\n// calls to a function \\@char dealt with in the Parser.\n\ndefineMacro(\"\\\\char\", function (context) {\n var token = context.popToken();\n var base;\n var number = '';\n\n if (token.text === \"'\") {\n base = 8;\n token = context.popToken();\n } else if (token.text === '\"') {\n base = 16;\n token = context.popToken();\n } else if (token.text === \"`\") {\n token = context.popToken();\n\n if (token.text[0] === \"\\\\\") {\n number = token.text.charCodeAt(1);\n } else if (token.text === \"EOF\") {\n throw new src_ParseError(\"\\\\char` missing argument\");\n } else {\n number = token.text.charCodeAt(0);\n }\n } else {\n base = 10;\n }\n\n if (base) {\n // Parse a number in the given base, starting with first `token`.\n number = digitToNumber[token.text];\n\n if (number == null || number >= base) {\n throw new src_ParseError(\"Invalid base-\" + base + \" digit \" + token.text);\n }\n\n var digit;\n\n while ((digit = digitToNumber[context.future().text]) != null && digit < base) {\n number *= base;\n number += digit;\n context.popToken();\n }\n }\n\n return \"\\\\@char{\" + number + \"}\";\n}); // Basic support for macro definitions:\n// \\def\\macro{expansion}\n// \\def\\macro#1{expansion}\n// \\def\\macro#1#2{expansion}\n// \\def\\macro#1#2#3#4#5#6#7#8#9{expansion}\n// Also the \\gdef and \\global\\def equivalents\n\nvar macros_def = function def(context, global) {\n var arg = context.consumeArgs(1)[0];\n\n if (arg.length !== 1) {\n throw new src_ParseError(\"\\\\gdef's first argument must be a macro name\");\n }\n\n var name = arg[0].text; // Count argument specifiers, and check they are in the order #1 #2 ...\n\n var numArgs = 0;\n arg = context.consumeArgs(1)[0];\n\n while (arg.length === 1 && arg[0].text === \"#\") {\n arg = context.consumeArgs(1)[0];\n\n if (arg.length !== 1) {\n throw new src_ParseError(\"Invalid argument number length \\\"\" + arg.length + \"\\\"\");\n }\n\n if (!/^[1-9]$/.test(arg[0].text)) {\n throw new src_ParseError(\"Invalid argument number \\\"\" + arg[0].text + \"\\\"\");\n }\n\n numArgs++;\n\n if (parseInt(arg[0].text) !== numArgs) {\n throw new src_ParseError(\"Argument number \\\"\" + arg[0].text + \"\\\" out of order\");\n }\n\n arg = context.consumeArgs(1)[0];\n } // Final arg is the expansion of the macro\n\n\n context.macros.set(name, {\n tokens: arg,\n numArgs: numArgs\n }, global);\n return '';\n};\n\ndefineMacro(\"\\\\gdef\", function (context) {\n return macros_def(context, true);\n});\ndefineMacro(\"\\\\def\", function (context) {\n return macros_def(context, false);\n});\ndefineMacro(\"\\\\global\", function (context) {\n var next = context.consumeArgs(1)[0];\n\n if (next.length !== 1) {\n throw new src_ParseError(\"Invalid command after \\\\global\");\n }\n\n var command = next[0].text; // TODO: Should expand command\n\n if (command === \"\\\\def\") {\n // \\global\\def is equivalent to \\gdef\n return macros_def(context, true);\n } else {\n throw new src_ParseError(\"Invalid command '\" + command + \"' after \\\\global\");\n }\n}); // \\newcommand{\\macro}[args]{definition}\n// \\renewcommand{\\macro}[args]{definition}\n// TODO: Optional arguments: \\newcommand{\\macro}[args][default]{definition}\n\nvar macros_newcommand = function newcommand(context, existsOK, nonexistsOK) {\n var arg = context.consumeArgs(1)[0];\n\n if (arg.length !== 1) {\n throw new src_ParseError(\"\\\\newcommand's first argument must be a macro name\");\n }\n\n var name = arg[0].text;\n var exists = context.isDefined(name);\n\n if (exists && !existsOK) {\n throw new src_ParseError(\"\\\\newcommand{\" + name + \"} attempting to redefine \" + (name + \"; use \\\\renewcommand\"));\n }\n\n if (!exists && !nonexistsOK) {\n throw new src_ParseError(\"\\\\renewcommand{\" + name + \"} when command \" + name + \" \" + \"does not yet exist; use \\\\newcommand\");\n }\n\n var numArgs = 0;\n arg = context.consumeArgs(1)[0];\n\n if (arg.length === 1 && arg[0].text === \"[\") {\n var argText = '';\n var token = context.expandNextToken();\n\n while (token.text !== \"]\" && token.text !== \"EOF\") {\n // TODO: Should properly expand arg, e.g., ignore {}s\n argText += token.text;\n token = context.expandNextToken();\n }\n\n if (!argText.match(/^\\s*[0-9]+\\s*$/)) {\n throw new src_ParseError(\"Invalid number of arguments: \" + argText);\n }\n\n numArgs = parseInt(argText);\n arg = context.consumeArgs(1)[0];\n } // Final arg is the expansion of the macro\n\n\n context.macros.set(name, {\n tokens: arg,\n numArgs: numArgs\n });\n return '';\n};\n\ndefineMacro(\"\\\\newcommand\", function (context) {\n return macros_newcommand(context, false, true);\n});\ndefineMacro(\"\\\\renewcommand\", function (context) {\n return macros_newcommand(context, true, false);\n});\ndefineMacro(\"\\\\providecommand\", function (context) {\n return macros_newcommand(context, true, true);\n}); //////////////////////////////////////////////////////////////////////\n// Grouping\n// \\let\\bgroup={ \\let\\egroup=}\n\ndefineMacro(\"\\\\bgroup\", \"{\");\ndefineMacro(\"\\\\egroup\", \"}\"); // Symbols from latex.ltx:\n// \\def\\lq{`}\n// \\def\\rq{'}\n// \\def \\aa {\\r a}\n// \\def \\AA {\\r A}\n\ndefineMacro(\"\\\\lq\", \"`\");\ndefineMacro(\"\\\\rq\", \"'\");\ndefineMacro(\"\\\\aa\", \"\\\\r a\");\ndefineMacro(\"\\\\AA\", \"\\\\r A\"); // Copyright (C) and registered (R) symbols. Use raw symbol in MathML.\n// \\DeclareTextCommandDefault{\\textcopyright}{\\textcircled{c}}\n// \\DeclareTextCommandDefault{\\textregistered}{\\textcircled{%\n// \\check@mathfonts\\fontsize\\sf@size\\z@\\math@fontsfalse\\selectfont R}}\n// \\DeclareRobustCommand{\\copyright}{%\n// \\ifmmode{\\nfss@text{\\textcopyright}}\\else\\textcopyright\\fi}\n\ndefineMacro(\"\\\\textcopyright\", \"\\\\html@mathml{\\\\textcircled{c}}{\\\\char`©}\");\ndefineMacro(\"\\\\copyright\", \"\\\\TextOrMath{\\\\textcopyright}{\\\\text{\\\\textcopyright}}\");\ndefineMacro(\"\\\\textregistered\", \"\\\\html@mathml{\\\\textcircled{\\\\scriptsize R}}{\\\\char`®}\"); // Characters omitted from Unicode range 1D400–1D7FF\n\ndefineMacro(\"\\u212C\", \"\\\\mathscr{B}\"); // script\n\ndefineMacro(\"\\u2130\", \"\\\\mathscr{E}\");\ndefineMacro(\"\\u2131\", \"\\\\mathscr{F}\");\ndefineMacro(\"\\u210B\", \"\\\\mathscr{H}\");\ndefineMacro(\"\\u2110\", \"\\\\mathscr{I}\");\ndefineMacro(\"\\u2112\", \"\\\\mathscr{L}\");\ndefineMacro(\"\\u2133\", \"\\\\mathscr{M}\");\ndefineMacro(\"\\u211B\", \"\\\\mathscr{R}\");\ndefineMacro(\"\\u212D\", \"\\\\mathfrak{C}\"); // Fraktur\n\ndefineMacro(\"\\u210C\", \"\\\\mathfrak{H}\");\ndefineMacro(\"\\u2128\", \"\\\\mathfrak{Z}\"); // Define \\Bbbk with a macro that works in both HTML and MathML.\n\ndefineMacro(\"\\\\Bbbk\", \"\\\\Bbb{k}\"); // Unicode middle dot\n// The KaTeX fonts do not contain U+00B7. Instead, \\cdotp displays\n// the dot at U+22C5 and gives it punct spacing.\n\ndefineMacro(\"\\xB7\", \"\\\\cdotp\"); // \\llap and \\rlap render their contents in text mode\n\ndefineMacro(\"\\\\llap\", \"\\\\mathllap{\\\\textrm{#1}}\");\ndefineMacro(\"\\\\rlap\", \"\\\\mathrlap{\\\\textrm{#1}}\");\ndefineMacro(\"\\\\clap\", \"\\\\mathclap{\\\\textrm{#1}}\"); // \\not is defined by base/fontmath.ltx via\n// \\DeclareMathSymbol{\\not}{\\mathrel}{symbols}{\"36}\n// It's thus treated like a \\mathrel, but defined by a symbol that has zero\n// width but extends to the right. We use \\rlap to get that spacing.\n// For MathML we write U+0338 here. buildMathML.js will then do the overlay.\n\ndefineMacro(\"\\\\not\", '\\\\html@mathml{\\\\mathrel{\\\\mathrlap\\\\@not}}{\\\\char\"338}'); // Negated symbols from base/fontmath.ltx:\n// \\def\\neq{\\not=} \\let\\ne=\\neq\n// \\DeclareRobustCommand\n// \\notin{\\mathrel{\\m@th\\mathpalette\\c@ncel\\in}}\n// \\def\\c@ncel#1#2{\\m@th\\ooalign{$\\hfil#1\\mkern1mu/\\hfil$\\crcr$#1#2$}}\n\ndefineMacro(\"\\\\neq\", \"\\\\html@mathml{\\\\mathrel{\\\\not=}}{\\\\mathrel{\\\\char`≠}}\");\ndefineMacro(\"\\\\ne\", \"\\\\neq\");\ndefineMacro(\"\\u2260\", \"\\\\neq\");\ndefineMacro(\"\\\\notin\", \"\\\\html@mathml{\\\\mathrel{{\\\\in}\\\\mathllap{/\\\\mskip1mu}}}\" + \"{\\\\mathrel{\\\\char`∉}}\");\ndefineMacro(\"\\u2209\", \"\\\\notin\"); // Unicode stacked relations\n\ndefineMacro(\"\\u2258\", \"\\\\html@mathml{\" + \"\\\\mathrel{=\\\\kern{-1em}\\\\raisebox{0.4em}{$\\\\scriptsize\\\\frown$}}\" + \"}{\\\\mathrel{\\\\char`\\u2258}}\");\ndefineMacro(\"\\u2259\", \"\\\\html@mathml{\\\\stackrel{\\\\tiny\\\\wedge}{=}}{\\\\mathrel{\\\\char`\\u2258}}\");\ndefineMacro(\"\\u225A\", \"\\\\html@mathml{\\\\stackrel{\\\\tiny\\\\vee}{=}}{\\\\mathrel{\\\\char`\\u225A}}\");\ndefineMacro(\"\\u225B\", \"\\\\html@mathml{\\\\stackrel{\\\\scriptsize\\\\star}{=}}\" + \"{\\\\mathrel{\\\\char`\\u225B}}\");\ndefineMacro(\"\\u225D\", \"\\\\html@mathml{\\\\stackrel{\\\\tiny\\\\mathrm{def}}{=}}\" + \"{\\\\mathrel{\\\\char`\\u225D}}\");\ndefineMacro(\"\\u225E\", \"\\\\html@mathml{\\\\stackrel{\\\\tiny\\\\mathrm{m}}{=}}\" + \"{\\\\mathrel{\\\\char`\\u225E}}\");\ndefineMacro(\"\\u225F\", \"\\\\html@mathml{\\\\stackrel{\\\\tiny?}{=}}{\\\\mathrel{\\\\char`\\u225F}}\"); // Misc Unicode\n\ndefineMacro(\"\\u27C2\", \"\\\\perp\");\ndefineMacro(\"\\u203C\", \"\\\\mathclose{!\\\\mkern-0.8mu!}\");\ndefineMacro(\"\\u220C\", \"\\\\notni\");\ndefineMacro(\"\\u231C\", \"\\\\ulcorner\");\ndefineMacro(\"\\u231D\", \"\\\\urcorner\");\ndefineMacro(\"\\u231E\", \"\\\\llcorner\");\ndefineMacro(\"\\u231F\", \"\\\\lrcorner\");\ndefineMacro(\"\\xA9\", \"\\\\copyright\");\ndefineMacro(\"\\xAE\", \"\\\\textregistered\");\ndefineMacro(\"\\uFE0F\", \"\\\\textregistered\"); //////////////////////////////////////////////////////////////////////\n// LaTeX_2ε\n// \\vdots{\\vbox{\\baselineskip4\\p@ \\lineskiplimit\\z@\n// \\kern6\\p@\\hbox{.}\\hbox{.}\\hbox{.}}}\n// We'll call \\varvdots, which gets a glyph from symbols.js.\n// The zero-width rule gets us an equivalent to the vertical 6pt kern.\n\ndefineMacro(\"\\\\vdots\", \"\\\\mathord{\\\\varvdots\\\\rule{0pt}{15pt}}\");\ndefineMacro(\"\\u22EE\", \"\\\\vdots\"); //////////////////////////////////////////////////////////////////////\n// amsmath.sty\n// http://mirrors.concertpass.com/tex-archive/macros/latex/required/amsmath/amsmath.pdf\n// Italic Greek capital letters. AMS defines these with \\DeclareMathSymbol,\n// but they are equivalent to \\mathit{\\Letter}.\n\ndefineMacro(\"\\\\varGamma\", \"\\\\mathit{\\\\Gamma}\");\ndefineMacro(\"\\\\varDelta\", \"\\\\mathit{\\\\Delta}\");\ndefineMacro(\"\\\\varTheta\", \"\\\\mathit{\\\\Theta}\");\ndefineMacro(\"\\\\varLambda\", \"\\\\mathit{\\\\Lambda}\");\ndefineMacro(\"\\\\varXi\", \"\\\\mathit{\\\\Xi}\");\ndefineMacro(\"\\\\varPi\", \"\\\\mathit{\\\\Pi}\");\ndefineMacro(\"\\\\varSigma\", \"\\\\mathit{\\\\Sigma}\");\ndefineMacro(\"\\\\varUpsilon\", \"\\\\mathit{\\\\Upsilon}\");\ndefineMacro(\"\\\\varPhi\", \"\\\\mathit{\\\\Phi}\");\ndefineMacro(\"\\\\varPsi\", \"\\\\mathit{\\\\Psi}\");\ndefineMacro(\"\\\\varOmega\", \"\\\\mathit{\\\\Omega}\"); //\\newcommand{\\substack}[1]{\\subarray{c}#1\\endsubarray}\n\ndefineMacro(\"\\\\substack\", \"\\\\begin{subarray}{c}#1\\\\end{subarray}\"); // \\renewcommand{\\colon}{\\nobreak\\mskip2mu\\mathpunct{}\\nonscript\n// \\mkern-\\thinmuskip{:}\\mskip6muplus1mu\\relax}\n\ndefineMacro(\"\\\\colon\", \"\\\\nobreak\\\\mskip2mu\\\\mathpunct{}\" + \"\\\\mathchoice{\\\\mkern-3mu}{\\\\mkern-3mu}{}{}{:}\\\\mskip6mu\"); // \\newcommand{\\boxed}[1]{\\fbox{\\m@th$\\displaystyle#1$}}\n\ndefineMacro(\"\\\\boxed\", \"\\\\fbox{$\\\\displaystyle{#1}$}\"); // \\def\\iff{\\DOTSB\\;\\Longleftrightarrow\\;}\n// \\def\\implies{\\DOTSB\\;\\Longrightarrow\\;}\n// \\def\\impliedby{\\DOTSB\\;\\Longleftarrow\\;}\n\ndefineMacro(\"\\\\iff\", \"\\\\DOTSB\\\\;\\\\Longleftrightarrow\\\\;\");\ndefineMacro(\"\\\\implies\", \"\\\\DOTSB\\\\;\\\\Longrightarrow\\\\;\");\ndefineMacro(\"\\\\impliedby\", \"\\\\DOTSB\\\\;\\\\Longleftarrow\\\\;\"); // AMSMath's automatic \\dots, based on \\mdots@@ macro.\n\nvar dotsByToken = {\n ',': '\\\\dotsc',\n '\\\\not': '\\\\dotsb',\n // \\keybin@ checks for the following:\n '+': '\\\\dotsb',\n '=': '\\\\dotsb',\n '<': '\\\\dotsb',\n '>': '\\\\dotsb',\n '-': '\\\\dotsb',\n '*': '\\\\dotsb',\n ':': '\\\\dotsb',\n // Symbols whose definition starts with \\DOTSB:\n '\\\\DOTSB': '\\\\dotsb',\n '\\\\coprod': '\\\\dotsb',\n '\\\\bigvee': '\\\\dotsb',\n '\\\\bigwedge': '\\\\dotsb',\n '\\\\biguplus': '\\\\dotsb',\n '\\\\bigcap': '\\\\dotsb',\n '\\\\bigcup': '\\\\dotsb',\n '\\\\prod': '\\\\dotsb',\n '\\\\sum': '\\\\dotsb',\n '\\\\bigotimes': '\\\\dotsb',\n '\\\\bigoplus': '\\\\dotsb',\n '\\\\bigodot': '\\\\dotsb',\n '\\\\bigsqcup': '\\\\dotsb',\n '\\\\And': '\\\\dotsb',\n '\\\\longrightarrow': '\\\\dotsb',\n '\\\\Longrightarrow': '\\\\dotsb',\n '\\\\longleftarrow': '\\\\dotsb',\n '\\\\Longleftarrow': '\\\\dotsb',\n '\\\\longleftrightarrow': '\\\\dotsb',\n '\\\\Longleftrightarrow': '\\\\dotsb',\n '\\\\mapsto': '\\\\dotsb',\n '\\\\longmapsto': '\\\\dotsb',\n '\\\\hookrightarrow': '\\\\dotsb',\n '\\\\doteq': '\\\\dotsb',\n // Symbols whose definition starts with \\mathbin:\n '\\\\mathbin': '\\\\dotsb',\n // Symbols whose definition starts with \\mathrel:\n '\\\\mathrel': '\\\\dotsb',\n '\\\\relbar': '\\\\dotsb',\n '\\\\Relbar': '\\\\dotsb',\n '\\\\xrightarrow': '\\\\dotsb',\n '\\\\xleftarrow': '\\\\dotsb',\n // Symbols whose definition starts with \\DOTSI:\n '\\\\DOTSI': '\\\\dotsi',\n '\\\\int': '\\\\dotsi',\n '\\\\oint': '\\\\dotsi',\n '\\\\iint': '\\\\dotsi',\n '\\\\iiint': '\\\\dotsi',\n '\\\\iiiint': '\\\\dotsi',\n '\\\\idotsint': '\\\\dotsi',\n // Symbols whose definition starts with \\DOTSX:\n '\\\\DOTSX': '\\\\dotsx'\n};\ndefineMacro(\"\\\\dots\", function (context) {\n // TODO: If used in text mode, should expand to \\textellipsis.\n // However, in KaTeX, \\textellipsis and \\ldots behave the same\n // (in text mode), and it's unlikely we'd see any of the math commands\n // that affect the behavior of \\dots when in text mode. So fine for now\n // (until we support \\ifmmode ... \\else ... \\fi).\n var thedots = '\\\\dotso';\n var next = context.expandAfterFuture().text;\n\n if (next in dotsByToken) {\n thedots = dotsByToken[next];\n } else if (next.substr(0, 4) === '\\\\not') {\n thedots = '\\\\dotsb';\n } else if (next in src_symbols.math) {\n if (utils.contains(['bin', 'rel'], src_symbols.math[next].group)) {\n thedots = '\\\\dotsb';\n }\n }\n\n return thedots;\n});\nvar spaceAfterDots = {\n // \\rightdelim@ checks for the following:\n ')': true,\n ']': true,\n '\\\\rbrack': true,\n '\\\\}': true,\n '\\\\rbrace': true,\n '\\\\rangle': true,\n '\\\\rceil': true,\n '\\\\rfloor': true,\n '\\\\rgroup': true,\n '\\\\rmoustache': true,\n '\\\\right': true,\n '\\\\bigr': true,\n '\\\\biggr': true,\n '\\\\Bigr': true,\n '\\\\Biggr': true,\n // \\extra@ also tests for the following:\n '$': true,\n // \\extrap@ checks for the following:\n ';': true,\n '.': true,\n ',': true\n};\ndefineMacro(\"\\\\dotso\", function (context) {\n var next = context.future().text;\n\n if (next in spaceAfterDots) {\n return \"\\\\ldots\\\\,\";\n } else {\n return \"\\\\ldots\";\n }\n});\ndefineMacro(\"\\\\dotsc\", function (context) {\n var next = context.future().text; // \\dotsc uses \\extra@ but not \\extrap@, instead specially checking for\n // ';' and '.', but doesn't check for ','.\n\n if (next in spaceAfterDots && next !== ',') {\n return \"\\\\ldots\\\\,\";\n } else {\n return \"\\\\ldots\";\n }\n});\ndefineMacro(\"\\\\cdots\", function (context) {\n var next = context.future().text;\n\n if (next in spaceAfterDots) {\n return \"\\\\@cdots\\\\,\";\n } else {\n return \"\\\\@cdots\";\n }\n});\ndefineMacro(\"\\\\dotsb\", \"\\\\cdots\");\ndefineMacro(\"\\\\dotsm\", \"\\\\cdots\");\ndefineMacro(\"\\\\dotsi\", \"\\\\!\\\\cdots\"); // amsmath doesn't actually define \\dotsx, but \\dots followed by a macro\n// starting with \\DOTSX implies \\dotso, and then \\extra@ detects this case\n// and forces the added `\\,`.\n\ndefineMacro(\"\\\\dotsx\", \"\\\\ldots\\\\,\"); // \\let\\DOTSI\\relax\n// \\let\\DOTSB\\relax\n// \\let\\DOTSX\\relax\n\ndefineMacro(\"\\\\DOTSI\", \"\\\\relax\");\ndefineMacro(\"\\\\DOTSB\", \"\\\\relax\");\ndefineMacro(\"\\\\DOTSX\", \"\\\\relax\"); // Spacing, based on amsmath.sty's override of LaTeX defaults\n// \\DeclareRobustCommand{\\tmspace}[3]{%\n// \\ifmmode\\mskip#1#2\\else\\kern#1#3\\fi\\relax}\n\ndefineMacro(\"\\\\tmspace\", \"\\\\TextOrMath{\\\\kern#1#3}{\\\\mskip#1#2}\\\\relax\"); // \\renewcommand{\\,}{\\tmspace+\\thinmuskip{.1667em}}\n// TODO: math mode should use \\thinmuskip\n\ndefineMacro(\"\\\\,\", \"\\\\tmspace+{3mu}{.1667em}\"); // \\let\\thinspace\\,\n\ndefineMacro(\"\\\\thinspace\", \"\\\\,\"); // \\def\\>{\\mskip\\medmuskip}\n// \\renewcommand{\\:}{\\tmspace+\\medmuskip{.2222em}}\n// TODO: \\> and math mode of \\: should use \\medmuskip = 4mu plus 2mu minus 4mu\n\ndefineMacro(\"\\\\>\", \"\\\\mskip{4mu}\");\ndefineMacro(\"\\\\:\", \"\\\\tmspace+{4mu}{.2222em}\"); // \\let\\medspace\\:\n\ndefineMacro(\"\\\\medspace\", \"\\\\:\"); // \\renewcommand{\\;}{\\tmspace+\\thickmuskip{.2777em}}\n// TODO: math mode should use \\thickmuskip = 5mu plus 5mu\n\ndefineMacro(\"\\\\;\", \"\\\\tmspace+{5mu}{.2777em}\"); // \\let\\thickspace\\;\n\ndefineMacro(\"\\\\thickspace\", \"\\\\;\"); // \\renewcommand{\\!}{\\tmspace-\\thinmuskip{.1667em}}\n// TODO: math mode should use \\thinmuskip\n\ndefineMacro(\"\\\\!\", \"\\\\tmspace-{3mu}{.1667em}\"); // \\let\\negthinspace\\!\n\ndefineMacro(\"\\\\negthinspace\", \"\\\\!\"); // \\newcommand{\\negmedspace}{\\tmspace-\\medmuskip{.2222em}}\n// TODO: math mode should use \\medmuskip\n\ndefineMacro(\"\\\\negmedspace\", \"\\\\tmspace-{4mu}{.2222em}\"); // \\newcommand{\\negthickspace}{\\tmspace-\\thickmuskip{.2777em}}\n// TODO: math mode should use \\thickmuskip\n\ndefineMacro(\"\\\\negthickspace\", \"\\\\tmspace-{5mu}{.277em}\"); // \\def\\enspace{\\kern.5em }\n\ndefineMacro(\"\\\\enspace\", \"\\\\kern.5em \"); // \\def\\enskip{\\hskip.5em\\relax}\n\ndefineMacro(\"\\\\enskip\", \"\\\\hskip.5em\\\\relax\"); // \\def\\quad{\\hskip1em\\relax}\n\ndefineMacro(\"\\\\quad\", \"\\\\hskip1em\\\\relax\"); // \\def\\qquad{\\hskip2em\\relax}\n\ndefineMacro(\"\\\\qquad\", \"\\\\hskip2em\\\\relax\"); // \\tag@in@display form of \\tag\n\ndefineMacro(\"\\\\tag\", \"\\\\@ifstar\\\\tag@literal\\\\tag@paren\");\ndefineMacro(\"\\\\tag@paren\", \"\\\\tag@literal{({#1})}\");\ndefineMacro(\"\\\\tag@literal\", function (context) {\n if (context.macros.get(\"\\\\df@tag\")) {\n throw new src_ParseError(\"Multiple \\\\tag\");\n }\n\n return \"\\\\gdef\\\\df@tag{\\\\text{#1}}\";\n}); // \\renewcommand{\\bmod}{\\nonscript\\mskip-\\medmuskip\\mkern5mu\\mathbin\n// {\\operator@font mod}\\penalty900\n// \\mkern5mu\\nonscript\\mskip-\\medmuskip}\n// \\newcommand{\\pod}[1]{\\allowbreak\n// \\if@display\\mkern18mu\\else\\mkern8mu\\fi(#1)}\n// \\renewcommand{\\pmod}[1]{\\pod{{\\operator@font mod}\\mkern6mu#1}}\n// \\newcommand{\\mod}[1]{\\allowbreak\\if@display\\mkern18mu\n// \\else\\mkern12mu\\fi{\\operator@font mod}\\,\\,#1}\n// TODO: math mode should use \\medmuskip = 4mu plus 2mu minus 4mu\n\ndefineMacro(\"\\\\bmod\", \"\\\\mathchoice{\\\\mskip1mu}{\\\\mskip1mu}{\\\\mskip5mu}{\\\\mskip5mu}\" + \"\\\\mathbin{\\\\rm mod}\" + \"\\\\mathchoice{\\\\mskip1mu}{\\\\mskip1mu}{\\\\mskip5mu}{\\\\mskip5mu}\");\ndefineMacro(\"\\\\pod\", \"\\\\allowbreak\" + \"\\\\mathchoice{\\\\mkern18mu}{\\\\mkern8mu}{\\\\mkern8mu}{\\\\mkern8mu}(#1)\");\ndefineMacro(\"\\\\pmod\", \"\\\\pod{{\\\\rm mod}\\\\mkern6mu#1}\");\ndefineMacro(\"\\\\mod\", \"\\\\allowbreak\" + \"\\\\mathchoice{\\\\mkern18mu}{\\\\mkern12mu}{\\\\mkern12mu}{\\\\mkern12mu}\" + \"{\\\\rm mod}\\\\,\\\\,#1\"); // \\pmb -- A simulation of bold.\n// The version in ambsy.sty works by typesetting three copies of the argument\n// with small offsets. We use two copies. We omit the vertical offset because\n// of rendering problems that makeVList encounters in Safari.\n\ndefineMacro(\"\\\\pmb\", \"\\\\html@mathml{\" + \"\\\\@binrel{#1}{\\\\mathrlap{#1}\\\\kern0.5px#1}}\" + \"{\\\\mathbf{#1}}\"); //////////////////////////////////////////////////////////////////////\n// LaTeX source2e\n// \\\\ defaults to \\newline, but changes to \\cr within array environment\n\ndefineMacro(\"\\\\\\\\\", \"\\\\newline\"); // \\def\\TeX{T\\kern-.1667em\\lower.5ex\\hbox{E}\\kern-.125emX\\@}\n// TODO: Doesn't normally work in math mode because \\@ fails. KaTeX doesn't\n// support \\@ yet, so that's omitted, and we add \\text so that the result\n// doesn't look funny in math mode.\n\ndefineMacro(\"\\\\TeX\", \"\\\\textrm{\\\\html@mathml{\" + \"T\\\\kern-.1667em\\\\raisebox{-.5ex}{E}\\\\kern-.125emX\" + \"}{TeX}}\"); // \\DeclareRobustCommand{\\LaTeX}{L\\kern-.36em%\n// {\\sbox\\z@ T%\n// \\vbox to\\ht\\z@{\\hbox{\\check@mathfonts\n// \\fontsize\\sf@size\\z@\n// \\math@fontsfalse\\selectfont\n// A}%\n// \\vss}%\n// }%\n// \\kern-.15em%\n// \\TeX}\n// This code aligns the top of the A with the T (from the perspective of TeX's\n// boxes, though visually the A appears to extend above slightly).\n// We compute the corresponding \\raisebox when A is rendered in \\normalsize\n// \\scriptstyle, which has a scale factor of 0.7 (see Options.js).\n\nvar latexRaiseA = fontMetricsData['Main-Regular'][\"T\".charCodeAt(0)][1] - 0.7 * fontMetricsData['Main-Regular'][\"A\".charCodeAt(0)][1] + \"em\";\ndefineMacro(\"\\\\LaTeX\", \"\\\\textrm{\\\\html@mathml{\" + (\"L\\\\kern-.36em\\\\raisebox{\" + latexRaiseA + \"}{\\\\scriptstyle A}\") + \"\\\\kern-.15em\\\\TeX}{LaTeX}}\"); // New KaTeX logo based on tweaking LaTeX logo\n\ndefineMacro(\"\\\\KaTeX\", \"\\\\textrm{\\\\html@mathml{\" + (\"K\\\\kern-.17em\\\\raisebox{\" + latexRaiseA + \"}{\\\\scriptstyle A}\") + \"\\\\kern-.15em\\\\TeX}{KaTeX}}\"); // \\DeclareRobustCommand\\hspace{\\@ifstar\\@hspacer\\@hspace}\n// \\def\\@hspace#1{\\hskip #1\\relax}\n// \\def\\@hspacer#1{\\vrule \\@width\\z@\\nobreak\n// \\hskip #1\\hskip \\z@skip}\n\ndefineMacro(\"\\\\hspace\", \"\\\\@ifstar\\\\@hspacer\\\\@hspace\");\ndefineMacro(\"\\\\@hspace\", \"\\\\hskip #1\\\\relax\");\ndefineMacro(\"\\\\@hspacer\", \"\\\\rule{0pt}{0pt}\\\\hskip #1\\\\relax\"); //////////////////////////////////////////////////////////////////////\n// mathtools.sty\n//\\providecommand\\ordinarycolon{:}\n\ndefineMacro(\"\\\\ordinarycolon\", \":\"); //\\def\\vcentcolon{\\mathrel{\\mathop\\ordinarycolon}}\n//TODO(edemaine): Not yet centered. Fix via \\raisebox or #726\n\ndefineMacro(\"\\\\vcentcolon\", \"\\\\mathrel{\\\\mathop\\\\ordinarycolon}\"); // \\providecommand*\\dblcolon{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}\n\ndefineMacro(\"\\\\dblcolon\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\vcentcolon\\\\mathrel{\\\\mkern-.9mu}\\\\vcentcolon}}\" + \"{\\\\mathop{\\\\char\\\"2237}}\"); // \\providecommand*\\coloneqq{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}\n\ndefineMacro(\"\\\\coloneqq\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\vcentcolon\\\\mathrel{\\\\mkern-1.2mu}=}}\" + \"{\\\\mathop{\\\\char\\\"2254}}\"); // ≔\n// \\providecommand*\\Coloneqq{\\dblcolon\\mathrel{\\mkern-1.2mu}=}\n\ndefineMacro(\"\\\\Coloneqq\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\dblcolon\\\\mathrel{\\\\mkern-1.2mu}=}}\" + \"{\\\\mathop{\\\\char\\\"2237\\\\char\\\"3d}}\"); // \\providecommand*\\coloneq{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}\n\ndefineMacro(\"\\\\coloneq\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\vcentcolon\\\\mathrel{\\\\mkern-1.2mu}\\\\mathrel{-}}}\" + \"{\\\\mathop{\\\\char\\\"3a\\\\char\\\"2212}}\"); // \\providecommand*\\Coloneq{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}\n\ndefineMacro(\"\\\\Coloneq\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\dblcolon\\\\mathrel{\\\\mkern-1.2mu}\\\\mathrel{-}}}\" + \"{\\\\mathop{\\\\char\\\"2237\\\\char\\\"2212}}\"); // \\providecommand*\\eqqcolon{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}\n\ndefineMacro(\"\\\\eqqcolon\", \"\\\\html@mathml{\" + \"\\\\mathrel{=\\\\mathrel{\\\\mkern-1.2mu}\\\\vcentcolon}}\" + \"{\\\\mathop{\\\\char\\\"2255}}\"); // ≕\n// \\providecommand*\\Eqqcolon{=\\mathrel{\\mkern-1.2mu}\\dblcolon}\n\ndefineMacro(\"\\\\Eqqcolon\", \"\\\\html@mathml{\" + \"\\\\mathrel{=\\\\mathrel{\\\\mkern-1.2mu}\\\\dblcolon}}\" + \"{\\\\mathop{\\\\char\\\"3d\\\\char\\\"2237}}\"); // \\providecommand*\\eqcolon{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}\n\ndefineMacro(\"\\\\eqcolon\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\mathrel{-}\\\\mathrel{\\\\mkern-1.2mu}\\\\vcentcolon}}\" + \"{\\\\mathop{\\\\char\\\"2239}}\"); // \\providecommand*\\Eqcolon{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}\n\ndefineMacro(\"\\\\Eqcolon\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\mathrel{-}\\\\mathrel{\\\\mkern-1.2mu}\\\\dblcolon}}\" + \"{\\\\mathop{\\\\char\\\"2212\\\\char\\\"2237}}\"); // \\providecommand*\\colonapprox{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}\n\ndefineMacro(\"\\\\colonapprox\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\vcentcolon\\\\mathrel{\\\\mkern-1.2mu}\\\\approx}}\" + \"{\\\\mathop{\\\\char\\\"3a\\\\char\\\"2248}}\"); // \\providecommand*\\Colonapprox{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}\n\ndefineMacro(\"\\\\Colonapprox\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\dblcolon\\\\mathrel{\\\\mkern-1.2mu}\\\\approx}}\" + \"{\\\\mathop{\\\\char\\\"2237\\\\char\\\"2248}}\"); // \\providecommand*\\colonsim{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}\n\ndefineMacro(\"\\\\colonsim\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\vcentcolon\\\\mathrel{\\\\mkern-1.2mu}\\\\sim}}\" + \"{\\\\mathop{\\\\char\\\"3a\\\\char\\\"223c}}\"); // \\providecommand*\\Colonsim{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}\n\ndefineMacro(\"\\\\Colonsim\", \"\\\\html@mathml{\" + \"\\\\mathrel{\\\\dblcolon\\\\mathrel{\\\\mkern-1.2mu}\\\\sim}}\" + \"{\\\\mathop{\\\\char\\\"2237\\\\char\\\"223c}}\"); // Some Unicode characters are implemented with macros to mathtools functions.\n\ndefineMacro(\"\\u2237\", \"\\\\dblcolon\"); // ::\n\ndefineMacro(\"\\u2239\", \"\\\\eqcolon\"); // -:\n\ndefineMacro(\"\\u2254\", \"\\\\coloneqq\"); // :=\n\ndefineMacro(\"\\u2255\", \"\\\\eqqcolon\"); // =:\n\ndefineMacro(\"\\u2A74\", \"\\\\Coloneqq\"); // ::=\n//////////////////////////////////////////////////////////////////////\n// colonequals.sty\n// Alternate names for mathtools's macros:\n\ndefineMacro(\"\\\\ratio\", \"\\\\vcentcolon\");\ndefineMacro(\"\\\\coloncolon\", \"\\\\dblcolon\");\ndefineMacro(\"\\\\colonequals\", \"\\\\coloneqq\");\ndefineMacro(\"\\\\coloncolonequals\", \"\\\\Coloneqq\");\ndefineMacro(\"\\\\equalscolon\", \"\\\\eqqcolon\");\ndefineMacro(\"\\\\equalscoloncolon\", \"\\\\Eqqcolon\");\ndefineMacro(\"\\\\colonminus\", \"\\\\coloneq\");\ndefineMacro(\"\\\\coloncolonminus\", \"\\\\Coloneq\");\ndefineMacro(\"\\\\minuscolon\", \"\\\\eqcolon\");\ndefineMacro(\"\\\\minuscoloncolon\", \"\\\\Eqcolon\"); // \\colonapprox name is same in mathtools and colonequals.\n\ndefineMacro(\"\\\\coloncolonapprox\", \"\\\\Colonapprox\"); // \\colonsim name is same in mathtools and colonequals.\n\ndefineMacro(\"\\\\coloncolonsim\", \"\\\\Colonsim\"); // Additional macros, implemented by analogy with mathtools definitions:\n\ndefineMacro(\"\\\\simcolon\", \"\\\\mathrel{\\\\sim\\\\mathrel{\\\\mkern-1.2mu}\\\\vcentcolon}\");\ndefineMacro(\"\\\\simcoloncolon\", \"\\\\mathrel{\\\\sim\\\\mathrel{\\\\mkern-1.2mu}\\\\dblcolon}\");\ndefineMacro(\"\\\\approxcolon\", \"\\\\mathrel{\\\\approx\\\\mathrel{\\\\mkern-1.2mu}\\\\vcentcolon}\");\ndefineMacro(\"\\\\approxcoloncolon\", \"\\\\mathrel{\\\\approx\\\\mathrel{\\\\mkern-1.2mu}\\\\dblcolon}\"); // Present in newtxmath, pxfonts and txfonts\n\ndefineMacro(\"\\\\notni\", \"\\\\html@mathml{\\\\not\\\\ni}{\\\\mathrel{\\\\char`\\u220C}}\");\ndefineMacro(\"\\\\limsup\", \"\\\\DOTSB\\\\operatorname*{lim\\\\,sup}\");\ndefineMacro(\"\\\\liminf\", \"\\\\DOTSB\\\\operatorname*{lim\\\\,inf}\"); //////////////////////////////////////////////////////////////////////\n// MathML alternates for KaTeX glyphs in the Unicode private area\n\ndefineMacro(\"\\\\gvertneqq\", \"\\\\html@mathml{\\\\@gvertneqq}{\\u2269}\");\ndefineMacro(\"\\\\lvertneqq\", \"\\\\html@mathml{\\\\@lvertneqq}{\\u2268}\");\ndefineMacro(\"\\\\ngeqq\", \"\\\\html@mathml{\\\\@ngeqq}{\\u2271}\");\ndefineMacro(\"\\\\ngeqslant\", \"\\\\html@mathml{\\\\@ngeqslant}{\\u2271}\");\ndefineMacro(\"\\\\nleqq\", \"\\\\html@mathml{\\\\@nleqq}{\\u2270}\");\ndefineMacro(\"\\\\nleqslant\", \"\\\\html@mathml{\\\\@nleqslant}{\\u2270}\");\ndefineMacro(\"\\\\nshortmid\", \"\\\\html@mathml{\\\\@nshortmid}{∤}\");\ndefineMacro(\"\\\\nshortparallel\", \"\\\\html@mathml{\\\\@nshortparallel}{∦}\");\ndefineMacro(\"\\\\nsubseteqq\", \"\\\\html@mathml{\\\\@nsubseteqq}{\\u2288}\");\ndefineMacro(\"\\\\nsupseteqq\", \"\\\\html@mathml{\\\\@nsupseteqq}{\\u2289}\");\ndefineMacro(\"\\\\varsubsetneq\", \"\\\\html@mathml{\\\\@varsubsetneq}{⊊}\");\ndefineMacro(\"\\\\varsubsetneqq\", \"\\\\html@mathml{\\\\@varsubsetneqq}{⫋}\");\ndefineMacro(\"\\\\varsupsetneq\", \"\\\\html@mathml{\\\\@varsupsetneq}{⊋}\");\ndefineMacro(\"\\\\varsupsetneqq\", \"\\\\html@mathml{\\\\@varsupsetneqq}{⫌}\"); //////////////////////////////////////////////////////////////////////\n// stmaryrd and semantic\n// The stmaryrd and semantic packages render the next four items by calling a\n// glyph. Those glyphs do not exist in the KaTeX fonts. Hence the macros.\n\ndefineMacro(\"\\\\llbracket\", \"\\\\html@mathml{\" + \"\\\\mathopen{[\\\\mkern-3.2mu[}}\" + \"{\\\\mathopen{\\\\char`\\u27E6}}\");\ndefineMacro(\"\\\\rrbracket\", \"\\\\html@mathml{\" + \"\\\\mathclose{]\\\\mkern-3.2mu]}}\" + \"{\\\\mathclose{\\\\char`\\u27E7}}\");\ndefineMacro(\"\\u27E6\", \"\\\\llbracket\"); // blackboard bold [\n\ndefineMacro(\"\\u27E7\", \"\\\\rrbracket\"); // blackboard bold ]\n\ndefineMacro(\"\\\\lBrace\", \"\\\\html@mathml{\" + \"\\\\mathopen{\\\\{\\\\mkern-3.2mu[}}\" + \"{\\\\mathopen{\\\\char`\\u2983}}\");\ndefineMacro(\"\\\\rBrace\", \"\\\\html@mathml{\" + \"\\\\mathclose{]\\\\mkern-3.2mu\\\\}}}\" + \"{\\\\mathclose{\\\\char`\\u2984}}\");\ndefineMacro(\"\\u2983\", \"\\\\lBrace\"); // blackboard bold {\n\ndefineMacro(\"\\u2984\", \"\\\\rBrace\"); // blackboard bold }\n// TODO: Create variable sized versions of the last two items. I believe that\n// will require new font glyphs.\n//////////////////////////////////////////////////////////////////////\n// texvc.sty\n// The texvc package contains macros available in mediawiki pages.\n// We omit the functions deprecated at\n// https://en.wikipedia.org/wiki/Help:Displaying_a_formula#Deprecated_syntax\n// We also omit texvc's \\O, which conflicts with \\text{\\O}\n\ndefineMacro(\"\\\\darr\", \"\\\\downarrow\");\ndefineMacro(\"\\\\dArr\", \"\\\\Downarrow\");\ndefineMacro(\"\\\\Darr\", \"\\\\Downarrow\");\ndefineMacro(\"\\\\lang\", \"\\\\langle\");\ndefineMacro(\"\\\\rang\", \"\\\\rangle\");\ndefineMacro(\"\\\\uarr\", \"\\\\uparrow\");\ndefineMacro(\"\\\\uArr\", \"\\\\Uparrow\");\ndefineMacro(\"\\\\Uarr\", \"\\\\Uparrow\");\ndefineMacro(\"\\\\N\", \"\\\\mathbb{N}\");\ndefineMacro(\"\\\\R\", \"\\\\mathbb{R}\");\ndefineMacro(\"\\\\Z\", \"\\\\mathbb{Z}\");\ndefineMacro(\"\\\\alef\", \"\\\\aleph\");\ndefineMacro(\"\\\\alefsym\", \"\\\\aleph\");\ndefineMacro(\"\\\\Alpha\", \"\\\\mathrm{A}\");\ndefineMacro(\"\\\\Beta\", \"\\\\mathrm{B}\");\ndefineMacro(\"\\\\bull\", \"\\\\bullet\");\ndefineMacro(\"\\\\Chi\", \"\\\\mathrm{X}\");\ndefineMacro(\"\\\\clubs\", \"\\\\clubsuit\");\ndefineMacro(\"\\\\cnums\", \"\\\\mathbb{C}\");\ndefineMacro(\"\\\\Complex\", \"\\\\mathbb{C}\");\ndefineMacro(\"\\\\Dagger\", \"\\\\ddagger\");\ndefineMacro(\"\\\\diamonds\", \"\\\\diamondsuit\");\ndefineMacro(\"\\\\empty\", \"\\\\emptyset\");\ndefineMacro(\"\\\\Epsilon\", \"\\\\mathrm{E}\");\ndefineMacro(\"\\\\Eta\", \"\\\\mathrm{H}\");\ndefineMacro(\"\\\\exist\", \"\\\\exists\");\ndefineMacro(\"\\\\harr\", \"\\\\leftrightarrow\");\ndefineMacro(\"\\\\hArr\", \"\\\\Leftrightarrow\");\ndefineMacro(\"\\\\Harr\", \"\\\\Leftrightarrow\");\ndefineMacro(\"\\\\hearts\", \"\\\\heartsuit\");\ndefineMacro(\"\\\\image\", \"\\\\Im\");\ndefineMacro(\"\\\\infin\", \"\\\\infty\");\ndefineMacro(\"\\\\Iota\", \"\\\\mathrm{I}\");\ndefineMacro(\"\\\\isin\", \"\\\\in\");\ndefineMacro(\"\\\\Kappa\", \"\\\\mathrm{K}\");\ndefineMacro(\"\\\\larr\", \"\\\\leftarrow\");\ndefineMacro(\"\\\\lArr\", \"\\\\Leftarrow\");\ndefineMacro(\"\\\\Larr\", \"\\\\Leftarrow\");\ndefineMacro(\"\\\\lrarr\", \"\\\\leftrightarrow\");\ndefineMacro(\"\\\\lrArr\", \"\\\\Leftrightarrow\");\ndefineMacro(\"\\\\Lrarr\", \"\\\\Leftrightarrow\");\ndefineMacro(\"\\\\Mu\", \"\\\\mathrm{M}\");\ndefineMacro(\"\\\\natnums\", \"\\\\mathbb{N}\");\ndefineMacro(\"\\\\Nu\", \"\\\\mathrm{N}\");\ndefineMacro(\"\\\\Omicron\", \"\\\\mathrm{O}\");\ndefineMacro(\"\\\\plusmn\", \"\\\\pm\");\ndefineMacro(\"\\\\rarr\", \"\\\\rightarrow\");\ndefineMacro(\"\\\\rArr\", \"\\\\Rightarrow\");\ndefineMacro(\"\\\\Rarr\", \"\\\\Rightarrow\");\ndefineMacro(\"\\\\real\", \"\\\\Re\");\ndefineMacro(\"\\\\reals\", \"\\\\mathbb{R}\");\ndefineMacro(\"\\\\Reals\", \"\\\\mathbb{R}\");\ndefineMacro(\"\\\\Rho\", \"\\\\mathrm{P}\");\ndefineMacro(\"\\\\sdot\", \"\\\\cdot\");\ndefineMacro(\"\\\\sect\", \"\\\\S\");\ndefineMacro(\"\\\\spades\", \"\\\\spadesuit\");\ndefineMacro(\"\\\\sub\", \"\\\\subset\");\ndefineMacro(\"\\\\sube\", \"\\\\subseteq\");\ndefineMacro(\"\\\\supe\", \"\\\\supseteq\");\ndefineMacro(\"\\\\Tau\", \"\\\\mathrm{T}\");\ndefineMacro(\"\\\\thetasym\", \"\\\\vartheta\"); // TODO: defineMacro(\"\\\\varcoppa\", \"\\\\\\mbox{\\\\coppa}\");\n\ndefineMacro(\"\\\\weierp\", \"\\\\wp\");\ndefineMacro(\"\\\\Zeta\", \"\\\\mathrm{Z}\"); //////////////////////////////////////////////////////////////////////\n// statmath.sty\n// https://ctan.math.illinois.edu/macros/latex/contrib/statmath/statmath.pdf\n\ndefineMacro(\"\\\\argmin\", \"\\\\DOTSB\\\\operatorname*{arg\\\\,min}\");\ndefineMacro(\"\\\\argmax\", \"\\\\DOTSB\\\\operatorname*{arg\\\\,max}\");\ndefineMacro(\"\\\\plim\", \"\\\\DOTSB\\\\mathop{\\\\operatorname{plim}}\\\\limits\"); // Custom Khan Academy colors, should be moved to an optional package\n\ndefineMacro(\"\\\\blue\", \"\\\\textcolor{##6495ed}{#1}\");\ndefineMacro(\"\\\\orange\", \"\\\\textcolor{##ffa500}{#1}\");\ndefineMacro(\"\\\\pink\", \"\\\\textcolor{##ff00af}{#1}\");\ndefineMacro(\"\\\\red\", \"\\\\textcolor{##df0030}{#1}\");\ndefineMacro(\"\\\\green\", \"\\\\textcolor{##28ae7b}{#1}\");\ndefineMacro(\"\\\\gray\", \"\\\\textcolor{gray}{#1}\");\ndefineMacro(\"\\\\purple\", \"\\\\textcolor{##9d38bd}{#1}\");\ndefineMacro(\"\\\\blueA\", \"\\\\textcolor{##ccfaff}{#1}\");\ndefineMacro(\"\\\\blueB\", \"\\\\textcolor{##80f6ff}{#1}\");\ndefineMacro(\"\\\\blueC\", \"\\\\textcolor{##63d9ea}{#1}\");\ndefineMacro(\"\\\\blueD\", \"\\\\textcolor{##11accd}{#1}\");\ndefineMacro(\"\\\\blueE\", \"\\\\textcolor{##0c7f99}{#1}\");\ndefineMacro(\"\\\\tealA\", \"\\\\textcolor{##94fff5}{#1}\");\ndefineMacro(\"\\\\tealB\", \"\\\\textcolor{##26edd5}{#1}\");\ndefineMacro(\"\\\\tealC\", \"\\\\textcolor{##01d1c1}{#1}\");\ndefineMacro(\"\\\\tealD\", \"\\\\textcolor{##01a995}{#1}\");\ndefineMacro(\"\\\\tealE\", \"\\\\textcolor{##208170}{#1}\");\ndefineMacro(\"\\\\greenA\", \"\\\\textcolor{##b6ffb0}{#1}\");\ndefineMacro(\"\\\\greenB\", \"\\\\textcolor{##8af281}{#1}\");\ndefineMacro(\"\\\\greenC\", \"\\\\textcolor{##74cf70}{#1}\");\ndefineMacro(\"\\\\greenD\", \"\\\\textcolor{##1fab54}{#1}\");\ndefineMacro(\"\\\\greenE\", \"\\\\textcolor{##0d923f}{#1}\");\ndefineMacro(\"\\\\goldA\", \"\\\\textcolor{##ffd0a9}{#1}\");\ndefineMacro(\"\\\\goldB\", \"\\\\textcolor{##ffbb71}{#1}\");\ndefineMacro(\"\\\\goldC\", \"\\\\textcolor{##ff9c39}{#1}\");\ndefineMacro(\"\\\\goldD\", \"\\\\textcolor{##e07d10}{#1}\");\ndefineMacro(\"\\\\goldE\", \"\\\\textcolor{##a75a05}{#1}\");\ndefineMacro(\"\\\\redA\", \"\\\\textcolor{##fca9a9}{#1}\");\ndefineMacro(\"\\\\redB\", \"\\\\textcolor{##ff8482}{#1}\");\ndefineMacro(\"\\\\redC\", \"\\\\textcolor{##f9685d}{#1}\");\ndefineMacro(\"\\\\redD\", \"\\\\textcolor{##e84d39}{#1}\");\ndefineMacro(\"\\\\redE\", \"\\\\textcolor{##bc2612}{#1}\");\ndefineMacro(\"\\\\maroonA\", \"\\\\textcolor{##ffbde0}{#1}\");\ndefineMacro(\"\\\\maroonB\", \"\\\\textcolor{##ff92c6}{#1}\");\ndefineMacro(\"\\\\maroonC\", \"\\\\textcolor{##ed5fa6}{#1}\");\ndefineMacro(\"\\\\maroonD\", \"\\\\textcolor{##ca337c}{#1}\");\ndefineMacro(\"\\\\maroonE\", \"\\\\textcolor{##9e034e}{#1}\");\ndefineMacro(\"\\\\purpleA\", \"\\\\textcolor{##ddd7ff}{#1}\");\ndefineMacro(\"\\\\purpleB\", \"\\\\textcolor{##c6b9fc}{#1}\");\ndefineMacro(\"\\\\purpleC\", \"\\\\textcolor{##aa87ff}{#1}\");\ndefineMacro(\"\\\\purpleD\", \"\\\\textcolor{##7854ab}{#1}\");\ndefineMacro(\"\\\\purpleE\", \"\\\\textcolor{##543b78}{#1}\");\ndefineMacro(\"\\\\mintA\", \"\\\\textcolor{##f5f9e8}{#1}\");\ndefineMacro(\"\\\\mintB\", \"\\\\textcolor{##edf2df}{#1}\");\ndefineMacro(\"\\\\mintC\", \"\\\\textcolor{##e0e5cc}{#1}\");\ndefineMacro(\"\\\\grayA\", \"\\\\textcolor{##f6f7f7}{#1}\");\ndefineMacro(\"\\\\grayB\", \"\\\\textcolor{##f0f1f2}{#1}\");\ndefineMacro(\"\\\\grayC\", \"\\\\textcolor{##e3e5e6}{#1}\");\ndefineMacro(\"\\\\grayD\", \"\\\\textcolor{##d6d8da}{#1}\");\ndefineMacro(\"\\\\grayE\", \"\\\\textcolor{##babec2}{#1}\");\ndefineMacro(\"\\\\grayF\", \"\\\\textcolor{##888d93}{#1}\");\ndefineMacro(\"\\\\grayG\", \"\\\\textcolor{##626569}{#1}\");\ndefineMacro(\"\\\\grayH\", \"\\\\textcolor{##3b3e40}{#1}\");\ndefineMacro(\"\\\\grayI\", \"\\\\textcolor{##21242c}{#1}\");\ndefineMacro(\"\\\\kaBlue\", \"\\\\textcolor{##314453}{#1}\");\ndefineMacro(\"\\\\kaGreen\", \"\\\\textcolor{##71B307}{#1}\");\n// CONCATENATED MODULE: ./src/MacroExpander.js\n/**\n * This file contains the “gullet” where macros are expanded\n * until only non-macro tokens remain.\n */\n\n\n\n\n\n\n\n// List of commands that act like macros but aren't defined as a macro,\n// function, or symbol. Used in `isDefined`.\nvar implicitCommands = {\n \"\\\\relax\": true,\n // MacroExpander.js\n \"^\": true,\n // Parser.js\n \"_\": true,\n // Parser.js\n \"\\\\limits\": true,\n // Parser.js\n \"\\\\nolimits\": true // Parser.js\n\n};\n\nvar MacroExpander_MacroExpander =\n/*#__PURE__*/\nfunction () {\n function MacroExpander(input, settings, mode) {\n this.settings = void 0;\n this.expansionCount = void 0;\n this.lexer = void 0;\n this.macros = void 0;\n this.stack = void 0;\n this.mode = void 0;\n this.settings = settings;\n this.expansionCount = 0;\n this.feed(input); // Make new global namespace\n\n this.macros = new Namespace_Namespace(macros, settings.macros);\n this.mode = mode;\n this.stack = []; // contains tokens in REVERSE order\n }\n /**\n * Feed a new input string to the same MacroExpander\n * (with existing macros etc.).\n */\n\n\n var _proto = MacroExpander.prototype;\n\n _proto.feed = function feed(input) {\n this.lexer = new Lexer_Lexer(input, this.settings);\n }\n /**\n * Switches between \"text\" and \"math\" modes.\n */\n ;\n\n _proto.switchMode = function switchMode(newMode) {\n this.mode = newMode;\n }\n /**\n * Start a new group nesting within all namespaces.\n */\n ;\n\n _proto.beginGroup = function beginGroup() {\n this.macros.beginGroup();\n }\n /**\n * End current group nesting within all namespaces.\n */\n ;\n\n _proto.endGroup = function endGroup() {\n this.macros.endGroup();\n }\n /**\n * Returns the topmost token on the stack, without expanding it.\n * Similar in behavior to TeX's `\\futurelet`.\n */\n ;\n\n _proto.future = function future() {\n if (this.stack.length === 0) {\n this.pushToken(this.lexer.lex());\n }\n\n return this.stack[this.stack.length - 1];\n }\n /**\n * Remove and return the next unexpanded token.\n */\n ;\n\n _proto.popToken = function popToken() {\n this.future(); // ensure non-empty stack\n\n return this.stack.pop();\n }\n /**\n * Add a given token to the token stack. In particular, this get be used\n * to put back a token returned from one of the other methods.\n */\n ;\n\n _proto.pushToken = function pushToken(token) {\n this.stack.push(token);\n }\n /**\n * Append an array of tokens to the token stack.\n */\n ;\n\n _proto.pushTokens = function pushTokens(tokens) {\n var _this$stack;\n\n (_this$stack = this.stack).push.apply(_this$stack, tokens);\n }\n /**\n * Consume all following space tokens, without expansion.\n */\n ;\n\n _proto.consumeSpaces = function consumeSpaces() {\n for (;;) {\n var token = this.future();\n\n if (token.text === \" \") {\n this.stack.pop();\n } else {\n break;\n }\n }\n }\n /**\n * Consume the specified number of arguments from the token stream,\n * and return the resulting array of arguments.\n */\n ;\n\n _proto.consumeArgs = function consumeArgs(numArgs) {\n var args = []; // obtain arguments, either single token or balanced {…} group\n\n for (var i = 0; i < numArgs; ++i) {\n this.consumeSpaces(); // ignore spaces before each argument\n\n var startOfArg = this.popToken();\n\n if (startOfArg.text === \"{\") {\n var arg = [];\n var depth = 1;\n\n while (depth !== 0) {\n var tok = this.popToken();\n arg.push(tok);\n\n if (tok.text === \"{\") {\n ++depth;\n } else if (tok.text === \"}\") {\n --depth;\n } else if (tok.text === \"EOF\") {\n throw new src_ParseError(\"End of input in macro argument\", startOfArg);\n }\n }\n\n arg.pop(); // remove last }\n\n arg.reverse(); // like above, to fit in with stack order\n\n args[i] = arg;\n } else if (startOfArg.text === \"EOF\") {\n throw new src_ParseError(\"End of input expecting macro argument\");\n } else {\n args[i] = [startOfArg];\n }\n }\n\n return args;\n }\n /**\n * Expand the next token only once if possible.\n *\n * If the token is expanded, the resulting tokens will be pushed onto\n * the stack in reverse order and will be returned as an array,\n * also in reverse order.\n *\n * If not, the next token will be returned without removing it\n * from the stack. This case can be detected by a `Token` return value\n * instead of an `Array` return value.\n *\n * In either case, the next token will be on the top of the stack,\n * or the stack will be empty.\n *\n * Used to implement `expandAfterFuture` and `expandNextToken`.\n *\n * At the moment, macro expansion doesn't handle delimited macros,\n * i.e. things like those defined by \\def\\foo#1\\end{…}.\n * See the TeX book page 202ff. for details on how those should behave.\n */\n ;\n\n _proto.expandOnce = function expandOnce() {\n var topToken = this.popToken();\n var name = topToken.text;\n\n var expansion = this._getExpansion(name);\n\n if (expansion == null) {\n // mainly checking for undefined here\n // Fully expanded\n this.pushToken(topToken);\n return topToken;\n }\n\n this.expansionCount++;\n\n if (this.expansionCount > this.settings.maxExpand) {\n throw new src_ParseError(\"Too many expansions: infinite loop or \" + \"need to increase maxExpand setting\");\n }\n\n var tokens = expansion.tokens;\n\n if (expansion.numArgs) {\n var args = this.consumeArgs(expansion.numArgs); // paste arguments in place of the placeholders\n\n tokens = tokens.slice(); // make a shallow copy\n\n for (var i = tokens.length - 1; i >= 0; --i) {\n var tok = tokens[i];\n\n if (tok.text === \"#\") {\n if (i === 0) {\n throw new src_ParseError(\"Incomplete placeholder at end of macro body\", tok);\n }\n\n tok = tokens[--i]; // next token on stack\n\n if (tok.text === \"#\") {\n // ## → #\n tokens.splice(i + 1, 1); // drop first #\n } else if (/^[1-9]$/.test(tok.text)) {\n var _tokens;\n\n // replace the placeholder with the indicated argument\n (_tokens = tokens).splice.apply(_tokens, [i, 2].concat(args[+tok.text - 1]));\n } else {\n throw new src_ParseError(\"Not a valid argument number\", tok);\n }\n }\n }\n } // Concatenate expansion onto top of stack.\n\n\n this.pushTokens(tokens);\n return tokens;\n }\n /**\n * Expand the next token only once (if possible), and return the resulting\n * top token on the stack (without removing anything from the stack).\n * Similar in behavior to TeX's `\\expandafter\\futurelet`.\n * Equivalent to expandOnce() followed by future().\n */\n ;\n\n _proto.expandAfterFuture = function expandAfterFuture() {\n this.expandOnce();\n return this.future();\n }\n /**\n * Recursively expand first token, then return first non-expandable token.\n */\n ;\n\n _proto.expandNextToken = function expandNextToken() {\n for (;;) {\n var expanded = this.expandOnce(); // expandOnce returns Token if and only if it's fully expanded.\n\n if (expanded instanceof Token_Token) {\n // \\relax stops the expansion, but shouldn't get returned (a\n // null return value couldn't get implemented as a function).\n if (expanded.text === \"\\\\relax\") {\n this.stack.pop();\n } else {\n return this.stack.pop(); // === expanded\n }\n }\n } // Flow unable to figure out that this pathway is impossible.\n // https://github.com/facebook/flow/issues/4808\n\n\n throw new Error(); // eslint-disable-line no-unreachable\n }\n /**\n * Fully expand the given macro name and return the resulting list of\n * tokens, or return `undefined` if no such macro is defined.\n */\n ;\n\n _proto.expandMacro = function expandMacro(name) {\n if (!this.macros.get(name)) {\n return undefined;\n }\n\n var output = [];\n var oldStackLength = this.stack.length;\n this.pushToken(new Token_Token(name));\n\n while (this.stack.length > oldStackLength) {\n var expanded = this.expandOnce(); // expandOnce returns Token if and only if it's fully expanded.\n\n if (expanded instanceof Token_Token) {\n output.push(this.stack.pop());\n }\n }\n\n return output;\n }\n /**\n * Fully expand the given macro name and return the result as a string,\n * or return `undefined` if no such macro is defined.\n */\n ;\n\n _proto.expandMacroAsText = function expandMacroAsText(name) {\n var tokens = this.expandMacro(name);\n\n if (tokens) {\n return tokens.map(function (token) {\n return token.text;\n }).join(\"\");\n } else {\n return tokens;\n }\n }\n /**\n * Returns the expanded macro as a reversed array of tokens and a macro\n * argument count. Or returns `null` if no such macro.\n */\n ;\n\n _proto._getExpansion = function _getExpansion(name) {\n var definition = this.macros.get(name);\n\n if (definition == null) {\n // mainly checking for undefined here\n return definition;\n }\n\n var expansion = typeof definition === \"function\" ? definition(this) : definition;\n\n if (typeof expansion === \"string\") {\n var numArgs = 0;\n\n if (expansion.indexOf(\"#\") !== -1) {\n var stripped = expansion.replace(/##/g, \"\");\n\n while (stripped.indexOf(\"#\" + (numArgs + 1)) !== -1) {\n ++numArgs;\n }\n }\n\n var bodyLexer = new Lexer_Lexer(expansion, this.settings);\n var tokens = [];\n var tok = bodyLexer.lex();\n\n while (tok.text !== \"EOF\") {\n tokens.push(tok);\n tok = bodyLexer.lex();\n }\n\n tokens.reverse(); // to fit in with stack using push and pop\n\n var expanded = {\n tokens: tokens,\n numArgs: numArgs\n };\n return expanded;\n }\n\n return expansion;\n }\n /**\n * Determine whether a command is currently \"defined\" (has some\n * functionality), meaning that it's a macro (in the current group),\n * a function, a symbol, or one of the special commands listed in\n * `implicitCommands`.\n */\n ;\n\n _proto.isDefined = function isDefined(name) {\n return this.macros.has(name) || src_functions.hasOwnProperty(name) || src_symbols.math.hasOwnProperty(name) || src_symbols.text.hasOwnProperty(name) || implicitCommands.hasOwnProperty(name);\n };\n\n return MacroExpander;\n}();\n\n\n// CONCATENATED MODULE: ./src/unicodeAccents.js\n// Mapping of Unicode accent characters to their LaTeX equivalent in text and\n// math mode (when they exist).\n/* harmony default export */ var unicodeAccents = ({\n \"\\u0301\": {\n text: \"\\\\'\",\n math: '\\\\acute'\n },\n \"\\u0300\": {\n text: '\\\\`',\n math: '\\\\grave'\n },\n \"\\u0308\": {\n text: '\\\\\"',\n math: '\\\\ddot'\n },\n \"\\u0303\": {\n text: '\\\\~',\n math: '\\\\tilde'\n },\n \"\\u0304\": {\n text: '\\\\=',\n math: '\\\\bar'\n },\n \"\\u0306\": {\n text: \"\\\\u\",\n math: '\\\\breve'\n },\n \"\\u030C\": {\n text: '\\\\v',\n math: '\\\\check'\n },\n \"\\u0302\": {\n text: '\\\\^',\n math: '\\\\hat'\n },\n \"\\u0307\": {\n text: '\\\\.',\n math: '\\\\dot'\n },\n \"\\u030A\": {\n text: '\\\\r',\n math: '\\\\mathring'\n },\n \"\\u030B\": {\n text: '\\\\H'\n }\n});\n// CONCATENATED MODULE: ./src/unicodeSymbols.js\n// This file is GENERATED by unicodeMake.js. DO NOT MODIFY.\n/* harmony default export */ var unicodeSymbols = ({\n \"\\xE1\": \"a\\u0301\",\n // á = \\'{a}\n \"\\xE0\": \"a\\u0300\",\n // à = \\`{a}\n \"\\xE4\": \"a\\u0308\",\n // ä = \\\"{a}\n \"\\u01DF\": \"a\\u0308\\u0304\",\n // ǟ = \\\"\\={a}\n \"\\xE3\": \"a\\u0303\",\n // ã = \\~{a}\n \"\\u0101\": \"a\\u0304\",\n // ā = \\={a}\n \"\\u0103\": \"a\\u0306\",\n // ă = \\u{a}\n \"\\u1EAF\": \"a\\u0306\\u0301\",\n // ắ = \\u\\'{a}\n \"\\u1EB1\": \"a\\u0306\\u0300\",\n // ằ = \\u\\`{a}\n \"\\u1EB5\": \"a\\u0306\\u0303\",\n // ẵ = \\u\\~{a}\n \"\\u01CE\": \"a\\u030C\",\n // ǎ = \\v{a}\n \"\\xE2\": \"a\\u0302\",\n // â = \\^{a}\n \"\\u1EA5\": \"a\\u0302\\u0301\",\n // ấ = \\^\\'{a}\n \"\\u1EA7\": \"a\\u0302\\u0300\",\n // ầ = \\^\\`{a}\n \"\\u1EAB\": \"a\\u0302\\u0303\",\n // ẫ = \\^\\~{a}\n \"\\u0227\": \"a\\u0307\",\n // ȧ = \\.{a}\n \"\\u01E1\": \"a\\u0307\\u0304\",\n // ǡ = \\.\\={a}\n \"\\xE5\": \"a\\u030A\",\n // å = \\r{a}\n \"\\u01FB\": \"a\\u030A\\u0301\",\n // ǻ = \\r\\'{a}\n \"\\u1E03\": \"b\\u0307\",\n // ḃ = \\.{b}\n \"\\u0107\": \"c\\u0301\",\n // ć = \\'{c}\n \"\\u010D\": \"c\\u030C\",\n // č = \\v{c}\n \"\\u0109\": \"c\\u0302\",\n // ĉ = \\^{c}\n \"\\u010B\": \"c\\u0307\",\n // ċ = \\.{c}\n \"\\u010F\": \"d\\u030C\",\n // ď = \\v{d}\n \"\\u1E0B\": \"d\\u0307\",\n // ḋ = \\.{d}\n \"\\xE9\": \"e\\u0301\",\n // é = \\'{e}\n \"\\xE8\": \"e\\u0300\",\n // è = \\`{e}\n \"\\xEB\": \"e\\u0308\",\n // ë = \\\"{e}\n \"\\u1EBD\": \"e\\u0303\",\n // ẽ = \\~{e}\n \"\\u0113\": \"e\\u0304\",\n // ē = \\={e}\n \"\\u1E17\": \"e\\u0304\\u0301\",\n // ḗ = \\=\\'{e}\n \"\\u1E15\": \"e\\u0304\\u0300\",\n // ḕ = \\=\\`{e}\n \"\\u0115\": \"e\\u0306\",\n // ĕ = \\u{e}\n \"\\u011B\": \"e\\u030C\",\n // ě = \\v{e}\n \"\\xEA\": \"e\\u0302\",\n // ê = \\^{e}\n \"\\u1EBF\": \"e\\u0302\\u0301\",\n // ế = \\^\\'{e}\n \"\\u1EC1\": \"e\\u0302\\u0300\",\n // ề = \\^\\`{e}\n \"\\u1EC5\": \"e\\u0302\\u0303\",\n // ễ = \\^\\~{e}\n \"\\u0117\": \"e\\u0307\",\n // ė = \\.{e}\n \"\\u1E1F\": \"f\\u0307\",\n // ḟ = \\.{f}\n \"\\u01F5\": \"g\\u0301\",\n // ǵ = \\'{g}\n \"\\u1E21\": \"g\\u0304\",\n // ḡ = \\={g}\n \"\\u011F\": \"g\\u0306\",\n // ğ = \\u{g}\n \"\\u01E7\": \"g\\u030C\",\n // ǧ = \\v{g}\n \"\\u011D\": \"g\\u0302\",\n // ĝ = \\^{g}\n \"\\u0121\": \"g\\u0307\",\n // ġ = \\.{g}\n \"\\u1E27\": \"h\\u0308\",\n // ḧ = \\\"{h}\n \"\\u021F\": \"h\\u030C\",\n // ȟ = \\v{h}\n \"\\u0125\": \"h\\u0302\",\n // ĥ = \\^{h}\n \"\\u1E23\": \"h\\u0307\",\n // ḣ = \\.{h}\n \"\\xED\": \"i\\u0301\",\n // í = \\'{i}\n \"\\xEC\": \"i\\u0300\",\n // ì = \\`{i}\n \"\\xEF\": \"i\\u0308\",\n // ï = \\\"{i}\n \"\\u1E2F\": \"i\\u0308\\u0301\",\n // ḯ = \\\"\\'{i}\n \"\\u0129\": \"i\\u0303\",\n // ĩ = \\~{i}\n \"\\u012B\": \"i\\u0304\",\n // ī = \\={i}\n \"\\u012D\": \"i\\u0306\",\n // ĭ = \\u{i}\n \"\\u01D0\": \"i\\u030C\",\n // ǐ = \\v{i}\n \"\\xEE\": \"i\\u0302\",\n // î = \\^{i}\n \"\\u01F0\": \"j\\u030C\",\n // ǰ = \\v{j}\n \"\\u0135\": \"j\\u0302\",\n // ĵ = \\^{j}\n \"\\u1E31\": \"k\\u0301\",\n // ḱ = \\'{k}\n \"\\u01E9\": \"k\\u030C\",\n // ǩ = \\v{k}\n \"\\u013A\": \"l\\u0301\",\n // ĺ = \\'{l}\n \"\\u013E\": \"l\\u030C\",\n // ľ = \\v{l}\n \"\\u1E3F\": \"m\\u0301\",\n // ḿ = \\'{m}\n \"\\u1E41\": \"m\\u0307\",\n // ṁ = \\.{m}\n \"\\u0144\": \"n\\u0301\",\n // ń = \\'{n}\n \"\\u01F9\": \"n\\u0300\",\n // ǹ = \\`{n}\n \"\\xF1\": \"n\\u0303\",\n // ñ = \\~{n}\n \"\\u0148\": \"n\\u030C\",\n // ň = \\v{n}\n \"\\u1E45\": \"n\\u0307\",\n // ṅ = \\.{n}\n \"\\xF3\": \"o\\u0301\",\n // ó = \\'{o}\n \"\\xF2\": \"o\\u0300\",\n // ò = \\`{o}\n \"\\xF6\": \"o\\u0308\",\n // ö = \\\"{o}\n \"\\u022B\": \"o\\u0308\\u0304\",\n // ȫ = \\\"\\={o}\n \"\\xF5\": \"o\\u0303\",\n // õ = \\~{o}\n \"\\u1E4D\": \"o\\u0303\\u0301\",\n // ṍ = \\~\\'{o}\n \"\\u1E4F\": \"o\\u0303\\u0308\",\n // ṏ = \\~\\\"{o}\n \"\\u022D\": \"o\\u0303\\u0304\",\n // ȭ = \\~\\={o}\n \"\\u014D\": \"o\\u0304\",\n // ō = \\={o}\n \"\\u1E53\": \"o\\u0304\\u0301\",\n // ṓ = \\=\\'{o}\n \"\\u1E51\": \"o\\u0304\\u0300\",\n // ṑ = \\=\\`{o}\n \"\\u014F\": \"o\\u0306\",\n // ŏ = \\u{o}\n \"\\u01D2\": \"o\\u030C\",\n // ǒ = \\v{o}\n \"\\xF4\": \"o\\u0302\",\n // ô = \\^{o}\n \"\\u1ED1\": \"o\\u0302\\u0301\",\n // ố = \\^\\'{o}\n \"\\u1ED3\": \"o\\u0302\\u0300\",\n // ồ = \\^\\`{o}\n \"\\u1ED7\": \"o\\u0302\\u0303\",\n // ỗ = \\^\\~{o}\n \"\\u022F\": \"o\\u0307\",\n // ȯ = \\.{o}\n \"\\u0231\": \"o\\u0307\\u0304\",\n // ȱ = \\.\\={o}\n \"\\u0151\": \"o\\u030B\",\n // ő = \\H{o}\n \"\\u1E55\": \"p\\u0301\",\n // ṕ = \\'{p}\n \"\\u1E57\": \"p\\u0307\",\n // ṗ = \\.{p}\n \"\\u0155\": \"r\\u0301\",\n // ŕ = \\'{r}\n \"\\u0159\": \"r\\u030C\",\n // ř = \\v{r}\n \"\\u1E59\": \"r\\u0307\",\n // ṙ = \\.{r}\n \"\\u015B\": \"s\\u0301\",\n // ś = \\'{s}\n \"\\u1E65\": \"s\\u0301\\u0307\",\n // ṥ = \\'\\.{s}\n \"\\u0161\": \"s\\u030C\",\n // š = \\v{s}\n \"\\u1E67\": \"s\\u030C\\u0307\",\n // ṧ = \\v\\.{s}\n \"\\u015D\": \"s\\u0302\",\n // ŝ = \\^{s}\n \"\\u1E61\": \"s\\u0307\",\n // ṡ = \\.{s}\n \"\\u1E97\": \"t\\u0308\",\n // ẗ = \\\"{t}\n \"\\u0165\": \"t\\u030C\",\n // ť = \\v{t}\n \"\\u1E6B\": \"t\\u0307\",\n // ṫ = \\.{t}\n \"\\xFA\": \"u\\u0301\",\n // ú = \\'{u}\n \"\\xF9\": \"u\\u0300\",\n // ù = \\`{u}\n \"\\xFC\": \"u\\u0308\",\n // ü = \\\"{u}\n \"\\u01D8\": \"u\\u0308\\u0301\",\n // ǘ = \\\"\\'{u}\n \"\\u01DC\": \"u\\u0308\\u0300\",\n // ǜ = \\\"\\`{u}\n \"\\u01D6\": \"u\\u0308\\u0304\",\n // ǖ = \\\"\\={u}\n \"\\u01DA\": \"u\\u0308\\u030C\",\n // ǚ = \\\"\\v{u}\n \"\\u0169\": \"u\\u0303\",\n // ũ = \\~{u}\n \"\\u1E79\": \"u\\u0303\\u0301\",\n // ṹ = \\~\\'{u}\n \"\\u016B\": \"u\\u0304\",\n // ū = \\={u}\n \"\\u1E7B\": \"u\\u0304\\u0308\",\n // ṻ = \\=\\\"{u}\n \"\\u016D\": \"u\\u0306\",\n // ŭ = \\u{u}\n \"\\u01D4\": \"u\\u030C\",\n // ǔ = \\v{u}\n \"\\xFB\": \"u\\u0302\",\n // û = \\^{u}\n \"\\u016F\": \"u\\u030A\",\n // ů = \\r{u}\n \"\\u0171\": \"u\\u030B\",\n // ű = \\H{u}\n \"\\u1E7D\": \"v\\u0303\",\n // ṽ = \\~{v}\n \"\\u1E83\": \"w\\u0301\",\n // ẃ = \\'{w}\n \"\\u1E81\": \"w\\u0300\",\n // ẁ = \\`{w}\n \"\\u1E85\": \"w\\u0308\",\n // ẅ = \\\"{w}\n \"\\u0175\": \"w\\u0302\",\n // ŵ = \\^{w}\n \"\\u1E87\": \"w\\u0307\",\n // ẇ = \\.{w}\n \"\\u1E98\": \"w\\u030A\",\n // ẘ = \\r{w}\n \"\\u1E8D\": \"x\\u0308\",\n // ẍ = \\\"{x}\n \"\\u1E8B\": \"x\\u0307\",\n // ẋ = \\.{x}\n \"\\xFD\": \"y\\u0301\",\n // ý = \\'{y}\n \"\\u1EF3\": \"y\\u0300\",\n // ỳ = \\`{y}\n \"\\xFF\": \"y\\u0308\",\n // ÿ = \\\"{y}\n \"\\u1EF9\": \"y\\u0303\",\n // ỹ = \\~{y}\n \"\\u0233\": \"y\\u0304\",\n // ȳ = \\={y}\n \"\\u0177\": \"y\\u0302\",\n // ŷ = \\^{y}\n \"\\u1E8F\": \"y\\u0307\",\n // ẏ = \\.{y}\n \"\\u1E99\": \"y\\u030A\",\n // ẙ = \\r{y}\n \"\\u017A\": \"z\\u0301\",\n // ź = \\'{z}\n \"\\u017E\": \"z\\u030C\",\n // ž = \\v{z}\n \"\\u1E91\": \"z\\u0302\",\n // ẑ = \\^{z}\n \"\\u017C\": \"z\\u0307\",\n // ż = \\.{z}\n \"\\xC1\": \"A\\u0301\",\n // Á = \\'{A}\n \"\\xC0\": \"A\\u0300\",\n // À = \\`{A}\n \"\\xC4\": \"A\\u0308\",\n // Ä = \\\"{A}\n \"\\u01DE\": \"A\\u0308\\u0304\",\n // Ǟ = \\\"\\={A}\n \"\\xC3\": \"A\\u0303\",\n // Ã = \\~{A}\n \"\\u0100\": \"A\\u0304\",\n // Ā = \\={A}\n \"\\u0102\": \"A\\u0306\",\n // Ă = \\u{A}\n \"\\u1EAE\": \"A\\u0306\\u0301\",\n // Ắ = \\u\\'{A}\n \"\\u1EB0\": \"A\\u0306\\u0300\",\n // Ằ = \\u\\`{A}\n \"\\u1EB4\": \"A\\u0306\\u0303\",\n // Ẵ = \\u\\~{A}\n \"\\u01CD\": \"A\\u030C\",\n // Ǎ = \\v{A}\n \"\\xC2\": \"A\\u0302\",\n // Â = \\^{A}\n \"\\u1EA4\": \"A\\u0302\\u0301\",\n // Ấ = \\^\\'{A}\n \"\\u1EA6\": \"A\\u0302\\u0300\",\n // Ầ = \\^\\`{A}\n \"\\u1EAA\": \"A\\u0302\\u0303\",\n // Ẫ = \\^\\~{A}\n \"\\u0226\": \"A\\u0307\",\n // Ȧ = \\.{A}\n \"\\u01E0\": \"A\\u0307\\u0304\",\n // Ǡ = \\.\\={A}\n \"\\xC5\": \"A\\u030A\",\n // Å = \\r{A}\n \"\\u01FA\": \"A\\u030A\\u0301\",\n // Ǻ = \\r\\'{A}\n \"\\u1E02\": \"B\\u0307\",\n // Ḃ = \\.{B}\n \"\\u0106\": \"C\\u0301\",\n // Ć = \\'{C}\n \"\\u010C\": \"C\\u030C\",\n // Č = \\v{C}\n \"\\u0108\": \"C\\u0302\",\n // Ĉ = \\^{C}\n \"\\u010A\": \"C\\u0307\",\n // Ċ = \\.{C}\n \"\\u010E\": \"D\\u030C\",\n // Ď = \\v{D}\n \"\\u1E0A\": \"D\\u0307\",\n // Ḋ = \\.{D}\n \"\\xC9\": \"E\\u0301\",\n // É = \\'{E}\n \"\\xC8\": \"E\\u0300\",\n // È = \\`{E}\n \"\\xCB\": \"E\\u0308\",\n // Ë = \\\"{E}\n \"\\u1EBC\": \"E\\u0303\",\n // Ẽ = \\~{E}\n \"\\u0112\": \"E\\u0304\",\n // Ē = \\={E}\n \"\\u1E16\": \"E\\u0304\\u0301\",\n // Ḗ = \\=\\'{E}\n \"\\u1E14\": \"E\\u0304\\u0300\",\n // Ḕ = \\=\\`{E}\n \"\\u0114\": \"E\\u0306\",\n // Ĕ = \\u{E}\n \"\\u011A\": \"E\\u030C\",\n // Ě = \\v{E}\n \"\\xCA\": \"E\\u0302\",\n // Ê = \\^{E}\n \"\\u1EBE\": \"E\\u0302\\u0301\",\n // Ế = \\^\\'{E}\n \"\\u1EC0\": \"E\\u0302\\u0300\",\n // Ề = \\^\\`{E}\n \"\\u1EC4\": \"E\\u0302\\u0303\",\n // Ễ = \\^\\~{E}\n \"\\u0116\": \"E\\u0307\",\n // Ė = \\.{E}\n \"\\u1E1E\": \"F\\u0307\",\n // Ḟ = \\.{F}\n \"\\u01F4\": \"G\\u0301\",\n // Ǵ = \\'{G}\n \"\\u1E20\": \"G\\u0304\",\n // Ḡ = \\={G}\n \"\\u011E\": \"G\\u0306\",\n // Ğ = \\u{G}\n \"\\u01E6\": \"G\\u030C\",\n // Ǧ = \\v{G}\n \"\\u011C\": \"G\\u0302\",\n // Ĝ = \\^{G}\n \"\\u0120\": \"G\\u0307\",\n // Ġ = \\.{G}\n \"\\u1E26\": \"H\\u0308\",\n // Ḧ = \\\"{H}\n \"\\u021E\": \"H\\u030C\",\n // Ȟ = \\v{H}\n \"\\u0124\": \"H\\u0302\",\n // Ĥ = \\^{H}\n \"\\u1E22\": \"H\\u0307\",\n // Ḣ = \\.{H}\n \"\\xCD\": \"I\\u0301\",\n // Í = \\'{I}\n \"\\xCC\": \"I\\u0300\",\n // Ì = \\`{I}\n \"\\xCF\": \"I\\u0308\",\n // Ï = \\\"{I}\n \"\\u1E2E\": \"I\\u0308\\u0301\",\n // Ḯ = \\\"\\'{I}\n \"\\u0128\": \"I\\u0303\",\n // Ĩ = \\~{I}\n \"\\u012A\": \"I\\u0304\",\n // Ī = \\={I}\n \"\\u012C\": \"I\\u0306\",\n // Ĭ = \\u{I}\n \"\\u01CF\": \"I\\u030C\",\n // Ǐ = \\v{I}\n \"\\xCE\": \"I\\u0302\",\n // Î = \\^{I}\n \"\\u0130\": \"I\\u0307\",\n // İ = \\.{I}\n \"\\u0134\": \"J\\u0302\",\n // Ĵ = \\^{J}\n \"\\u1E30\": \"K\\u0301\",\n // Ḱ = \\'{K}\n \"\\u01E8\": \"K\\u030C\",\n // Ǩ = \\v{K}\n \"\\u0139\": \"L\\u0301\",\n // Ĺ = \\'{L}\n \"\\u013D\": \"L\\u030C\",\n // Ľ = \\v{L}\n \"\\u1E3E\": \"M\\u0301\",\n // Ḿ = \\'{M}\n \"\\u1E40\": \"M\\u0307\",\n // Ṁ = \\.{M}\n \"\\u0143\": \"N\\u0301\",\n // Ń = \\'{N}\n \"\\u01F8\": \"N\\u0300\",\n // Ǹ = \\`{N}\n \"\\xD1\": \"N\\u0303\",\n // Ñ = \\~{N}\n \"\\u0147\": \"N\\u030C\",\n // Ň = \\v{N}\n \"\\u1E44\": \"N\\u0307\",\n // Ṅ = \\.{N}\n \"\\xD3\": \"O\\u0301\",\n // Ó = \\'{O}\n \"\\xD2\": \"O\\u0300\",\n // Ò = \\`{O}\n \"\\xD6\": \"O\\u0308\",\n // Ö = \\\"{O}\n \"\\u022A\": \"O\\u0308\\u0304\",\n // Ȫ = \\\"\\={O}\n \"\\xD5\": \"O\\u0303\",\n // Õ = \\~{O}\n \"\\u1E4C\": \"O\\u0303\\u0301\",\n // Ṍ = \\~\\'{O}\n \"\\u1E4E\": \"O\\u0303\\u0308\",\n // Ṏ = \\~\\\"{O}\n \"\\u022C\": \"O\\u0303\\u0304\",\n // Ȭ = \\~\\={O}\n \"\\u014C\": \"O\\u0304\",\n // Ō = \\={O}\n \"\\u1E52\": \"O\\u0304\\u0301\",\n // Ṓ = \\=\\'{O}\n \"\\u1E50\": \"O\\u0304\\u0300\",\n // Ṑ = \\=\\`{O}\n \"\\u014E\": \"O\\u0306\",\n // Ŏ = \\u{O}\n \"\\u01D1\": \"O\\u030C\",\n // Ǒ = \\v{O}\n \"\\xD4\": \"O\\u0302\",\n // Ô = \\^{O}\n \"\\u1ED0\": \"O\\u0302\\u0301\",\n // Ố = \\^\\'{O}\n \"\\u1ED2\": \"O\\u0302\\u0300\",\n // Ồ = \\^\\`{O}\n \"\\u1ED6\": \"O\\u0302\\u0303\",\n // Ỗ = \\^\\~{O}\n \"\\u022E\": \"O\\u0307\",\n // Ȯ = \\.{O}\n \"\\u0230\": \"O\\u0307\\u0304\",\n // Ȱ = \\.\\={O}\n \"\\u0150\": \"O\\u030B\",\n // Ő = \\H{O}\n \"\\u1E54\": \"P\\u0301\",\n // Ṕ = \\'{P}\n \"\\u1E56\": \"P\\u0307\",\n // Ṗ = \\.{P}\n \"\\u0154\": \"R\\u0301\",\n // Ŕ = \\'{R}\n \"\\u0158\": \"R\\u030C\",\n // Ř = \\v{R}\n \"\\u1E58\": \"R\\u0307\",\n // Ṙ = \\.{R}\n \"\\u015A\": \"S\\u0301\",\n // Ś = \\'{S}\n \"\\u1E64\": \"S\\u0301\\u0307\",\n // Ṥ = \\'\\.{S}\n \"\\u0160\": \"S\\u030C\",\n // Š = \\v{S}\n \"\\u1E66\": \"S\\u030C\\u0307\",\n // Ṧ = \\v\\.{S}\n \"\\u015C\": \"S\\u0302\",\n // Ŝ = \\^{S}\n \"\\u1E60\": \"S\\u0307\",\n // Ṡ = \\.{S}\n \"\\u0164\": \"T\\u030C\",\n // Ť = \\v{T}\n \"\\u1E6A\": \"T\\u0307\",\n // Ṫ = \\.{T}\n \"\\xDA\": \"U\\u0301\",\n // Ú = \\'{U}\n \"\\xD9\": \"U\\u0300\",\n // Ù = \\`{U}\n \"\\xDC\": \"U\\u0308\",\n // Ü = \\\"{U}\n \"\\u01D7\": \"U\\u0308\\u0301\",\n // Ǘ = \\\"\\'{U}\n \"\\u01DB\": \"U\\u0308\\u0300\",\n // Ǜ = \\\"\\`{U}\n \"\\u01D5\": \"U\\u0308\\u0304\",\n // Ǖ = \\\"\\={U}\n \"\\u01D9\": \"U\\u0308\\u030C\",\n // Ǚ = \\\"\\v{U}\n \"\\u0168\": \"U\\u0303\",\n // Ũ = \\~{U}\n \"\\u1E78\": \"U\\u0303\\u0301\",\n // Ṹ = \\~\\'{U}\n \"\\u016A\": \"U\\u0304\",\n // Ū = \\={U}\n \"\\u1E7A\": \"U\\u0304\\u0308\",\n // Ṻ = \\=\\\"{U}\n \"\\u016C\": \"U\\u0306\",\n // Ŭ = \\u{U}\n \"\\u01D3\": \"U\\u030C\",\n // Ǔ = \\v{U}\n \"\\xDB\": \"U\\u0302\",\n // Û = \\^{U}\n \"\\u016E\": \"U\\u030A\",\n // Ů = \\r{U}\n \"\\u0170\": \"U\\u030B\",\n // Ű = \\H{U}\n \"\\u1E7C\": \"V\\u0303\",\n // Ṽ = \\~{V}\n \"\\u1E82\": \"W\\u0301\",\n // Ẃ = \\'{W}\n \"\\u1E80\": \"W\\u0300\",\n // Ẁ = \\`{W}\n \"\\u1E84\": \"W\\u0308\",\n // Ẅ = \\\"{W}\n \"\\u0174\": \"W\\u0302\",\n // Ŵ = \\^{W}\n \"\\u1E86\": \"W\\u0307\",\n // Ẇ = \\.{W}\n \"\\u1E8C\": \"X\\u0308\",\n // Ẍ = \\\"{X}\n \"\\u1E8A\": \"X\\u0307\",\n // Ẋ = \\.{X}\n \"\\xDD\": \"Y\\u0301\",\n // Ý = \\'{Y}\n \"\\u1EF2\": \"Y\\u0300\",\n // Ỳ = \\`{Y}\n \"\\u0178\": \"Y\\u0308\",\n // Ÿ = \\\"{Y}\n \"\\u1EF8\": \"Y\\u0303\",\n // Ỹ = \\~{Y}\n \"\\u0232\": \"Y\\u0304\",\n // Ȳ = \\={Y}\n \"\\u0176\": \"Y\\u0302\",\n // Ŷ = \\^{Y}\n \"\\u1E8E\": \"Y\\u0307\",\n // Ẏ = \\.{Y}\n \"\\u0179\": \"Z\\u0301\",\n // Ź = \\'{Z}\n \"\\u017D\": \"Z\\u030C\",\n // Ž = \\v{Z}\n \"\\u1E90\": \"Z\\u0302\",\n // Ẑ = \\^{Z}\n \"\\u017B\": \"Z\\u0307\",\n // Ż = \\.{Z}\n \"\\u03AC\": \"\\u03B1\\u0301\",\n // ά = \\'{α}\n \"\\u1F70\": \"\\u03B1\\u0300\",\n // ὰ = \\`{α}\n \"\\u1FB1\": \"\\u03B1\\u0304\",\n // ᾱ = \\={α}\n \"\\u1FB0\": \"\\u03B1\\u0306\",\n // ᾰ = \\u{α}\n \"\\u03AD\": \"\\u03B5\\u0301\",\n // έ = \\'{ε}\n \"\\u1F72\": \"\\u03B5\\u0300\",\n // ὲ = \\`{ε}\n \"\\u03AE\": \"\\u03B7\\u0301\",\n // ή = \\'{η}\n \"\\u1F74\": \"\\u03B7\\u0300\",\n // ὴ = \\`{η}\n \"\\u03AF\": \"\\u03B9\\u0301\",\n // ί = \\'{ι}\n \"\\u1F76\": \"\\u03B9\\u0300\",\n // ὶ = \\`{ι}\n \"\\u03CA\": \"\\u03B9\\u0308\",\n // ϊ = \\\"{ι}\n \"\\u0390\": \"\\u03B9\\u0308\\u0301\",\n // ΐ = \\\"\\'{ι}\n \"\\u1FD2\": \"\\u03B9\\u0308\\u0300\",\n // ῒ = \\\"\\`{ι}\n \"\\u1FD1\": \"\\u03B9\\u0304\",\n // ῑ = \\={ι}\n \"\\u1FD0\": \"\\u03B9\\u0306\",\n // ῐ = \\u{ι}\n \"\\u03CC\": \"\\u03BF\\u0301\",\n // ό = \\'{ο}\n \"\\u1F78\": \"\\u03BF\\u0300\",\n // ὸ = \\`{ο}\n \"\\u03CD\": \"\\u03C5\\u0301\",\n // ύ = \\'{υ}\n \"\\u1F7A\": \"\\u03C5\\u0300\",\n // ὺ = \\`{υ}\n \"\\u03CB\": \"\\u03C5\\u0308\",\n // ϋ = \\\"{υ}\n \"\\u03B0\": \"\\u03C5\\u0308\\u0301\",\n // ΰ = \\\"\\'{υ}\n \"\\u1FE2\": \"\\u03C5\\u0308\\u0300\",\n // ῢ = \\\"\\`{υ}\n \"\\u1FE1\": \"\\u03C5\\u0304\",\n // ῡ = \\={υ}\n \"\\u1FE0\": \"\\u03C5\\u0306\",\n // ῠ = \\u{υ}\n \"\\u03CE\": \"\\u03C9\\u0301\",\n // ώ = \\'{ω}\n \"\\u1F7C\": \"\\u03C9\\u0300\",\n // ὼ = \\`{ω}\n \"\\u038E\": \"\\u03A5\\u0301\",\n // Ύ = \\'{Υ}\n \"\\u1FEA\": \"\\u03A5\\u0300\",\n // Ὺ = \\`{Υ}\n \"\\u03AB\": \"\\u03A5\\u0308\",\n // Ϋ = \\\"{Υ}\n \"\\u1FE9\": \"\\u03A5\\u0304\",\n // Ῡ = \\={Υ}\n \"\\u1FE8\": \"\\u03A5\\u0306\",\n // Ῠ = \\u{Υ}\n \"\\u038F\": \"\\u03A9\\u0301\",\n // Ώ = \\'{Ω}\n \"\\u1FFA\": \"\\u03A9\\u0300\" // Ὼ = \\`{Ω}\n\n});\n// CONCATENATED MODULE: ./src/Parser.js\n/* eslint no-constant-condition:0 */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * This file contains the parser used to parse out a TeX expression from the\n * input. Since TeX isn't context-free, standard parsers don't work particularly\n * well.\n *\n * The strategy of this parser is as such:\n *\n * The main functions (the `.parse...` ones) take a position in the current\n * parse string to parse tokens from. The lexer (found in Lexer.js, stored at\n * this.gullet.lexer) also supports pulling out tokens at arbitrary places. When\n * individual tokens are needed at a position, the lexer is called to pull out a\n * token, which is then used.\n *\n * The parser has a property called \"mode\" indicating the mode that\n * the parser is currently in. Currently it has to be one of \"math\" or\n * \"text\", which denotes whether the current environment is a math-y\n * one or a text-y one (e.g. inside \\text). Currently, this serves to\n * limit the functions which can be used in text mode.\n *\n * The main functions then return an object which contains the useful data that\n * was parsed at its given point, and a new position at the end of the parsed\n * data. The main functions can call each other and continue the parsing by\n * using the returned position as a new starting point.\n *\n * There are also extra `.handle...` functions, which pull out some reused\n * functionality into self-contained functions.\n *\n * The functions return ParseNodes.\n */\nvar Parser_Parser =\n/*#__PURE__*/\nfunction () {\n function Parser(input, settings) {\n this.mode = void 0;\n this.gullet = void 0;\n this.settings = void 0;\n this.leftrightDepth = void 0;\n this.nextToken = void 0;\n // Start in math mode\n this.mode = \"math\"; // Create a new macro expander (gullet) and (indirectly via that) also a\n // new lexer (mouth) for this parser (stomach, in the language of TeX)\n\n this.gullet = new MacroExpander_MacroExpander(input, settings, this.mode); // Store the settings for use in parsing\n\n this.settings = settings; // Count leftright depth (for \\middle errors)\n\n this.leftrightDepth = 0;\n }\n /**\n * Checks a result to make sure it has the right type, and throws an\n * appropriate error otherwise.\n */\n\n\n var _proto = Parser.prototype;\n\n _proto.expect = function expect(text, consume) {\n if (consume === void 0) {\n consume = true;\n }\n\n if (this.fetch().text !== text) {\n throw new src_ParseError(\"Expected '\" + text + \"', got '\" + this.fetch().text + \"'\", this.fetch());\n }\n\n if (consume) {\n this.consume();\n }\n }\n /**\n * Discards the current lookahead token, considering it consumed.\n */\n ;\n\n _proto.consume = function consume() {\n this.nextToken = null;\n }\n /**\n * Return the current lookahead token, or if there isn't one (at the\n * beginning, or if the previous lookahead token was consume()d),\n * fetch the next token as the new lookahead token and return it.\n */\n ;\n\n _proto.fetch = function fetch() {\n if (this.nextToken == null) {\n this.nextToken = this.gullet.expandNextToken();\n }\n\n return this.nextToken;\n }\n /**\n * Switches between \"text\" and \"math\" modes.\n */\n ;\n\n _proto.switchMode = function switchMode(newMode) {\n this.mode = newMode;\n this.gullet.switchMode(newMode);\n }\n /**\n * Main parsing function, which parses an entire input.\n */\n ;\n\n _proto.parse = function parse() {\n // Create a group namespace for the math expression.\n // (LaTeX creates a new group for every $...$, $$...$$, \\[...\\].)\n this.gullet.beginGroup(); // Use old \\color behavior (same as LaTeX's \\textcolor) if requested.\n // We do this within the group for the math expression, so it doesn't\n // pollute settings.macros.\n\n if (this.settings.colorIsTextColor) {\n this.gullet.macros.set(\"\\\\color\", \"\\\\textcolor\");\n } // Try to parse the input\n\n\n var parse = this.parseExpression(false); // If we succeeded, make sure there's an EOF at the end\n\n this.expect(\"EOF\"); // End the group namespace for the expression\n\n this.gullet.endGroup();\n return parse;\n };\n\n _proto.parseExpression = function parseExpression(breakOnInfix, breakOnTokenText) {\n var body = []; // Keep adding atoms to the body until we can't parse any more atoms (either\n // we reached the end, a }, or a \\right)\n\n while (true) {\n // Ignore spaces in math mode\n if (this.mode === \"math\") {\n this.consumeSpaces();\n }\n\n var lex = this.fetch();\n\n if (Parser.endOfExpression.indexOf(lex.text) !== -1) {\n break;\n }\n\n if (breakOnTokenText && lex.text === breakOnTokenText) {\n break;\n }\n\n if (breakOnInfix && src_functions[lex.text] && src_functions[lex.text].infix) {\n break;\n }\n\n var atom = this.parseAtom(breakOnTokenText);\n\n if (!atom) {\n break;\n }\n\n body.push(atom);\n }\n\n if (this.mode === \"text\") {\n this.formLigatures(body);\n }\n\n return this.handleInfixNodes(body);\n }\n /**\n * Rewrites infix operators such as \\over with corresponding commands such\n * as \\frac.\n *\n * There can only be one infix operator per group. If there's more than one\n * then the expression is ambiguous. This can be resolved by adding {}.\n */\n ;\n\n _proto.handleInfixNodes = function handleInfixNodes(body) {\n var overIndex = -1;\n var funcName;\n\n for (var i = 0; i < body.length; i++) {\n var node = checkNodeType(body[i], \"infix\");\n\n if (node) {\n if (overIndex !== -1) {\n throw new src_ParseError(\"only one infix operator per group\", node.token);\n }\n\n overIndex = i;\n funcName = node.replaceWith;\n }\n }\n\n if (overIndex !== -1 && funcName) {\n var numerNode;\n var denomNode;\n var numerBody = body.slice(0, overIndex);\n var denomBody = body.slice(overIndex + 1);\n\n if (numerBody.length === 1 && numerBody[0].type === \"ordgroup\") {\n numerNode = numerBody[0];\n } else {\n numerNode = {\n type: \"ordgroup\",\n mode: this.mode,\n body: numerBody\n };\n }\n\n if (denomBody.length === 1 && denomBody[0].type === \"ordgroup\") {\n denomNode = denomBody[0];\n } else {\n denomNode = {\n type: \"ordgroup\",\n mode: this.mode,\n body: denomBody\n };\n }\n\n var _node;\n\n if (funcName === \"\\\\\\\\abovefrac\") {\n _node = this.callFunction(funcName, [numerNode, body[overIndex], denomNode], []);\n } else {\n _node = this.callFunction(funcName, [numerNode, denomNode], []);\n }\n\n return [_node];\n } else {\n return body;\n }\n } // The greediness of a superscript or subscript\n ;\n\n /**\n * Handle a subscript or superscript with nice errors.\n */\n _proto.handleSupSubscript = function handleSupSubscript(name) {\n var symbolToken = this.fetch();\n var symbol = symbolToken.text;\n this.consume();\n var group = this.parseGroup(name, false, Parser.SUPSUB_GREEDINESS, undefined, undefined, true); // ignore spaces before sup/subscript argument\n\n if (!group) {\n throw new src_ParseError(\"Expected group after '\" + symbol + \"'\", symbolToken);\n }\n\n return group;\n }\n /**\n * Converts the textual input of an unsupported command into a text node\n * contained within a color node whose color is determined by errorColor\n */\n ;\n\n _proto.formatUnsupportedCmd = function formatUnsupportedCmd(text) {\n var textordArray = [];\n\n for (var i = 0; i < text.length; i++) {\n textordArray.push({\n type: \"textord\",\n mode: \"text\",\n text: text[i]\n });\n }\n\n var textNode = {\n type: \"text\",\n mode: this.mode,\n body: textordArray\n };\n var colorNode = {\n type: \"color\",\n mode: this.mode,\n color: this.settings.errorColor,\n body: [textNode]\n };\n return colorNode;\n }\n /**\n * Parses a group with optional super/subscripts.\n */\n ;\n\n _proto.parseAtom = function parseAtom(breakOnTokenText) {\n // The body of an atom is an implicit group, so that things like\n // \\left(x\\right)^2 work correctly.\n var base = this.parseGroup(\"atom\", false, null, breakOnTokenText); // In text mode, we don't have superscripts or subscripts\n\n if (this.mode === \"text\") {\n return base;\n } // Note that base may be empty (i.e. null) at this point.\n\n\n var superscript;\n var subscript;\n\n while (true) {\n // Guaranteed in math mode, so eat any spaces first.\n this.consumeSpaces(); // Lex the first token\n\n var lex = this.fetch();\n\n if (lex.text === \"\\\\limits\" || lex.text === \"\\\\nolimits\") {\n // We got a limit control\n var opNode = checkNodeType(base, \"op\");\n\n if (opNode) {\n var limits = lex.text === \"\\\\limits\";\n opNode.limits = limits;\n opNode.alwaysHandleSupSub = true;\n } else {\n opNode = checkNodeType(base, \"operatorname\");\n\n if (opNode && opNode.alwaysHandleSupSub) {\n var _limits = lex.text === \"\\\\limits\";\n\n opNode.limits = _limits;\n } else {\n throw new src_ParseError(\"Limit controls must follow a math operator\", lex);\n }\n }\n\n this.consume();\n } else if (lex.text === \"^\") {\n // We got a superscript start\n if (superscript) {\n throw new src_ParseError(\"Double superscript\", lex);\n }\n\n superscript = this.handleSupSubscript(\"superscript\");\n } else if (lex.text === \"_\") {\n // We got a subscript start\n if (subscript) {\n throw new src_ParseError(\"Double subscript\", lex);\n }\n\n subscript = this.handleSupSubscript(\"subscript\");\n } else if (lex.text === \"'\") {\n // We got a prime\n if (superscript) {\n throw new src_ParseError(\"Double superscript\", lex);\n }\n\n var prime = {\n type: \"textord\",\n mode: this.mode,\n text: \"\\\\prime\"\n }; // Many primes can be grouped together, so we handle this here\n\n var primes = [prime];\n this.consume(); // Keep lexing tokens until we get something that's not a prime\n\n while (this.fetch().text === \"'\") {\n // For each one, add another prime to the list\n primes.push(prime);\n this.consume();\n } // If there's a superscript following the primes, combine that\n // superscript in with the primes.\n\n\n if (this.fetch().text === \"^\") {\n primes.push(this.handleSupSubscript(\"superscript\"));\n } // Put everything into an ordgroup as the superscript\n\n\n superscript = {\n type: \"ordgroup\",\n mode: this.mode,\n body: primes\n };\n } else {\n // If it wasn't ^, _, or ', stop parsing super/subscripts\n break;\n }\n } // Base must be set if superscript or subscript are set per logic above,\n // but need to check here for type check to pass.\n\n\n if (superscript || subscript) {\n // If we got either a superscript or subscript, create a supsub\n return {\n type: \"supsub\",\n mode: this.mode,\n base: base,\n sup: superscript,\n sub: subscript\n };\n } else {\n // Otherwise return the original body\n return base;\n }\n }\n /**\n * Parses an entire function, including its base and all of its arguments.\n */\n ;\n\n _proto.parseFunction = function parseFunction(breakOnTokenText, name, // For error reporting.\n greediness) {\n var token = this.fetch();\n var func = token.text;\n var funcData = src_functions[func];\n\n if (!funcData) {\n return null;\n }\n\n this.consume(); // consume command token\n\n if (greediness != null && funcData.greediness <= greediness) {\n throw new src_ParseError(\"Got function '\" + func + \"' with no arguments\" + (name ? \" as \" + name : \"\"), token);\n } else if (this.mode === \"text\" && !funcData.allowedInText) {\n throw new src_ParseError(\"Can't use function '\" + func + \"' in text mode\", token);\n } else if (this.mode === \"math\" && funcData.allowedInMath === false) {\n throw new src_ParseError(\"Can't use function '\" + func + \"' in math mode\", token);\n }\n\n var _this$parseArguments = this.parseArguments(func, funcData),\n args = _this$parseArguments.args,\n optArgs = _this$parseArguments.optArgs;\n\n return this.callFunction(func, args, optArgs, token, breakOnTokenText);\n }\n /**\n * Call a function handler with a suitable context and arguments.\n */\n ;\n\n _proto.callFunction = function callFunction(name, args, optArgs, token, breakOnTokenText) {\n var context = {\n funcName: name,\n parser: this,\n token: token,\n breakOnTokenText: breakOnTokenText\n };\n var func = src_functions[name];\n\n if (func && func.handler) {\n return func.handler(context, args, optArgs);\n } else {\n throw new src_ParseError(\"No function handler for \" + name);\n }\n }\n /**\n * Parses the arguments of a function or environment\n */\n ;\n\n _proto.parseArguments = function parseArguments(func, // Should look like \"\\name\" or \"\\begin{name}\".\n funcData) {\n var totalArgs = funcData.numArgs + funcData.numOptionalArgs;\n\n if (totalArgs === 0) {\n return {\n args: [],\n optArgs: []\n };\n }\n\n var baseGreediness = funcData.greediness;\n var args = [];\n var optArgs = [];\n\n for (var i = 0; i < totalArgs; i++) {\n var argType = funcData.argTypes && funcData.argTypes[i];\n var isOptional = i < funcData.numOptionalArgs; // Ignore spaces between arguments. As the TeXbook says:\n // \"After you have said ‘\\def\\row#1#2{...}’, you are allowed to\n // put spaces between the arguments (e.g., ‘\\row x n’), because\n // TeX doesn’t use single spaces as undelimited arguments.\"\n\n var consumeSpaces = i > 0 && !isOptional || // Also consume leading spaces in math mode, as parseSymbol\n // won't know what to do with them. This can only happen with\n // macros, e.g. \\frac\\foo\\foo where \\foo expands to a space symbol.\n // In LaTeX, the \\foo's get treated as (blank) arguments.\n // In KaTeX, for now, both spaces will get consumed.\n // TODO(edemaine)\n i === 0 && !isOptional && this.mode === \"math\";\n var arg = this.parseGroupOfType(\"argument to '\" + func + \"'\", argType, isOptional, baseGreediness, consumeSpaces);\n\n if (!arg) {\n if (isOptional) {\n optArgs.push(null);\n continue;\n }\n\n throw new src_ParseError(\"Expected group after '\" + func + \"'\", this.fetch());\n }\n\n (isOptional ? optArgs : args).push(arg);\n }\n\n return {\n args: args,\n optArgs: optArgs\n };\n }\n /**\n * Parses a group when the mode is changing.\n */\n ;\n\n _proto.parseGroupOfType = function parseGroupOfType(name, type, optional, greediness, consumeSpaces) {\n switch (type) {\n case \"color\":\n if (consumeSpaces) {\n this.consumeSpaces();\n }\n\n return this.parseColorGroup(optional);\n\n case \"size\":\n if (consumeSpaces) {\n this.consumeSpaces();\n }\n\n return this.parseSizeGroup(optional);\n\n case \"url\":\n return this.parseUrlGroup(optional, consumeSpaces);\n\n case \"math\":\n case \"text\":\n return this.parseGroup(name, optional, greediness, undefined, type, consumeSpaces);\n\n case \"hbox\":\n {\n // hbox argument type wraps the argument in the equivalent of\n // \\hbox, which is like \\text but switching to \\textstyle size.\n var group = this.parseGroup(name, optional, greediness, undefined, \"text\", consumeSpaces);\n\n if (!group) {\n return group;\n }\n\n var styledGroup = {\n type: \"styling\",\n mode: group.mode,\n body: [group],\n style: \"text\" // simulate \\textstyle\n\n };\n return styledGroup;\n }\n\n case \"raw\":\n {\n if (consumeSpaces) {\n this.consumeSpaces();\n }\n\n if (optional && this.fetch().text === \"{\") {\n return null;\n }\n\n var token = this.parseStringGroup(\"raw\", optional, true);\n\n if (token) {\n return {\n type: \"raw\",\n mode: \"text\",\n string: token.text\n };\n } else {\n throw new src_ParseError(\"Expected raw group\", this.fetch());\n }\n }\n\n case \"original\":\n case null:\n case undefined:\n return this.parseGroup(name, optional, greediness, undefined, undefined, consumeSpaces);\n\n default:\n throw new src_ParseError(\"Unknown group type as \" + name, this.fetch());\n }\n }\n /**\n * Discard any space tokens, fetching the next non-space token.\n */\n ;\n\n _proto.consumeSpaces = function consumeSpaces() {\n while (this.fetch().text === \" \") {\n this.consume();\n }\n }\n /**\n * Parses a group, essentially returning the string formed by the\n * brace-enclosed tokens plus some position information.\n */\n ;\n\n _proto.parseStringGroup = function parseStringGroup(modeName, // Used to describe the mode in error messages.\n optional, raw) {\n var groupBegin = optional ? \"[\" : \"{\";\n var groupEnd = optional ? \"]\" : \"}\";\n var beginToken = this.fetch();\n\n if (beginToken.text !== groupBegin) {\n if (optional) {\n return null;\n } else if (raw && beginToken.text !== \"EOF\" && /[^{}[\\]]/.test(beginToken.text)) {\n this.consume();\n return beginToken;\n }\n }\n\n var outerMode = this.mode;\n this.mode = \"text\";\n this.expect(groupBegin);\n var str = \"\";\n var firstToken = this.fetch();\n var nested = 0; // allow nested braces in raw string group\n\n var lastToken = firstToken;\n var nextToken;\n\n while ((nextToken = this.fetch()).text !== groupEnd || raw && nested > 0) {\n switch (nextToken.text) {\n case \"EOF\":\n throw new src_ParseError(\"Unexpected end of input in \" + modeName, firstToken.range(lastToken, str));\n\n case groupBegin:\n nested++;\n break;\n\n case groupEnd:\n nested--;\n break;\n }\n\n lastToken = nextToken;\n str += lastToken.text;\n this.consume();\n }\n\n this.expect(groupEnd);\n this.mode = outerMode;\n return firstToken.range(lastToken, str);\n }\n /**\n * Parses a regex-delimited group: the largest sequence of tokens\n * whose concatenated strings match `regex`. Returns the string\n * formed by the tokens plus some position information.\n */\n ;\n\n _proto.parseRegexGroup = function parseRegexGroup(regex, modeName) {\n var outerMode = this.mode;\n this.mode = \"text\";\n var firstToken = this.fetch();\n var lastToken = firstToken;\n var str = \"\";\n var nextToken;\n\n while ((nextToken = this.fetch()).text !== \"EOF\" && regex.test(str + nextToken.text)) {\n lastToken = nextToken;\n str += lastToken.text;\n this.consume();\n }\n\n if (str === \"\") {\n throw new src_ParseError(\"Invalid \" + modeName + \": '\" + firstToken.text + \"'\", firstToken);\n }\n\n this.mode = outerMode;\n return firstToken.range(lastToken, str);\n }\n /**\n * Parses a color description.\n */\n ;\n\n _proto.parseColorGroup = function parseColorGroup(optional) {\n var res = this.parseStringGroup(\"color\", optional);\n\n if (!res) {\n return null;\n }\n\n var match = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(res.text);\n\n if (!match) {\n throw new src_ParseError(\"Invalid color: '\" + res.text + \"'\", res);\n }\n\n var color = match[0];\n\n if (/^[0-9a-f]{6}$/i.test(color)) {\n // We allow a 6-digit HTML color spec without a leading \"#\".\n // This follows the xcolor package's HTML color model.\n // Predefined color names are all missed by this RegEx pattern.\n color = \"#\" + color;\n }\n\n return {\n type: \"color-token\",\n mode: this.mode,\n color: color\n };\n }\n /**\n * Parses a size specification, consisting of magnitude and unit.\n */\n ;\n\n _proto.parseSizeGroup = function parseSizeGroup(optional) {\n var res;\n var isBlank = false;\n\n if (!optional && this.fetch().text !== \"{\") {\n res = this.parseRegexGroup(/^[-+]? *(?:$|\\d+|\\d+\\.\\d*|\\.\\d*) *[a-z]{0,2} *$/, \"size\");\n } else {\n res = this.parseStringGroup(\"size\", optional);\n }\n\n if (!res) {\n return null;\n }\n\n if (!optional && res.text.length === 0) {\n // Because we've tested for what is !optional, this block won't\n // affect \\kern, \\hspace, etc. It will capture the mandatory arguments\n // to \\genfrac and \\above.\n res.text = \"0pt\"; // Enable \\above{}\n\n isBlank = true; // This is here specifically for \\genfrac\n }\n\n var match = /([-+]?) *(\\d+(?:\\.\\d*)?|\\.\\d+) *([a-z]{2})/.exec(res.text);\n\n if (!match) {\n throw new src_ParseError(\"Invalid size: '\" + res.text + \"'\", res);\n }\n\n var data = {\n number: +(match[1] + match[2]),\n // sign + magnitude, cast to number\n unit: match[3]\n };\n\n if (!validUnit(data)) {\n throw new src_ParseError(\"Invalid unit: '\" + data.unit + \"'\", res);\n }\n\n return {\n type: \"size\",\n mode: this.mode,\n value: data,\n isBlank: isBlank\n };\n }\n /**\n * Parses an URL, checking escaped letters and allowed protocols,\n * and setting the catcode of % as an active character (as in \\hyperref).\n */\n ;\n\n _proto.parseUrlGroup = function parseUrlGroup(optional, consumeSpaces) {\n this.gullet.lexer.setCatcode(\"%\", 13); // active character\n\n var res = this.parseStringGroup(\"url\", optional, true); // get raw string\n\n this.gullet.lexer.setCatcode(\"%\", 14); // comment character\n\n if (!res) {\n return null;\n } // hyperref package allows backslashes alone in href, but doesn't\n // generate valid links in such cases; we interpret this as\n // \"undefined\" behaviour, and keep them as-is. Some browser will\n // replace backslashes with forward slashes.\n\n\n var url = res.text.replace(/\\\\([#$%&~_^{}])/g, '$1');\n return {\n type: \"url\",\n mode: this.mode,\n url: url\n };\n }\n /**\n * If `optional` is false or absent, this parses an ordinary group,\n * which is either a single nucleus (like \"x\") or an expression\n * in braces (like \"{x+y}\") or an implicit group, a group that starts\n * at the current position, and ends right before a higher explicit\n * group ends, or at EOF.\n * If `optional` is true, it parses either a bracket-delimited expression\n * (like \"[x+y]\") or returns null to indicate the absence of a\n * bracket-enclosed group.\n * If `mode` is present, switches to that mode while parsing the group,\n * and switches back after.\n */\n ;\n\n _proto.parseGroup = function parseGroup(name, // For error reporting.\n optional, greediness, breakOnTokenText, mode, consumeSpaces) {\n // Switch to specified mode\n var outerMode = this.mode;\n\n if (mode) {\n this.switchMode(mode);\n } // Consume spaces if requested, crucially *after* we switch modes,\n // so that the next non-space token is parsed in the correct mode.\n\n\n if (consumeSpaces) {\n this.consumeSpaces();\n } // Get first token\n\n\n var firstToken = this.fetch();\n var text = firstToken.text;\n var result; // Try to parse an open brace or \\begingroup\n\n if (optional ? text === \"[\" : text === \"{\" || text === \"\\\\begingroup\") {\n this.consume();\n var groupEnd = Parser.endOfGroup[text]; // Start a new group namespace\n\n this.gullet.beginGroup(); // If we get a brace, parse an expression\n\n var expression = this.parseExpression(false, groupEnd);\n var lastToken = this.fetch(); // Check that we got a matching closing brace\n\n this.expect(groupEnd); // End group namespace\n\n this.gullet.endGroup();\n result = {\n type: \"ordgroup\",\n mode: this.mode,\n loc: SourceLocation.range(firstToken, lastToken),\n body: expression,\n // A group formed by \\begingroup...\\endgroup is a semi-simple group\n // which doesn't affect spacing in math mode, i.e., is transparent.\n // https://tex.stackexchange.com/questions/1930/when-should-one-\n // use-begingroup-instead-of-bgroup\n semisimple: text === \"\\\\begingroup\" || undefined\n };\n } else if (optional) {\n // Return nothing for an optional group\n result = null;\n } else {\n // If there exists a function with this name, parse the function.\n // Otherwise, just return a nucleus\n result = this.parseFunction(breakOnTokenText, name, greediness) || this.parseSymbol();\n\n if (result == null && text[0] === \"\\\\\" && !implicitCommands.hasOwnProperty(text)) {\n if (this.settings.throwOnError) {\n throw new src_ParseError(\"Undefined control sequence: \" + text, firstToken);\n }\n\n result = this.formatUnsupportedCmd(text);\n this.consume();\n }\n } // Switch mode back\n\n\n if (mode) {\n this.switchMode(outerMode);\n }\n\n return result;\n }\n /**\n * Form ligature-like combinations of characters for text mode.\n * This includes inputs like \"--\", \"---\", \"``\" and \"''\".\n * The result will simply replace multiple textord nodes with a single\n * character in each value by a single textord node having multiple\n * characters in its value. The representation is still ASCII source.\n * The group will be modified in place.\n */\n ;\n\n _proto.formLigatures = function formLigatures(group) {\n var n = group.length - 1;\n\n for (var i = 0; i < n; ++i) {\n var a = group[i]; // $FlowFixMe: Not every node type has a `text` property.\n\n var v = a.text;\n\n if (v === \"-\" && group[i + 1].text === \"-\") {\n if (i + 1 < n && group[i + 2].text === \"-\") {\n group.splice(i, 3, {\n type: \"textord\",\n mode: \"text\",\n loc: SourceLocation.range(a, group[i + 2]),\n text: \"---\"\n });\n n -= 2;\n } else {\n group.splice(i, 2, {\n type: \"textord\",\n mode: \"text\",\n loc: SourceLocation.range(a, group[i + 1]),\n text: \"--\"\n });\n n -= 1;\n }\n }\n\n if ((v === \"'\" || v === \"`\") && group[i + 1].text === v) {\n group.splice(i, 2, {\n type: \"textord\",\n mode: \"text\",\n loc: SourceLocation.range(a, group[i + 1]),\n text: v + v\n });\n n -= 1;\n }\n }\n }\n /**\n * Parse a single symbol out of the string. Here, we handle single character\n * symbols and special functions like \\verb.\n */\n ;\n\n _proto.parseSymbol = function parseSymbol() {\n var nucleus = this.fetch();\n var text = nucleus.text;\n\n if (/^\\\\verb[^a-zA-Z]/.test(text)) {\n this.consume();\n var arg = text.slice(5);\n var star = arg.charAt(0) === \"*\";\n\n if (star) {\n arg = arg.slice(1);\n } // Lexer's tokenRegex is constructed to always have matching\n // first/last characters.\n\n\n if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) {\n throw new src_ParseError(\"\\\\verb assertion failed --\\n please report what input caused this bug\");\n }\n\n arg = arg.slice(1, -1); // remove first and last char\n\n return {\n type: \"verb\",\n mode: \"text\",\n body: arg,\n star: star\n };\n } // At this point, we should have a symbol, possibly with accents.\n // First expand any accented base symbol according to unicodeSymbols.\n\n\n if (unicodeSymbols.hasOwnProperty(text[0]) && !src_symbols[this.mode][text[0]]) {\n // This behavior is not strict (XeTeX-compatible) in math mode.\n if (this.settings.strict && this.mode === \"math\") {\n this.settings.reportNonstrict(\"unicodeTextInMathMode\", \"Accented Unicode text character \\\"\" + text[0] + \"\\\" used in \" + \"math mode\", nucleus);\n }\n\n text = unicodeSymbols[text[0]] + text.substr(1);\n } // Strip off any combining characters\n\n\n var match = combiningDiacriticalMarksEndRegex.exec(text);\n\n if (match) {\n text = text.substring(0, match.index);\n\n if (text === 'i') {\n text = \"\\u0131\"; // dotless i, in math and text mode\n } else if (text === 'j') {\n text = \"\\u0237\"; // dotless j, in math and text mode\n }\n } // Recognize base symbol\n\n\n var symbol;\n\n if (src_symbols[this.mode][text]) {\n if (this.settings.strict && this.mode === 'math' && extraLatin.indexOf(text) >= 0) {\n this.settings.reportNonstrict(\"unicodeTextInMathMode\", \"Latin-1/Unicode text character \\\"\" + text[0] + \"\\\" used in \" + \"math mode\", nucleus);\n }\n\n var group = src_symbols[this.mode][text].group;\n var loc = SourceLocation.range(nucleus);\n var s;\n\n if (ATOMS.hasOwnProperty(group)) {\n // $FlowFixMe\n var family = group;\n s = {\n type: \"atom\",\n mode: this.mode,\n family: family,\n loc: loc,\n text: text\n };\n } else {\n // $FlowFixMe\n s = {\n type: group,\n mode: this.mode,\n loc: loc,\n text: text\n };\n }\n\n symbol = s;\n } else if (text.charCodeAt(0) >= 0x80) {\n // no symbol for e.g. ^\n if (this.settings.strict) {\n if (!supportedCodepoint(text.charCodeAt(0))) {\n this.settings.reportNonstrict(\"unknownSymbol\", \"Unrecognized Unicode character \\\"\" + text[0] + \"\\\"\" + (\" (\" + text.charCodeAt(0) + \")\"), nucleus);\n } else if (this.mode === \"math\") {\n this.settings.reportNonstrict(\"unicodeTextInMathMode\", \"Unicode text character \\\"\" + text[0] + \"\\\" used in math mode\", nucleus);\n }\n } // All nonmathematical Unicode characters are rendered as if they\n // are in text mode (wrapped in \\text) because that's what it\n // takes to render them in LaTeX. Setting `mode: this.mode` is\n // another natural choice (the user requested math mode), but\n // this makes it more difficult for getCharacterMetrics() to\n // distinguish Unicode characters without metrics and those for\n // which we want to simulate the letter M.\n\n\n symbol = {\n type: \"textord\",\n mode: \"text\",\n loc: SourceLocation.range(nucleus),\n text: text\n };\n } else {\n return null; // EOF, ^, _, {, }, etc.\n }\n\n this.consume(); // Transform combining characters into accents\n\n if (match) {\n for (var i = 0; i < match[0].length; i++) {\n var accent = match[0][i];\n\n if (!unicodeAccents[accent]) {\n throw new src_ParseError(\"Unknown accent ' \" + accent + \"'\", nucleus);\n }\n\n var command = unicodeAccents[accent][this.mode];\n\n if (!command) {\n throw new src_ParseError(\"Accent \" + accent + \" unsupported in \" + this.mode + \" mode\", nucleus);\n }\n\n symbol = {\n type: \"accent\",\n mode: this.mode,\n loc: SourceLocation.range(nucleus),\n label: command,\n isStretchy: false,\n isShifty: true,\n base: symbol\n };\n }\n }\n\n return symbol;\n };\n\n return Parser;\n}();\n\nParser_Parser.endOfExpression = [\"}\", \"\\\\endgroup\", \"\\\\end\", \"\\\\right\", \"&\"];\nParser_Parser.endOfGroup = {\n \"[\": \"]\",\n \"{\": \"}\",\n \"\\\\begingroup\": \"\\\\endgroup\"\n /**\n * Parses an \"expression\", which is a list of atoms.\n *\n * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This\n * happens when functions have higher precendence han infix\n * nodes in implicit parses.\n *\n * `breakOnTokenText`: The text of the token that the expression should end\n * with, or `null` if something else should end the\n * expression.\n */\n\n};\nParser_Parser.SUPSUB_GREEDINESS = 1;\n\n// CONCATENATED MODULE: ./src/parseTree.js\n/**\n * Provides a single function for parsing an expression using a Parser\n * TODO(emily): Remove this\n */\n\n\n\n/**\n * Parses an expression using a Parser, then returns the parsed result.\n */\nvar parseTree_parseTree = function parseTree(toParse, settings) {\n if (!(typeof toParse === 'string' || toParse instanceof String)) {\n throw new TypeError('KaTeX can only parse string typed expression');\n }\n\n var parser = new Parser_Parser(toParse, settings); // Blank out any \\df@tag to avoid spurious \"Duplicate \\tag\" errors\n\n delete parser.gullet.macros.current[\"\\\\df@tag\"];\n var tree = parser.parse(); // If the input used \\tag, it will set the \\df@tag macro to the tag.\n // In this case, we separately parse the tag and wrap the tree.\n\n if (parser.gullet.macros.get(\"\\\\df@tag\")) {\n if (!settings.displayMode) {\n throw new src_ParseError(\"\\\\tag works only in display equations\");\n }\n\n parser.gullet.feed(\"\\\\df@tag\");\n tree = [{\n type: \"tag\",\n mode: \"text\",\n body: tree,\n tag: parser.parse()\n }];\n }\n\n return tree;\n};\n\n/* harmony default export */ var src_parseTree = (parseTree_parseTree);\n// CONCATENATED MODULE: ./katex.js\n/* eslint no-console:0 */\n\n/**\n * This is the main entry point for KaTeX. Here, we expose functions for\n * rendering expressions either to DOM nodes or to markup strings.\n *\n * We also expose the ParseError class to check if errors thrown from KaTeX are\n * errors in the expression, or errors in javascript handling.\n */\n\n\n\n\n\n\n\n\n\n\n/**\n * Parse and build an expression, and place that expression in the DOM node\n * given.\n */\nvar katex_render = function render(expression, baseNode, options) {\n baseNode.textContent = \"\";\n var node = katex_renderToDomTree(expression, options).toNode();\n baseNode.appendChild(node);\n}; // KaTeX's styles don't work properly in quirks mode. Print out an error, and\n// disable rendering.\n\n\nif (typeof document !== \"undefined\") {\n if (document.compatMode !== \"CSS1Compat\") {\n typeof console !== \"undefined\" && console.warn(\"Warning: KaTeX doesn't work in quirks mode. Make sure your \" + \"website has a suitable doctype.\");\n\n katex_render = function render() {\n throw new src_ParseError(\"KaTeX doesn't work in quirks mode.\");\n };\n }\n}\n/**\n * Parse and build an expression, and return the markup for that.\n */\n\n\nvar renderToString = function renderToString(expression, options) {\n var markup = katex_renderToDomTree(expression, options).toMarkup();\n return markup;\n};\n/**\n * Parse an expression and return the parse tree.\n */\n\n\nvar katex_generateParseTree = function generateParseTree(expression, options) {\n var settings = new Settings_Settings(options);\n return src_parseTree(expression, settings);\n};\n/**\n * If the given error is a KaTeX ParseError and options.throwOnError is false,\n * renders the invalid LaTeX as a span with hover title giving the KaTeX\n * error message. Otherwise, simply throws the error.\n */\n\n\nvar katex_renderError = function renderError(error, expression, options) {\n if (options.throwOnError || !(error instanceof src_ParseError)) {\n throw error;\n }\n\n var node = buildCommon.makeSpan([\"katex-error\"], [new domTree_SymbolNode(expression)]);\n node.setAttribute(\"title\", error.toString());\n node.setAttribute(\"style\", \"color:\" + options.errorColor);\n return node;\n};\n/**\n * Generates and returns the katex build tree. This is used for advanced\n * use cases (like rendering to custom output).\n */\n\n\nvar katex_renderToDomTree = function renderToDomTree(expression, options) {\n var settings = new Settings_Settings(options);\n\n try {\n var tree = src_parseTree(expression, settings);\n return buildTree_buildTree(tree, expression, settings);\n } catch (error) {\n return katex_renderError(error, expression, settings);\n }\n};\n/**\n * Generates and returns the katex build tree, with just HTML (no MathML).\n * This is used for advanced use cases (like rendering to custom output).\n */\n\n\nvar katex_renderToHTMLTree = function renderToHTMLTree(expression, options) {\n var settings = new Settings_Settings(options);\n\n try {\n var tree = src_parseTree(expression, settings);\n return buildTree_buildHTMLTree(tree, expression, settings);\n } catch (error) {\n return katex_renderError(error, expression, settings);\n }\n};\n\n/* harmony default export */ var katex_0 = ({\n /**\n * Current KaTeX version\n */\n version: \"0.11.1\",\n\n /**\n * Renders the given LaTeX into an HTML+MathML combination, and adds\n * it as a child to the specified DOM node.\n */\n render: katex_render,\n\n /**\n * Renders the given LaTeX into an HTML+MathML combination string,\n * for sending to the client.\n */\n renderToString: renderToString,\n\n /**\n * KaTeX error, usually during parsing.\n */\n ParseError: src_ParseError,\n\n /**\n * Parses the given LaTeX into KaTeX's internal parse tree structure,\n * without rendering to HTML or MathML.\n *\n * NOTE: This method is not currently recommended for public use.\n * The internal tree representation is unstable and is very likely\n * to change. Use at your own risk.\n */\n __parse: katex_generateParseTree,\n\n /**\n * Renders the given LaTeX into an HTML+MathML internal DOM tree\n * representation, without flattening that representation to a string.\n *\n * NOTE: This method is not currently recommended for public use.\n * The internal tree representation is unstable and is very likely\n * to change. Use at your own risk.\n */\n __renderToDomTree: katex_renderToDomTree,\n\n /**\n * Renders the given LaTeX into an HTML internal DOM tree representation,\n * without MathML and without flattening that representation to a string.\n *\n * NOTE: This method is not currently recommended for public use.\n * The internal tree representation is unstable and is very likely\n * to change. Use at your own risk.\n */\n __renderToHTMLTree: katex_renderToHTMLTree,\n\n /**\n * extends internal font metrics object with a new object\n * each key in the new object represents a font name\n */\n __setFontMetrics: setFontMetrics,\n\n /**\n * adds a new symbol to builtin symbols table\n */\n __defineSymbol: defineSymbol,\n\n /**\n * adds a new macro to builtin macro list\n */\n __defineMacro: defineMacro,\n\n /**\n * Expose the dom tree node types, which can be useful for type checking nodes.\n *\n * NOTE: This method is not currently recommended for public use.\n * The internal tree representation is unstable and is very likely\n * to change. Use at your own risk.\n */\n __domTree: {\n Span: domTree_Span,\n Anchor: domTree_Anchor,\n SymbolNode: domTree_SymbolNode,\n SvgNode: SvgNode,\n PathNode: domTree_PathNode,\n LineNode: LineNode\n }\n});\n// CONCATENATED MODULE: ./katex.webpack.js\n/**\n * This is the webpack entry point for KaTeX. As ECMAScript, flow[1] and jest[2]\n * doesn't support CSS modules natively, a separate entry point is used and\n * it is not flowtyped.\n *\n * [1] https://gist.github.com/lambdahands/d19e0da96285b749f0ef\n * [2] https://facebook.github.io/jest/docs/en/webpack.html\n */\n\n\n/* harmony default export */ var katex_webpack = __webpack_exports__[\"default\"] = (katex_0);\n\n/***/ })\n/******/ ])[\"default\"];\n});","/**\n * This is a straight rip-off of the React.js ReactPropTypes.js proptype validators,\n * modified to make it possible to validate Immutable.js data.\n * ImmutableTypes.listOf is patterned after React.PropTypes.arrayOf, but for Immutable.List\n * ImmutableTypes.shape is based on React.PropTypes.shape, but for any Immutable.Iterable\n */\n\"use strict\";\n\nvar Immutable = require(\"immutable\");\n\nvar ANONYMOUS = \"<>\";\n\nvar ImmutablePropTypes;\n\nif (process.env.NODE_ENV !== \"production\") {\n ImmutablePropTypes = {\n listOf: createListOfTypeChecker,\n mapOf: createMapOfTypeChecker,\n orderedMapOf: createOrderedMapOfTypeChecker,\n setOf: createSetOfTypeChecker,\n orderedSetOf: createOrderedSetOfTypeChecker,\n stackOf: createStackOfTypeChecker,\n iterableOf: createIterableOfTypeChecker,\n recordOf: createRecordOfTypeChecker,\n shape: createShapeChecker,\n contains: createShapeChecker,\n mapContains: createMapContainsChecker,\n orderedMapContains: createOrderedMapContainsChecker,\n // Primitive Types\n list: createImmutableTypeChecker(\"List\", Immutable.List.isList),\n map: createImmutableTypeChecker(\"Map\", Immutable.Map.isMap),\n orderedMap: createImmutableTypeChecker(\"OrderedMap\", Immutable.OrderedMap.isOrderedMap),\n set: createImmutableTypeChecker(\"Set\", Immutable.Set.isSet),\n orderedSet: createImmutableTypeChecker(\"OrderedSet\", Immutable.OrderedSet.isOrderedSet),\n stack: createImmutableTypeChecker(\"Stack\", Immutable.Stack.isStack),\n seq: createImmutableTypeChecker(\"Seq\", Immutable.Seq.isSeq),\n record: createImmutableTypeChecker(\"Record\", function (isRecord) {\n return isRecord instanceof Immutable.Record;\n }),\n iterable: createImmutableTypeChecker(\"Iterable\", Immutable.Iterable.isIterable)\n };\n} else {\n var productionTypeChecker = function productionTypeChecker() {\n invariant(false, \"ImmutablePropTypes type checking code is stripped in production.\");\n };\n productionTypeChecker.isRequired = productionTypeChecker;\n var getProductionTypeChecker = function getProductionTypeChecker() {\n return productionTypeChecker;\n };\n\n ImmutablePropTypes = {\n listOf: getProductionTypeChecker,\n mapOf: getProductionTypeChecker,\n orderedMapOf: getProductionTypeChecker,\n setOf: getProductionTypeChecker,\n orderedSetOf: getProductionTypeChecker,\n stackOf: getProductionTypeChecker,\n iterableOf: getProductionTypeChecker,\n recordOf: getProductionTypeChecker,\n shape: getProductionTypeChecker,\n contains: getProductionTypeChecker,\n mapContains: getProductionTypeChecker,\n orderedMapContains: getProductionTypeChecker,\n // Primitive Types\n list: productionTypeChecker,\n map: productionTypeChecker,\n orderedMap: productionTypeChecker,\n set: productionTypeChecker,\n orderedSet: productionTypeChecker,\n stack: productionTypeChecker,\n seq: productionTypeChecker,\n record: productionTypeChecker,\n iterable: productionTypeChecker\n };\n}\n\nImmutablePropTypes.iterable.indexed = createIterableSubclassTypeChecker(\"Indexed\", Immutable.Iterable.isIndexed);\nImmutablePropTypes.iterable.keyed = createIterableSubclassTypeChecker(\"Keyed\", Immutable.Iterable.isKeyed);\n\nfunction getPropType(propValue) {\n var propType = typeof propValue;\n if (Array.isArray(propValue)) {\n return \"array\";\n }\n if (propValue instanceof RegExp) {\n // Old webkits (at least until Android 4.0) return 'function' rather than\n // 'object' for typeof a RegExp. We'll normalize this here so that /bla/\n // passes PropTypes.object.\n return \"object\";\n }\n if (propValue instanceof Immutable.Iterable) {\n return \"Immutable.\" + propValue.toSource().split(\" \")[0];\n }\n return propType;\n}\n\nfunction createChainableTypeChecker(validate) {\n function checkType(isRequired, props, propName, componentName, location, propFullName) {\n for (var _len = arguments.length, rest = Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++) {\n rest[_key - 6] = arguments[_key];\n }\n\n propFullName = propFullName || propName;\n componentName = componentName || ANONYMOUS;\n if (props[propName] == null) {\n var locationName = location;\n if (isRequired) {\n return new Error(\"Required \" + locationName + \" `\" + propFullName + \"` was not specified in \" + (\"`\" + componentName + \"`.\"));\n }\n } else {\n return validate.apply(undefined, [props, propName, componentName, location, propFullName].concat(rest));\n }\n }\n\n var chainedCheckType = checkType.bind(null, false);\n chainedCheckType.isRequired = checkType.bind(null, true);\n\n return chainedCheckType;\n}\n\nfunction createImmutableTypeChecker(immutableClassName, immutableClassTypeValidator) {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n if (!immutableClassTypeValidator(propValue)) {\n var propType = getPropType(propValue);\n return new Error(\"Invalid \" + location + \" `\" + propFullName + \"` of type `\" + propType + \"` \" + (\"supplied to `\" + componentName + \"`, expected `\" + immutableClassName + \"`.\"));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n}\n\nfunction createIterableSubclassTypeChecker(subclassName, validator) {\n return createImmutableTypeChecker(\"Iterable.\" + subclassName, function (propValue) {\n return Immutable.Iterable.isIterable(propValue) && validator(propValue);\n });\n}\n\nfunction createIterableTypeChecker(typeChecker, immutableClassName, immutableClassTypeValidator) {\n\n function validate(props, propName, componentName, location, propFullName) {\n for (var _len = arguments.length, rest = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {\n rest[_key - 5] = arguments[_key];\n }\n\n var propValue = props[propName];\n if (!immutableClassTypeValidator(propValue)) {\n var locationName = location;\n var propType = getPropType(propValue);\n return new Error(\"Invalid \" + locationName + \" `\" + propFullName + \"` of type \" + (\"`\" + propType + \"` supplied to `\" + componentName + \"`, expected an Immutable.js \" + immutableClassName + \".\"));\n }\n\n if (typeof typeChecker !== \"function\") {\n return new Error(\"Invalid typeChecker supplied to `\" + componentName + \"` \" + (\"for propType `\" + propFullName + \"`, expected a function.\"));\n }\n\n var propValues = propValue.valueSeq().toArray();\n for (var i = 0, len = propValues.length; i < len; i++) {\n var error = typeChecker.apply(undefined, [propValues, i, componentName, location, \"\" + propFullName + \"[\" + i + \"]\"].concat(rest));\n if (error instanceof Error) {\n return error;\n }\n }\n }\n return createChainableTypeChecker(validate);\n}\n\nfunction createKeysTypeChecker(typeChecker) {\n\n function validate(props, propName, componentName, location, propFullName) {\n for (var _len = arguments.length, rest = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {\n rest[_key - 5] = arguments[_key];\n }\n\n var propValue = props[propName];\n if (typeof typeChecker !== \"function\") {\n return new Error(\"Invalid keysTypeChecker (optional second argument) supplied to `\" + componentName + \"` \" + (\"for propType `\" + propFullName + \"`, expected a function.\"));\n }\n\n var keys = propValue.keySeq().toArray();\n for (var i = 0, len = keys.length; i < len; i++) {\n var error = typeChecker.apply(undefined, [keys, i, componentName, location, \"\" + propFullName + \" -> key(\" + keys[i] + \")\"].concat(rest));\n if (error instanceof Error) {\n return error;\n }\n }\n }\n return createChainableTypeChecker(validate);\n}\n\nfunction createListOfTypeChecker(typeChecker) {\n return createIterableTypeChecker(typeChecker, \"List\", Immutable.List.isList);\n}\n\nfunction createMapOfTypeCheckerFactory(valuesTypeChecker, keysTypeChecker, immutableClassName, immutableClassTypeValidator) {\n function validate() {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return createIterableTypeChecker(valuesTypeChecker, immutableClassName, immutableClassTypeValidator).apply(undefined, args) || keysTypeChecker && createKeysTypeChecker(keysTypeChecker).apply(undefined, args);\n }\n\n return createChainableTypeChecker(validate);\n}\n\nfunction createMapOfTypeChecker(valuesTypeChecker, keysTypeChecker) {\n return createMapOfTypeCheckerFactory(valuesTypeChecker, keysTypeChecker, \"Map\", Immutable.Map.isMap);\n}\n\nfunction createOrderedMapOfTypeChecker(valuesTypeChecker, keysTypeChecker) {\n return createMapOfTypeCheckerFactory(valuesTypeChecker, keysTypeChecker, \"OrderedMap\", Immutable.OrderedMap.isOrderedMap);\n}\n\nfunction createSetOfTypeChecker(typeChecker) {\n return createIterableTypeChecker(typeChecker, \"Set\", Immutable.Set.isSet);\n}\n\nfunction createOrderedSetOfTypeChecker(typeChecker) {\n return createIterableTypeChecker(typeChecker, \"OrderedSet\", Immutable.OrderedSet.isOrderedSet);\n}\n\nfunction createStackOfTypeChecker(typeChecker) {\n return createIterableTypeChecker(typeChecker, \"Stack\", Immutable.Stack.isStack);\n}\n\nfunction createIterableOfTypeChecker(typeChecker) {\n return createIterableTypeChecker(typeChecker, \"Iterable\", Immutable.Iterable.isIterable);\n}\n\nfunction createRecordOfTypeChecker(recordKeys) {\n function validate(props, propName, componentName, location, propFullName) {\n for (var _len = arguments.length, rest = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {\n rest[_key - 5] = arguments[_key];\n }\n\n var propValue = props[propName];\n if (!(propValue instanceof Immutable.Record)) {\n var propType = getPropType(propValue);\n var locationName = location;\n return new Error(\"Invalid \" + locationName + \" `\" + propFullName + \"` of type `\" + propType + \"` \" + (\"supplied to `\" + componentName + \"`, expected an Immutable.js Record.\"));\n }\n for (var key in recordKeys) {\n var checker = recordKeys[key];\n if (!checker) {\n continue;\n }\n var mutablePropValue = propValue.toObject();\n var error = checker.apply(undefined, [mutablePropValue, key, componentName, location, \"\" + propFullName + \".\" + key].concat(rest));\n if (error) {\n return error;\n }\n }\n }\n return createChainableTypeChecker(validate);\n}\n\n// there is some irony in the fact that shapeTypes is a standard hash and not an immutable collection\nfunction createShapeTypeChecker(shapeTypes) {\n var immutableClassName = arguments[1] === undefined ? \"Iterable\" : arguments[1];\n var immutableClassTypeValidator = arguments[2] === undefined ? Immutable.Iterable.isIterable : arguments[2];\n\n function validate(props, propName, componentName, location, propFullName) {\n for (var _len = arguments.length, rest = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {\n rest[_key - 5] = arguments[_key];\n }\n\n var propValue = props[propName];\n if (!immutableClassTypeValidator(propValue)) {\n var propType = getPropType(propValue);\n var locationName = location;\n return new Error(\"Invalid \" + locationName + \" `\" + propFullName + \"` of type `\" + propType + \"` \" + (\"supplied to `\" + componentName + \"`, expected an Immutable.js \" + immutableClassName + \".\"));\n }\n var mutablePropValue = propValue.toObject();\n for (var key in shapeTypes) {\n var checker = shapeTypes[key];\n if (!checker) {\n continue;\n }\n var error = checker.apply(undefined, [mutablePropValue, key, componentName, location, \"\" + propFullName + \".\" + key].concat(rest));\n if (error) {\n return error;\n }\n }\n }\n return createChainableTypeChecker(validate);\n}\n\nfunction createShapeChecker(shapeTypes) {\n return createShapeTypeChecker(shapeTypes);\n}\n\nfunction createMapContainsChecker(shapeTypes) {\n return createShapeTypeChecker(shapeTypes, \"Map\", Immutable.Map.isMap);\n}\n\nfunction createOrderedMapContainsChecker(shapeTypes) {\n return createShapeTypeChecker(shapeTypes, \"OrderedMap\", Immutable.OrderedMap.isOrderedMap);\n}\n\nmodule.exports = ImmutablePropTypes;","\"use strict\";\n\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\nfunction setup(env) {\n createDebug.debug = createDebug;\n createDebug.default = createDebug;\n createDebug.coerce = coerce;\n createDebug.disable = disable;\n createDebug.enable = enable;\n createDebug.enabled = enabled;\n createDebug.humanize = require('ms');\n Object.keys(env).forEach(function (key) {\n createDebug[key] = env[key];\n });\n /**\n * Active `debug` instances.\n */\n\n createDebug.instances = [];\n /**\n * The currently active debug mode names, and names to skip.\n */\n\n createDebug.names = [];\n createDebug.skips = [];\n /**\n * Map of special \"%n\" handling functions, for the debug \"format\" argument.\n *\n * Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n */\n\n createDebug.formatters = {};\n /**\n * Selects a color for a debug namespace\n * @param {String} namespace The namespace string for the for the debug instance to be colored\n * @return {Number|String} An ANSI color code for the given namespace\n * @api private\n */\n\n function selectColor(namespace) {\n var hash = 0;\n\n for (var i = 0; i < namespace.length; i++) {\n hash = (hash << 5) - hash + namespace.charCodeAt(i);\n hash |= 0; // Convert to 32bit integer\n }\n\n return createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n }\n\n createDebug.selectColor = selectColor;\n /**\n * Create a debugger with the given `namespace`.\n *\n * @param {String} namespace\n * @return {Function}\n * @api public\n */\n\n function createDebug(namespace) {\n var prevTime;\n\n function debug() {\n // Disabled?\n if (!debug.enabled) {\n return;\n }\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var self = debug; // Set `diff` timestamp\n\n var curr = Number(new Date());\n var ms = curr - (prevTime || curr);\n self.diff = ms;\n self.prev = prevTime;\n self.curr = curr;\n prevTime = curr;\n args[0] = createDebug.coerce(args[0]);\n\n if (typeof args[0] !== 'string') {\n // Anything else let's inspect with %O\n args.unshift('%O');\n } // Apply any `formatters` transformations\n\n\n var index = 0;\n args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {\n // If we encounter an escaped % then don't increase the array index\n if (match === '%%') {\n return match;\n }\n\n index++;\n var formatter = createDebug.formatters[format];\n\n if (typeof formatter === 'function') {\n var val = args[index];\n match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`\n\n args.splice(index, 1);\n index--;\n }\n\n return match;\n }); // Apply env-specific formatting (colors, etc.)\n\n createDebug.formatArgs.call(self, args);\n var logFn = self.log || createDebug.log;\n logFn.apply(self, args);\n }\n\n debug.namespace = namespace;\n debug.enabled = createDebug.enabled(namespace);\n debug.useColors = createDebug.useColors();\n debug.color = selectColor(namespace);\n debug.destroy = destroy;\n debug.extend = extend; // Debug.formatArgs = formatArgs;\n // debug.rawLog = rawLog;\n // env-specific initialization logic for debug instances\n\n if (typeof createDebug.init === 'function') {\n createDebug.init(debug);\n }\n\n createDebug.instances.push(debug);\n return debug;\n }\n\n function destroy() {\n var index = createDebug.instances.indexOf(this);\n\n if (index !== -1) {\n createDebug.instances.splice(index, 1);\n return true;\n }\n\n return false;\n }\n\n function extend(namespace, delimiter) {\n return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n }\n /**\n * Enables a debug mode by namespaces. This can include modes\n * separated by a colon and wildcards.\n *\n * @param {String} namespaces\n * @api public\n */\n\n\n function enable(namespaces) {\n createDebug.save(namespaces);\n createDebug.names = [];\n createDebug.skips = [];\n var i;\n var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n var len = split.length;\n\n for (i = 0; i < len; i++) {\n if (!split[i]) {\n // ignore empty strings\n continue;\n }\n\n namespaces = split[i].replace(/\\*/g, '.*?');\n\n if (namespaces[0] === '-') {\n createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n } else {\n createDebug.names.push(new RegExp('^' + namespaces + '$'));\n }\n }\n\n for (i = 0; i < createDebug.instances.length; i++) {\n var instance = createDebug.instances[i];\n instance.enabled = createDebug.enabled(instance.namespace);\n }\n }\n /**\n * Disable debug output.\n *\n * @api public\n */\n\n\n function disable() {\n createDebug.enable('');\n }\n /**\n * Returns true if the given mode name is enabled, false otherwise.\n *\n * @param {String} name\n * @return {Boolean}\n * @api public\n */\n\n\n function enabled(name) {\n if (name[name.length - 1] === '*') {\n return true;\n }\n\n var i;\n var len;\n\n for (i = 0, len = createDebug.skips.length; i < len; i++) {\n if (createDebug.skips[i].test(name)) {\n return false;\n }\n }\n\n for (i = 0, len = createDebug.names.length; i < len; i++) {\n if (createDebug.names[i].test(name)) {\n return true;\n }\n }\n\n return false;\n }\n /**\n * Coerce `val`.\n *\n * @param {Mixed} val\n * @return {Mixed}\n * @api private\n */\n\n\n function coerce(val) {\n if (val instanceof Error) {\n return val.stack || val.message;\n }\n\n return val;\n }\n\n createDebug.enable(createDebug.load());\n return createDebug;\n}\n\nmodule.exports = setup;\n\n","\"use strict\";\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\n/**\n * Colors.\n */\n\nexports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n// eslint-disable-next-line complexity\n\nfunction useColors() {\n // NB: In an Electron preload script, document will be defined but not fully\n // initialized. Since we know we're in Chrome, we'll just detect this case\n // explicitly\n if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n return true;\n } // Internet Explorer and Edge do not support colors.\n\n\n if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n return false;\n } // Is webkit? http://stackoverflow.com/a/16459606/376773\n // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\n\n return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773\n typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?\n // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker\n typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/);\n}\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\n\nfunction formatArgs(args) {\n args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);\n\n if (!this.useColors) {\n return;\n }\n\n var c = 'color: ' + this.color;\n args.splice(1, 0, c, 'color: inherit'); // The final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n\n var index = 0;\n var lastC = 0;\n args[0].replace(/%[a-zA-Z%]/g, function (match) {\n if (match === '%%') {\n return;\n }\n\n index++;\n\n if (match === '%c') {\n // We only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index;\n }\n });\n args.splice(lastC, 0, c);\n}\n/**\n * Invokes `console.log()` when available.\n * No-op when `console.log` is not a \"function\".\n *\n * @api public\n */\n\n\nfunction log() {\n var _console;\n\n // This hackery is required for IE8/9, where\n // the `console.log` function doesn't have 'apply'\n return (typeof console === \"undefined\" ? \"undefined\" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);\n}\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\n\n\nfunction save(namespaces) {\n try {\n if (namespaces) {\n exports.storage.setItem('debug', namespaces);\n } else {\n exports.storage.removeItem('debug');\n }\n } catch (error) {// Swallow\n // XXX (@Qix-) should we be logging these?\n }\n}\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\n\n\nfunction load() {\n var r;\n\n try {\n r = exports.storage.getItem('debug');\n } catch (error) {} // Swallow\n // XXX (@Qix-) should we be logging these?\n // If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\n\n if (!r && typeof process !== 'undefined' && 'env' in process) {\n r = process.env.DEBUG;\n }\n\n return r;\n}\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\n\nfunction localstorage() {\n try {\n // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n // The Browser also has localStorage in the global context.\n return localStorage;\n } catch (error) {// Swallow\n // XXX (@Qix-) should we be logging these?\n }\n}\n\nmodule.exports = require('./common')(exports);\nvar formatters = module.exports.formatters;\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n try {\n return JSON.stringify(v);\n } catch (error) {\n return '[UnexpectedJSONParseError]: ' + error.message;\n }\n};\n\n","var isProduction = process.env.NODE_ENV === 'production';\nvar index = (function (condition, message) {\n if (!isProduction) {\n if (condition) {\n return;\n }\n\n console.warn(message);\n }\n});\n\nexport default index;\n","\n/**\n * Module exports.\n */\n\nmodule.exports = getDocument;\n\n// defined by w3c\nvar DOCUMENT_NODE = 9;\n\n/**\n * Returns `true` if `w` is a Document object, or `false` otherwise.\n *\n * @param {?} d - Document object, maybe\n * @return {Boolean}\n * @private\n */\n\nfunction isDocument (d) {\n return d && d.nodeType === DOCUMENT_NODE;\n}\n\n/**\n * Returns the `document` object associated with the given `node`, which may be\n * a DOM element, the Window object, a Selection, a Range. Basically any DOM\n * object that references the Document in some way, this function will find it.\n *\n * @param {Mixed} node - DOM node, selection, or range in which to find the `document` object\n * @return {Document} the `document` object associated with `node`\n * @public\n */\n\nfunction getDocument(node) {\n if (isDocument(node)) {\n return node;\n\n } else if (isDocument(node.ownerDocument)) {\n return node.ownerDocument;\n\n } else if (isDocument(node.document)) {\n return node.document;\n\n } else if (node.parentNode) {\n return getDocument(node.parentNode);\n\n // Range support\n } else if (node.commonAncestorContainer) {\n return getDocument(node.commonAncestorContainer);\n\n } else if (node.startContainer) {\n return getDocument(node.startContainer);\n\n // Selection support\n } else if (node.anchorNode) {\n return getDocument(node.anchorNode);\n }\n}\n","// this is a browser-only module. There is a non-browser equivalent in the same\n// directory. This is done using a `package.json` browser field.\n// old-IE fallback logic: http://stackoverflow.com/a/10260692\nmodule.exports = !!document.attachEvent && window !== document.parentWindow;\n","\n/**\n * Module dependencies.\n */\n\nvar getDocument = require('get-document');\n\n/**\n * Module exports.\n */\n\nmodule.exports = getWindow;\n\nvar needsIEFallback = require('./needs-ie-fallback');\n\n/**\n * Returns `true` if `w` is a Window object, or `false` otherwise.\n *\n * @param {Mixed} w - Window object, maybe\n * @return {Boolean}\n * @private\n */\n\nfunction isWindow (w) {\n return w && w.window === w;\n}\n\n/**\n * Returns the `window` object associated with the given `node`, which may be\n * a DOM element, the Window object, a Selection, a Range. Basically any DOM\n * object that references the Window in some way, this function will find it.\n *\n * @param {Mixed} node - DOM node, selection, or range in which to find the `window` object\n * @return {Window} the `window` object associated with `node`\n * @public\n */\n\nfunction getWindow(node) {\n if (isWindow(node)) {\n return node;\n }\n\n var doc = getDocument(node);\n\n if (needsIEFallback) {\n // In IE 6-8, only the variable 'window' can be used to connect events (others\n // may be only copies).\n doc.parentWindow.execScript('document._parentWindow = window;', 'Javascript');\n var win = doc._parentWindow;\n // to prevent memory leak, unset it after use\n // another possibility is to add an onUnload handler,\n // (which seems overkill to @liucougar)\n doc._parentWindow = null;\n return win;\n } else {\n // standards-compliant and newer IE\n return doc.defaultView || doc.parentWindow;\n }\n}\n","function isBackward(selection) {\n var startNode = selection.anchorNode;\n var startOffset = selection.anchorOffset;\n var endNode = selection.focusNode;\n var endOffset = selection.focusOffset;\n\n var position = startNode.compareDocumentPosition(endNode);\n\n return !(position === 4 || (position === 0 && startOffset < endOffset));\n}\n\nmodule.exports = isBackward;\n","var _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nexport var isBrowser = (typeof window === \"undefined\" ? \"undefined\" : _typeof(window)) === \"object\" && (typeof document === \"undefined\" ? \"undefined\" : _typeof(document)) === 'object' && document.nodeType === 9;\n\nexport default isBrowser;\n","var root = require('./_root');\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nmodule.exports = now;\n","var isObject = require('./isObject'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n","var isObject = require('./isObject'),\n now = require('./now'),\n toNumber = require('./toNumber');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nmodule.exports = debounce;\n","var debounce = require('./debounce'),\n isObject = require('./isObject');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\nmodule.exports = throttle;\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\n/**\n * Constants.\n */\n\nvar IS_MAC = typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);\n\nvar MODIFIERS = {\n alt: 'altKey',\n control: 'ctrlKey',\n meta: 'metaKey',\n shift: 'shiftKey'\n};\n\nvar ALIASES = {\n add: '+',\n break: 'pause',\n cmd: 'meta',\n command: 'meta',\n ctl: 'control',\n ctrl: 'control',\n del: 'delete',\n down: 'arrowdown',\n esc: 'escape',\n ins: 'insert',\n left: 'arrowleft',\n mod: IS_MAC ? 'meta' : 'control',\n opt: 'alt',\n option: 'alt',\n return: 'enter',\n right: 'arrowright',\n space: ' ',\n spacebar: ' ',\n up: 'arrowup',\n win: 'meta',\n windows: 'meta'\n};\n\nvar CODES = {\n backspace: 8,\n tab: 9,\n enter: 13,\n shift: 16,\n control: 17,\n alt: 18,\n pause: 19,\n capslock: 20,\n escape: 27,\n ' ': 32,\n pageup: 33,\n pagedown: 34,\n end: 35,\n home: 36,\n arrowleft: 37,\n arrowup: 38,\n arrowright: 39,\n arrowdown: 40,\n insert: 45,\n delete: 46,\n meta: 91,\n numlock: 144,\n scrolllock: 145,\n ';': 186,\n '=': 187,\n ',': 188,\n '-': 189,\n '.': 190,\n '/': 191,\n '`': 192,\n '[': 219,\n '\\\\': 220,\n ']': 221,\n '\\'': 222\n};\n\nfor (var f = 1; f < 20; f++) {\n CODES['f' + f] = 111 + f;\n}\n\n/**\n * Is hotkey?\n */\n\nfunction isHotkey(hotkey, options, event) {\n if (options && !('byKey' in options)) {\n event = options;\n options = null;\n }\n\n if (!Array.isArray(hotkey)) {\n hotkey = [hotkey];\n }\n\n var array = hotkey.map(function (string) {\n return parseHotkey(string, options);\n });\n var check = function check(e) {\n return array.some(function (object) {\n return compareHotkey(object, e);\n });\n };\n var ret = event == null ? check : check(event);\n return ret;\n}\n\nfunction isCodeHotkey(hotkey, event) {\n return isHotkey(hotkey, event);\n}\n\nfunction isKeyHotkey(hotkey, event) {\n return isHotkey(hotkey, { byKey: true }, event);\n}\n\n/**\n * Parse.\n */\n\nfunction parseHotkey(hotkey, options) {\n var byKey = options && options.byKey;\n var ret = {};\n\n // Special case to handle the `+` key since we use it as a separator.\n hotkey = hotkey.replace('++', '+add');\n var values = hotkey.split('+');\n var length = values.length;\n\n // Ensure that all the modifiers are set to false unless the hotkey has them.\n\n for (var k in MODIFIERS) {\n ret[MODIFIERS[k]] = false;\n }\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var value = _step.value;\n\n var optional = value.endsWith('?');\n\n if (optional) {\n value = value.slice(0, -1);\n }\n\n var name = toKeyName(value);\n var modifier = MODIFIERS[name];\n\n if (length === 1 || !modifier) {\n if (byKey) {\n ret.key = name;\n } else {\n ret.which = toKeyCode(value);\n }\n }\n\n if (modifier) {\n ret[modifier] = optional ? null : true;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return ret;\n}\n\n/**\n * Compare.\n */\n\nfunction compareHotkey(object, event) {\n for (var key in object) {\n var expected = object[key];\n var actual = void 0;\n\n if (expected == null) {\n continue;\n }\n\n if (key === 'key') {\n actual = event.key.toLowerCase();\n } else if (key === 'which') {\n actual = expected === 91 && event.which === 93 ? 91 : event.which;\n } else {\n actual = event[key];\n }\n\n if (actual == null && expected === false) {\n continue;\n }\n\n if (actual !== expected) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Utils.\n */\n\nfunction toKeyCode(name) {\n name = toKeyName(name);\n var code = CODES[name] || name.toUpperCase().charCodeAt(0);\n return code;\n}\n\nfunction toKeyName(name) {\n name = name.toLowerCase();\n name = ALIASES[name] || name;\n return name;\n}\n\n/**\n * Export.\n */\n\nexports.default = isHotkey;\nexports.isHotkey = isHotkey;\nexports.isCodeHotkey = isCodeHotkey;\nexports.isKeyHotkey = isKeyHotkey;\nexports.parseHotkey = parseHotkey;\nexports.compareHotkey = compareHotkey;\nexports.toKeyCode = toKeyCode;\nexports.toKeyName = toKeyName;","'use strict';\n\nexports.atob = self.atob.bind(self);\nexports.btoa = self.btoa.bind(self);\n","var isProduction = process.env.NODE_ENV === 'production';\nvar prefix = 'Invariant failed';\nvar index = (function (condition, message) {\n if (condition) {\n return;\n }\n\n if (isProduction) {\n throw new Error(prefix);\n } else {\n throw new Error(prefix + \": \" + (message || ''));\n }\n});\n\nexport default index;\n","var simpleIsEqual = function simpleIsEqual(a, b) {\n return a === b;\n};\n\nfunction index (resultFn, isEqual) {\n if (isEqual === void 0) {\n isEqual = simpleIsEqual;\n }\n\n var lastThis;\n var lastArgs = [];\n var lastResult;\n var calledOnce = false;\n\n var isNewArgEqualToLast = function isNewArgEqualToLast(newArg, index) {\n return isEqual(newArg, lastArgs[index]);\n };\n\n var result = function result() {\n for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) {\n newArgs[_key] = arguments[_key];\n }\n\n if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) {\n return lastResult;\n }\n\n lastResult = resultFn.apply(this, newArgs);\n calledOnce = true;\n lastThis = this;\n lastArgs = newArgs;\n return lastResult;\n };\n\n return result;\n}\n\nexport default index;\n","/**\n * Event handlers used by Slate plugins.\n *\n * @type {Array}\n */\n\nconst EVENT_HANDLERS = [\n 'onBeforeInput',\n 'onBlur',\n 'onClick',\n 'onContextMenu',\n 'onCompositionEnd',\n 'onCompositionStart',\n 'onCopy',\n 'onCut',\n 'onDragEnd',\n 'onDragEnter',\n 'onDragExit',\n 'onDragLeave',\n 'onDragOver',\n 'onDragStart',\n 'onDrop',\n 'onInput',\n 'onFocus',\n 'onKeyDown',\n 'onKeyUp',\n 'onMouseDown',\n 'onMouseUp',\n 'onPaste',\n 'onSelect',\n]\n\n/**\n * Export.\n *\n * @type {Array}\n */\n\nexport default EVENT_HANDLERS\n","/**\n * Other handlers used by Slate plugins.\n *\n * @type {Array}\n */\n\nconst OTHER_HANDLERS = [\n 'decorateNode',\n 'renderAnnotation',\n 'renderBlock',\n 'renderDecoration',\n 'renderDocument',\n 'renderEditor',\n 'renderInline',\n 'renderMark',\n]\n\n/**\n * Export.\n *\n * @type {Array}\n */\n\nexport default OTHER_HANDLERS\n","/**\n * DOM data attribute strings that refer to Slate concepts.\n *\n * @type {String}\n */\n\nexport default {\n EDITOR: 'data-slate-editor',\n FRAGMENT: 'data-slate-fragment',\n KEY: 'data-key',\n LEAF: 'data-slate-leaf',\n LENGTH: 'data-slate-length',\n OBJECT: 'data-slate-object',\n OFFSET_KEY: 'data-offset-key',\n SPACER: 'data-slate-spacer',\n STRING: 'data-slate-string',\n TEXT: 'data-slate-object',\n VOID: 'data-slate-void',\n ZERO_WIDTH: 'data-slate-zero-width',\n}\n","import DATA_ATTRS from './data-attributes'\n\n/**\n * DOM selector strings that refer to Slate concepts.\n *\n * @type {String}\n */\n\nexport default {\n BLOCK: `[${DATA_ATTRS.OBJECT}=\"block\"]`,\n EDITOR: `[${DATA_ATTRS.EDITOR}]`,\n INLINE: `[${DATA_ATTRS.OBJECT}=\"inline\"]`,\n KEY: `[${DATA_ATTRS.KEY}]`,\n LEAF: `[${DATA_ATTRS.LEAF}]`,\n OBJECT: `[${DATA_ATTRS.OBJECT}]`,\n STRING: `[${DATA_ATTRS.STRING}]`,\n TEXT: `[${DATA_ATTRS.OBJECT}=\"text\"]`,\n VOID: `[${DATA_ATTRS.VOID}]`,\n ZERO_WIDTH: `[${DATA_ATTRS.ZERO_WIDTH}]`,\n}\n","/**\n * Offset key parser regex.\n *\n * @type {RegExp}\n */\n\nconst PARSER = /^([\\w-]+)(?::(\\d+))?$/\n\n/**\n * Parse an offset key `string`.\n *\n * @param {String} string\n * @return {Object}\n */\n\nfunction parse(string) {\n const matches = PARSER.exec(string)\n\n if (!matches) {\n throw new Error(`Invalid offset key string \"${string}\".`)\n }\n\n const [original, key, index] = matches // eslint-disable-line no-unused-vars\n return {\n key,\n index: parseInt(index, 10),\n }\n}\n\n/**\n * Stringify an offset key `object`.\n *\n * @param {Object} object\n * @property {String} key\n * @property {Number} index\n * @return {String}\n */\n\nfunction stringify(object) {\n return `${object.key}:${object.index}`\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default {\n parse,\n stringify,\n}\n","import React from 'react'\nimport Types from 'prop-types'\nimport SlateTypes from 'slate-prop-types'\nimport ImmutableTypes from 'react-immutable-proptypes'\n\nimport OffsetKey from '../utils/offset-key'\nimport DATA_ATTRS from '../constants/data-attributes'\n\n/**\n * Leaf strings with text in them.\n *\n * @type {Component}\n */\n\nconst TextString = ({ text = '', isTrailing = false }) => {\n return (\n \n {text}\n {isTrailing ? '\\n' : null}\n \n )\n}\n\n/**\n * Leaf strings without text, render as zero-width strings.\n *\n * @type {Component}\n */\n\nconst ZeroWidthString = ({ length = 0, isLineBreak = false }) => {\n return (\n \n {'\\uFEFF'}\n {isLineBreak ?
: null}\n \n )\n}\n\n/**\n * Individual leaves in a text node with unique formatting.\n *\n * @type {Component}\n */\n\nconst Leaf = props => {\n const {\n marks,\n annotations,\n decorations,\n node,\n index,\n offset,\n text,\n editor,\n parent,\n block,\n leaves,\n } = props\n\n const offsetKey = OffsetKey.stringify({\n key: node.key,\n index,\n })\n\n let children\n\n if (editor.query('isVoid', parent)) {\n // COMPAT: Render text inside void nodes with a zero-width space.\n // So the node can contain selection but the text is not visible.\n children = \n } else if (\n text === '' &&\n parent.object === 'block' &&\n parent.text === '' &&\n parent.nodes.last() === node\n ) {\n // COMPAT: If this is the last text node in an empty block, render a zero-\n // width space that will convert into a line break when copying and pasting\n // to support expected plain text.\n children = \n } else if (text === '') {\n // COMPAT: If the text is empty, it's because it's on the edge of an inline\n // node, so we render a zero-width space so that the selection can be\n // inserted next to it still.\n children = \n } else {\n // COMPAT: Browsers will collapse trailing new lines at the end of blocks,\n // so we need to add an extra trailing new lines to prevent that.\n const lastText = block.getLastText()\n const lastChar = text.charAt(text.length - 1)\n const isLastText = node === lastText\n const isLastLeaf = index === leaves.size - 1\n\n if (isLastText && isLastLeaf && lastChar === '\\n') {\n children = \n } else {\n children = \n }\n }\n\n const renderProps = {\n editor,\n marks,\n annotations,\n decorations,\n node,\n offset,\n text,\n }\n\n // COMPAT: Having the `data-` attributes on these leaf elements ensures that\n // in certain misbehaving browsers they aren't weirdly cloned/destroyed by\n // contenteditable behaviors. (2019/05/08)\n for (const mark of marks) {\n const ret = editor.run('renderMark', {\n ...renderProps,\n mark,\n children,\n attributes: {\n [DATA_ATTRS.OBJECT]: 'mark',\n },\n })\n\n if (ret) {\n children = ret\n }\n }\n\n for (const decoration of decorations) {\n const ret = editor.run('renderDecoration', {\n ...renderProps,\n decoration,\n children,\n attributes: {\n [DATA_ATTRS.OBJECT]: 'decoration',\n },\n })\n\n if (ret) {\n children = ret\n }\n }\n\n for (const annotation of annotations) {\n const ret = editor.run('renderAnnotation', {\n ...renderProps,\n annotation,\n children,\n attributes: {\n [DATA_ATTRS.OBJECT]: 'annotation',\n },\n })\n\n if (ret) {\n children = ret\n }\n }\n\n const attrs = {\n [DATA_ATTRS.LEAF]: true,\n [DATA_ATTRS.OFFSET_KEY]: offsetKey,\n }\n\n return {children}\n}\n\n/**\n * Prop types.\n *\n * @type {Object}\n */\n\nLeaf.propTypes = {\n annotations: ImmutableTypes.list.isRequired,\n block: SlateTypes.block.isRequired,\n decorations: ImmutableTypes.list.isRequired,\n editor: Types.object.isRequired,\n index: Types.number.isRequired,\n leaves: Types.object.isRequired,\n marks: SlateTypes.marks.isRequired,\n node: SlateTypes.node.isRequired,\n offset: Types.number.isRequired,\n parent: SlateTypes.node.isRequired,\n text: Types.string.isRequired,\n}\n\n/**\n * A memoized version of `Leaf` that updates less frequently.\n *\n * @type {Component}\n */\n\nconst MemoizedLeaf = React.memo(Leaf, (prev, next) => {\n return (\n next.block === prev.block &&\n next.index === prev.index &&\n next.marks === prev.marks &&\n next.parent === prev.parent &&\n next.text === prev.text &&\n next.annotations.equals(prev.annotations) &&\n next.decorations.equals(prev.decorations)\n )\n})\n\n/**\n * Export.\n *\n * @type {Component}\n */\n\nexport default MemoizedLeaf\n","import ImmutableTypes from 'react-immutable-proptypes'\nimport React from 'react'\nimport SlateTypes from 'slate-prop-types'\nimport Types from 'prop-types'\n\nimport Leaf from './leaf'\nimport DATA_ATTRS from '../constants/data-attributes'\n\n/**\n * Text node.\n *\n * @type {Component}\n */\n\nconst Text = React.forwardRef((props, ref) => {\n const { annotations, block, decorations, node, parent, editor, style } = props\n const { key } = node\n const leaves = node.getLeaves(annotations, decorations)\n let at = 0\n\n return (\n \n {leaves.map((leaf, index) => {\n const { text } = leaf\n const offset = at\n at += text.length\n\n return (\n \n )\n })}\n \n )\n})\n\n/**\n * Prop types.\n *\n * @type {Object}\n */\n\nText.propTypes = {\n annotations: ImmutableTypes.map.isRequired,\n block: SlateTypes.block,\n decorations: ImmutableTypes.list.isRequired,\n editor: Types.object.isRequired,\n node: SlateTypes.node.isRequired,\n parent: SlateTypes.node.isRequired,\n style: Types.object,\n}\n\n/**\n * A memoized version of `Text` that updates less frequently.\n *\n * @type {Component}\n */\n\nconst MemoizedText = React.memo(Text, (prev, next) => {\n return (\n // PERF: There are cases where it will have\n // changed, but it's properties will be exactly the same (eg. copy-paste)\n // which this won't catch. But that's rare and not a drag on performance, so\n // for simplicity we just let them through.\n next.node === prev.node &&\n // If the node parent is a block node, and it was the last child of the\n // block, re-render to cleanup extra `\\n`.\n (next.parent.object === 'block' &&\n prev.parent.nodes.last() === prev.node &&\n next.parent.nodes.last() !== next.node) &&\n // The formatting hasn't changed.\n next.annotations.equals(prev.annotations) &&\n next.decorations.equals(prev.decorations)\n )\n})\n\n/**\n * Export.\n *\n * @type {Component}\n */\n\nexport default MemoizedText\n","import Debug from 'debug'\nimport React from 'react'\nimport SlateTypes from 'slate-prop-types'\nimport Types from 'prop-types'\n\nimport Text from './text'\nimport DATA_ATTRS from '../constants/data-attributes'\n\n/**\n * Debug.\n *\n * @type {Function}\n */\n\nconst debug = Debug('slate:void')\n\n/**\n * Void.\n *\n * @type {Component}\n */\n\nclass Void extends React.Component {\n /**\n * Property types.\n *\n * @type {Object}\n */\n\n static propTypes = {\n block: SlateTypes.block,\n children: Types.any.isRequired,\n editor: Types.object.isRequired,\n node: SlateTypes.node.isRequired,\n parent: SlateTypes.node.isRequired,\n readOnly: Types.bool.isRequired,\n }\n\n /**\n * Debug.\n *\n * @param {String} message\n * @param {Mixed} ...args\n */\n\n debug = (message, ...args) => {\n const { node } = this.props\n const { key, type } = node\n const id = `${key} (${type})`\n debug(message, `${id}`, ...args)\n }\n\n /**\n * Render.\n *\n * @return {Element}\n */\n\n render() {\n const { props } = this\n const { children, node, readOnly } = props\n const Tag = node.object === 'block' ? 'div' : 'span'\n const style = {\n height: '0',\n color: 'transparent',\n outline: 'none',\n position: 'absolute',\n }\n\n const spacerAttrs = {\n [DATA_ATTRS.SPACER]: true,\n }\n\n const spacer = (\n \n {this.renderText()}\n \n )\n\n const content = (\n {children}\n )\n\n this.debug('render', { props })\n\n const attrs = {\n [DATA_ATTRS.VOID]: true,\n [DATA_ATTRS.KEY]: node.key,\n }\n\n return (\n \n {readOnly ? null : spacer}\n {content}\n \n )\n }\n\n /**\n * Render the void node's text node, which will catch the cursor when it the\n * void node is navigated to with the arrow keys.\n *\n * Having this text node there means the browser continues to manage the\n * selection natively, so it keeps track of the right offset when moving\n * across the block.\n *\n * @return {Element}\n */\n\n renderText = () => {\n const {\n annotations,\n block,\n decorations,\n node,\n readOnly,\n editor,\n textRef,\n } = this.props\n const child = node.getFirstText()\n return (\n \n )\n }\n}\n\n/**\n * Export.\n *\n * @type {Component}\n */\n\nexport default Void\n","import Debug from 'debug'\nimport ImmutableTypes from 'react-immutable-proptypes'\nimport React from 'react'\nimport SlateTypes from 'slate-prop-types'\nimport warning from 'tiny-warning'\nimport Types from 'prop-types'\nimport { PathUtils } from 'slate'\n\nimport Void from './void'\nimport Text from './text'\nimport DATA_ATTRS from '../constants/data-attributes'\n\n/**\n * Debug.\n *\n * @type {Function}\n */\n\nconst debug = Debug('slate:node')\n\n/**\n * Node.\n *\n * @type {Component}\n */\n\nclass Node extends React.Component {\n /**\n * Property types.\n *\n * @type {Object}\n */\n\n static propTypes = {\n annotations: ImmutableTypes.map.isRequired,\n block: SlateTypes.block,\n decorations: ImmutableTypes.list.isRequired,\n editor: Types.object.isRequired,\n node: SlateTypes.node.isRequired,\n parent: SlateTypes.node,\n readOnly: Types.bool.isRequired,\n selection: SlateTypes.selection,\n }\n\n /**\n * Temporary values.\n *\n * @type {Object}\n */\n\n tmp = {\n nodeRefs: {},\n }\n\n /**\n * A ref for the contenteditable DOM node.\n *\n * @type {Object}\n */\n\n ref = React.createRef()\n\n /**\n * Debug.\n *\n * @param {String} message\n * @param {Mixed} ...args\n */\n\n debug = (message, ...args) => {\n const { node } = this.props\n const { key, type } = node\n debug(message, `${key} (${type})`, ...args)\n }\n\n /**\n * Should the node update?\n *\n * @param {Object} nextProps\n * @param {Object} value\n * @return {Boolean}\n */\n\n shouldComponentUpdate(nextProps) {\n const { props } = this\n const { editor } = props\n const shouldUpdate = editor.run(\n 'shouldNodeComponentUpdate',\n props,\n nextProps\n )\n const n = nextProps\n const p = props\n\n // If the `Component` has a custom logic to determine whether the component\n // needs to be updated or not, return true if it returns true. If it returns\n // false, we need to ignore it, because it shouldn't be allowed it.\n if (shouldUpdate != null) {\n warning(\n false,\n 'As of slate-react@0.22 the `shouldNodeComponentUpdate` middleware is deprecated. You can pass specific values down the tree using React\\'s built-in \"context\" construct instead.'\n )\n\n if (shouldUpdate) {\n return true\n }\n\n warning(\n shouldUpdate !== false,\n \"Returning false in `shouldNodeComponentUpdate` does not disable Slate's internal `shouldComponentUpdate` logic. If you want to prevent updates, use React's `shouldComponentUpdate` instead.\"\n )\n }\n\n // If the `readOnly` status has changed, re-render in case there is any\n // user-land logic that depends on it, like nested editable contents.\n if (n.readOnly !== p.readOnly) {\n return true\n }\n\n // If the node has changed, update. PERF: There are cases where it will have\n // changed, but it's properties will be exactly the same (eg. copy-paste)\n // which this won't catch. But that's rare and not a drag on performance, so\n // for simplicity we just let them through.\n if (n.node !== p.node) {\n return true\n }\n\n // If the selection value of the node or of some of its children has changed,\n // re-render in case there is any user-land logic depends on it to render.\n // if the node is selected update it, even if it was already selected: the\n // selection value of some of its children could have been changed and they\n // need to be rendered again.\n if (\n (!n.selection && p.selection) ||\n (n.selection && !p.selection) ||\n (n.selection && p.selection && !n.selection.equals(p.selection))\n ) {\n return true\n }\n\n // If the annotations have changed, update.\n if (!n.annotations.equals(p.annotations)) {\n return true\n }\n\n // If the decorations have changed, update.\n if (!n.decorations.equals(p.decorations)) {\n return true\n }\n\n // Otherwise, don't update.\n return false\n }\n\n /**\n * Render.\n *\n * @return {Element}\n */\n\n render() {\n this.debug('render', this)\n const {\n annotations,\n block,\n decorations,\n editor,\n node,\n parent,\n readOnly,\n selection,\n } = this.props\n\n const newDecorations = node.getDecorations(editor)\n const children = node.nodes.toArray().map((child, i) => {\n const Component = child.object === 'text' ? Text : Node\n const sel = selection && getRelativeRange(node, i, selection)\n\n const decs = newDecorations\n .concat(decorations)\n .map(d => getRelativeRange(node, i, d))\n .filter(d => d)\n\n const anns = annotations\n .map(a => getRelativeRange(node, i, a))\n .filter(a => a)\n\n return (\n {\n if (ref) {\n this.tmp.nodeRefs[i] = ref\n } else {\n delete this.tmp.nodeRefs[i]\n }\n }}\n />\n )\n })\n\n // Attributes that the developer must mix into the element in their\n // custom node renderer component.\n const attributes = {\n [DATA_ATTRS.OBJECT]: node.object,\n [DATA_ATTRS.KEY]: node.key,\n ref: this.ref,\n }\n\n // If it's a block node with inline children, add the proper `dir` attribute\n // for text direction.\n if (node.isLeafBlock()) {\n const direction = node.getTextDirection()\n if (direction === 'rtl') attributes.dir = 'rtl'\n }\n\n let render\n\n if (node.object === 'block') {\n render = 'renderBlock'\n } else if (node.object === 'document') {\n render = 'renderDocument'\n } else if (node.object === 'inline') {\n render = 'renderInline'\n }\n\n const element = editor.run(render, {\n attributes,\n children,\n editor,\n isFocused: !!selection && selection.isFocused,\n isSelected: !!selection,\n node,\n parent,\n readOnly,\n })\n\n return editor.isVoid(node) ? (\n {\n if (ref) {\n this.tmp.nodeRefs[0] = ref\n } else {\n delete this.tmp.nodeRefs[0]\n }\n }}\n >\n {element}\n \n ) : (\n element\n )\n }\n}\n\n/**\n * Return a `range` relative to a child at `index`.\n *\n * @param {Range} range\n * @param {Number} index\n * @return {Range}\n */\n\nfunction getRelativeRange(node, index, range) {\n if (range.isUnset) {\n return null\n }\n\n const child = node.nodes.get(index)\n let { start, end } = range\n const { path: startPath } = start\n const { path: endPath } = end\n const startIndex = startPath.first()\n const endIndex = endPath.first()\n\n if (startIndex === index) {\n start = start.setPath(startPath.rest())\n } else if (startIndex < index && index <= endIndex) {\n if (child.object === 'text') {\n start = start.moveTo(PathUtils.create([index]), 0).setKey(child.key)\n } else {\n const [first] = child.texts()\n const [firstNode, firstPath] = first\n start = start.moveTo(firstPath, 0).setKey(firstNode.key)\n }\n } else {\n start = null\n }\n\n if (endIndex === index) {\n end = end.setPath(endPath.rest())\n } else if (startIndex <= index && index < endIndex) {\n if (child.object === 'text') {\n const length = child.text.length\n end = end.moveTo(PathUtils.create([index]), length).setKey(child.key)\n } else {\n const [last] = child.texts({ direction: 'backward' })\n const [lastNode, lastPath] = last\n end = end.moveTo(lastPath, lastNode.text.length).setKey(lastNode.key)\n }\n } else {\n end = null\n }\n\n if (!start || !end) {\n return null\n }\n\n range = range.setAnchor(start)\n range = range.setFocus(end)\n return range\n}\n\n/**\n * Export.\n *\n * @type {Component}\n */\n\nexport default Node\n","import getWindow from 'get-window'\nimport isBackward from 'selection-is-backward'\nimport { IS_SAFARI, IS_IOS } from 'slate-dev-environment'\n\n/**\n * CSS overflow values that would cause scrolling.\n *\n * @type {Array}\n */\n\nconst OVERFLOWS = ['auto', 'overlay', 'scroll']\n\n/**\n * Detect whether we are running IOS version 11\n */\n\nconst IS_IOS_11 = IS_IOS && !!window.navigator.userAgent.match(/os 11_/i)\n\n/**\n * Find the nearest parent with scrolling, or window.\n *\n * @param {el} Element\n */\n\nfunction findScrollContainer(el, window) {\n let parent = el.parentNode\n let scroller\n\n while (!scroller) {\n if (!parent.parentNode) break\n\n const style = window.getComputedStyle(parent)\n const { overflowY } = style\n\n if (OVERFLOWS.includes(overflowY)) {\n scroller = parent\n break\n }\n\n parent = parent.parentNode\n }\n\n // COMPAT: Because Chrome does not allow doucment.body.scrollTop, we're\n // assuming that window.scrollTo() should be used if the scrollable element\n // turns out to be document.body or document.documentElement. This will work\n // unless body is intentionally set to scrollable by restricting its height\n // (e.g. height: 100vh).\n if (!scroller) {\n return window.document.body\n }\n\n return scroller\n}\n\n/**\n * Scroll the current selection's focus point into view if needed.\n *\n * @param {Selection} selection\n */\n\nfunction scrollToSelection(selection) {\n if (IS_IOS_11) return\n if (!selection.anchorNode) return\n\n const window = getWindow(selection.anchorNode)\n const scroller = findScrollContainer(selection.anchorNode, window)\n const isWindow =\n scroller === window.document.body ||\n scroller === window.document.documentElement\n const backward = isBackward(selection)\n\n const range = selection.getRangeAt(0).cloneRange()\n range.collapse(backward)\n let cursorRect = range.getBoundingClientRect()\n\n // COMPAT: range.getBoundingClientRect() returns 0s in Safari when range is\n // collapsed. Expanding the range by 1 is a relatively effective workaround\n // for vertical scroll, although horizontal may be off by 1 character.\n // https://bugs.webkit.org/show_bug.cgi?id=138949\n // https://bugs.chromium.org/p/chromium/issues/detail?id=435438\n if (IS_SAFARI) {\n if (range.collapsed && cursorRect.top === 0 && cursorRect.height === 0) {\n if (range.startOffset === 0) {\n range.setEnd(range.endContainer, 1)\n } else {\n range.setStart(range.startContainer, range.startOffset - 1)\n }\n\n cursorRect = range.getBoundingClientRect()\n\n if (cursorRect.top === 0 && cursorRect.height === 0) {\n if (range.getClientRects().length) {\n cursorRect = range.getClientRects()[0]\n }\n }\n }\n }\n\n let width\n let height\n let yOffset\n let xOffset\n let scrollerTop = 0\n let scrollerLeft = 0\n let scrollerBordersY = 0\n let scrollerBordersX = 0\n let scrollerPaddingTop = 0\n let scrollerPaddingBottom = 0\n let scrollerPaddingLeft = 0\n let scrollerPaddingRight = 0\n\n if (isWindow) {\n const { innerWidth, innerHeight, pageYOffset, pageXOffset } = window\n width = innerWidth\n height = innerHeight\n yOffset = pageYOffset\n xOffset = pageXOffset\n } else {\n const { offsetWidth, offsetHeight, scrollTop, scrollLeft } = scroller\n const {\n borderTopWidth,\n borderBottomWidth,\n borderLeftWidth,\n borderRightWidth,\n paddingTop,\n paddingBottom,\n paddingLeft,\n paddingRight,\n } = window.getComputedStyle(scroller)\n\n const scrollerRect = scroller.getBoundingClientRect()\n width = offsetWidth\n height = offsetHeight\n scrollerTop = scrollerRect.top + parseInt(borderTopWidth, 10)\n scrollerLeft = scrollerRect.left + parseInt(borderLeftWidth, 10)\n\n scrollerBordersY =\n parseInt(borderTopWidth, 10) + parseInt(borderBottomWidth, 10)\n\n scrollerBordersX =\n parseInt(borderLeftWidth, 10) + parseInt(borderRightWidth, 10)\n\n scrollerPaddingTop = parseInt(paddingTop, 10)\n scrollerPaddingBottom = parseInt(paddingBottom, 10)\n scrollerPaddingLeft = parseInt(paddingLeft, 10)\n scrollerPaddingRight = parseInt(paddingRight, 10)\n yOffset = scrollTop\n xOffset = scrollLeft\n }\n\n const cursorTop = cursorRect.top + yOffset - scrollerTop\n const cursorLeft = cursorRect.left + xOffset - scrollerLeft\n\n let x = xOffset\n let y = yOffset\n\n if (cursorLeft < xOffset) {\n // selection to the left of viewport\n x = cursorLeft - scrollerPaddingLeft\n } else if (\n cursorLeft + cursorRect.width + scrollerBordersX >\n xOffset + width\n ) {\n // selection to the right of viewport\n x = cursorLeft + scrollerBordersX + scrollerPaddingRight - width\n }\n\n if (cursorTop < yOffset) {\n // selection above viewport\n y = cursorTop - scrollerPaddingTop\n } else if (\n cursorTop + cursorRect.height + scrollerBordersY >\n yOffset + height\n ) {\n // selection below viewport\n y =\n cursorTop +\n scrollerBordersY +\n scrollerPaddingBottom +\n cursorRect.height -\n height\n }\n\n if (isWindow) {\n window.scrollTo(x, y)\n } else {\n scroller.scrollTop = y\n scroller.scrollLeft = x\n }\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default scrollToSelection\n","import { IS_IE } from 'slate-dev-environment'\n\n/**\n * Cross-browser remove all ranges from a `domSelection`.\n *\n * @param {Selection} domSelection\n */\n\nfunction removeAllRanges(domSelection) {\n // COMPAT: In IE 11, if the selection contains nested tables, then\n // `removeAllRanges` will throw an error.\n if (IS_IE) {\n const range = window.document.body.createTextRange()\n range.collapse()\n range.select()\n } else {\n domSelection.removeAllRanges()\n }\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default removeAllRanges\n","import Debug from 'debug'\nimport React from 'react'\nimport Types from 'prop-types'\nimport getWindow from 'get-window'\nimport warning from 'tiny-warning'\nimport throttle from 'lodash/throttle'\nimport omit from 'lodash/omit'\nimport { List } from 'immutable'\nimport {\n IS_ANDROID,\n IS_FIREFOX,\n HAS_INPUT_EVENTS_LEVEL_2,\n} from 'slate-dev-environment'\nimport Hotkeys from 'slate-hotkeys'\n\nimport EVENT_HANDLERS from '../constants/event-handlers'\nimport DATA_ATTRS from '../constants/data-attributes'\nimport SELECTORS from '../constants/selectors'\nimport Node from './node'\nimport scrollToSelection from '../utils/scroll-to-selection'\nimport removeAllRanges from '../utils/remove-all-ranges'\n\nconst FIREFOX_NODE_TYPE_ACCESS_ERROR = /Permission denied to access property \"nodeType\"/\n\n/**\n * Debug.\n *\n * @type {Function}\n */\n\nconst debug = Debug('slate:content')\n\n/**\n * Separate debug to easily see when the DOM has updated either by render or\n * changing selection.\n *\n * @type {Function}\n */\n\ndebug.update = Debug('slate:update')\n\n/**\n * Content.\n *\n * @type {Component}\n */\n\nclass Content extends React.Component {\n /**\n * Property types.\n *\n * @type {Object}\n */\n\n static propTypes = {\n autoCorrect: Types.bool.isRequired,\n className: Types.string,\n contentKey: Types.number,\n editor: Types.object.isRequired,\n id: Types.string,\n onEvent: Types.func.isRequired,\n readOnly: Types.bool.isRequired,\n role: Types.string,\n spellCheck: Types.bool.isRequired,\n style: Types.object,\n tabIndex: Types.number,\n tagName: Types.string,\n }\n\n /**\n * Default properties.\n *\n * @type {Object}\n */\n\n static defaultProps = {\n style: {},\n tagName: 'div',\n }\n\n /**\n * An error boundary. If there is a render error, we increment `errorKey`\n * which is part of the container `key` which forces a re-render from\n * scratch.\n *\n * @param {Error} error\n * @param {String} info\n */\n\n componentDidCatch(error, info) {\n debug('componentDidCatch', { error, info })\n // The call to `setState` is required despite not setting a value.\n // Without this call, React will not try to recreate the component tree.\n this.setState({})\n }\n\n /**\n * Temporary values.\n *\n * @type {Object}\n */\n\n tmp = {\n isUpdatingSelection: false,\n nodeRef: React.createRef(),\n nodeRefs: {},\n contentKey: 0,\n nativeSelection: {}, // Native selection object stored to check if `onNativeSelectionChange` has triggered yet\n }\n\n /**\n * A ref for the contenteditable DOM node.\n *\n * @type {Object}\n */\n\n ref = React.createRef()\n\n /**\n * Set both `this.ref` and `editor.el`\n *\n * @type {DOMElement}\n */\n\n setRef = el => {\n this.ref.current = el\n this.props.editor.el = el\n }\n\n /**\n * Create a set of bound event handlers.\n *\n * @type {Object}\n */\n\n handlers = EVENT_HANDLERS.reduce((obj, handler) => {\n obj[handler] = event => this.onEvent(handler, event)\n return obj\n }, {})\n\n /**\n * When the editor first mounts in the DOM we need to:\n *\n * - Add native DOM event listeners.\n * - Update the selection, in case it starts focused.\n */\n\n componentDidMount() {\n const window = getWindow(this.ref.current)\n\n window.document.addEventListener(\n 'selectionchange',\n this.onNativeSelectionChange\n )\n\n // COMPAT: Restrict scope of `beforeinput` to clients that support the\n // Input Events Level 2 spec, since they are preventable events.\n if (HAS_INPUT_EVENTS_LEVEL_2) {\n this.ref.current.addEventListener(\n 'beforeinput',\n this.handlers.onBeforeInput\n )\n }\n\n this.updateSelection()\n\n this.props.onEvent('onComponentDidMount')\n }\n\n /**\n * When unmounting, remove DOM event listeners.\n */\n\n componentWillUnmount() {\n const window = getWindow(this.ref.current)\n\n if (window) {\n window.document.removeEventListener(\n 'selectionchange',\n this.onNativeSelectionChange\n )\n }\n\n if (HAS_INPUT_EVENTS_LEVEL_2) {\n this.ref.current.removeEventListener(\n 'beforeinput',\n this.handlers.onBeforeInput\n )\n }\n\n this.props.onEvent('onComponentWillUnmount')\n }\n\n /**\n * On update, update the selection.\n */\n\n componentDidUpdate() {\n debug.update('componentDidUpdate')\n\n this.updateSelection()\n this.props.editor.clearUserActionPerformed()\n\n this.props.onEvent('onComponentDidUpdate')\n }\n\n /**\n * Update the native DOM selection to reflect the internal model.\n */\n\n updateSelection = () => {\n const { editor } = this.props\n const { value } = editor\n const { selection } = value\n const { isBackward } = selection\n const window = getWindow(this.ref.current)\n const native = window.getSelection()\n const { activeElement } = window.document\n\n if (debug.update.enabled) {\n debug.update('updateSelection', { selection: selection.toJSON() })\n }\n\n // COMPAT: In Firefox, there's a but where `getSelection` can return `null`.\n // https://bugzilla.mozilla.org/show_bug.cgi?id=827585 (2018/11/07)\n if (!native) {\n return\n }\n\n const { rangeCount, anchorNode } = native\n let updated = false\n\n // If the Slate selection is blurred, but the DOM's active element is still\n // the editor, we need to blur it.\n if (selection.isBlurred && activeElement === this.ref.current) {\n this.ref.current.blur()\n updated = true\n }\n\n // If the Slate selection is unset, but the DOM selection has a range\n // selected in the editor, we need to remove the range.\n // However we should _not_ remove the range if the selection as\n // reported by `getSelection` is not equal to `this.tmp.nativeSelection`\n // as this suggests `onNativeSelectionChange` has not triggered yet (which can occur in Firefox)\n // See: https://github.com/ianstormtaylor/slate/pull/2995\n\n const propsToCompare = [\n 'anchorNode',\n 'anchorOffset',\n 'focusNode',\n 'focusOffset',\n 'isCollapsed',\n 'rangeCount',\n 'type',\n ]\n\n let selectionsEqual = true\n\n for (const prop of propsToCompare) {\n if (this.tmp.nativeSelection[prop] !== native[prop]) {\n selectionsEqual = false\n }\n }\n\n if (\n selection.isUnset &&\n rangeCount &&\n this.isInEditor(anchorNode) &&\n selectionsEqual\n ) {\n removeAllRanges(native)\n updated = true\n }\n\n // If the Slate selection is focused, but the DOM's active element is not\n // the editor, we need to focus it. We prevent scrolling because we handle\n // scrolling to the correct selection.\n if (selection.isFocused && activeElement !== this.ref.current) {\n this.ref.current.focus({ preventScroll: true })\n updated = true\n }\n\n // Otherwise, figure out which DOM nodes should be selected...\n if (selection.isFocused && selection.isSet) {\n const current = !!native.rangeCount && native.getRangeAt(0)\n const range = editor.findDOMRange(selection)\n\n if (!range) {\n warning(\n false,\n 'Unable to find a native DOM range from the current selection.'\n )\n\n return\n }\n\n const { startContainer, startOffset, endContainer, endOffset } = range\n\n // If the new range matches the current selection, there is nothing to fix.\n // COMPAT: The native `Range` object always has it's \"start\" first and \"end\"\n // last in the DOM. It has no concept of \"backwards/forwards\", so we have\n // to check both orientations here. (2017/10/31)\n if (current) {\n if (\n (startContainer === current.startContainer &&\n startOffset === current.startOffset &&\n endContainer === current.endContainer &&\n endOffset === current.endOffset) ||\n (startContainer === current.endContainer &&\n startOffset === current.endOffset &&\n endContainer === current.startContainer &&\n endOffset === current.startOffset)\n ) {\n return\n }\n }\n\n // Otherwise, set the `isUpdatingSelection` flag and update the selection.\n updated = true\n this.tmp.isUpdatingSelection = true\n removeAllRanges(native)\n\n // COMPAT: IE 11 does not support `setBaseAndExtent`. (2018/11/07)\n if (native.setBaseAndExtent) {\n // COMPAT: Since the DOM range has no concept of backwards/forwards\n // we need to check and do the right thing here.\n if (isBackward) {\n native.setBaseAndExtent(\n range.endContainer,\n range.endOffset,\n range.startContainer,\n range.startOffset\n )\n } else {\n native.setBaseAndExtent(\n range.startContainer,\n range.startOffset,\n range.endContainer,\n range.endOffset\n )\n }\n } else {\n native.addRange(range)\n }\n\n // Only scroll to selection when a user action is performed\n if (editor.userActionPerformed() === true) {\n // Scroll to the selection, in case it's out of view.\n scrollToSelection(native)\n }\n\n // Then unset the `isUpdatingSelection` flag after a delay, to ensure that\n // it is still set when selection-related events from updating it fire.\n setTimeout(() => {\n // COMPAT: In Firefox, it's not enough to create a range, you also need\n // to focus the contenteditable element too. (2016/11/16)\n if (IS_FIREFOX && this.ref.current) {\n this.ref.current.focus()\n }\n\n this.tmp.isUpdatingSelection = false\n\n debug.update('updateSelection:setTimeout', {\n anchorOffset: window.getSelection().anchorOffset,\n })\n })\n }\n\n if (updated && (debug.enabled || debug.update.enabled)) {\n debug('updateSelection', { selection, native, activeElement })\n\n debug.update('updateSelection:applied', {\n selection: selection.toJSON(),\n native: {\n anchorOffset: native.anchorOffset,\n focusOffset: native.focusOffset,\n },\n })\n }\n }\n\n /**\n * Check if an event `target` is fired from within the contenteditable\n * element. This should be false for edits happening in non-contenteditable\n * children, such as void nodes and other nested Slate editors.\n *\n * @param {Element} target\n * @return {Boolean}\n */\n\n isInEditor = target => {\n let el\n\n try {\n // COMPAT: In Firefox, sometimes the node can be comment which doesn't\n // have .closest and it crashes.\n if (target.nodeType === 8) {\n return false\n }\n\n // COMPAT: Text nodes don't have `isContentEditable` property. So, when\n // `target` is a text node use its parent node for check.\n el = target.nodeType === 3 ? target.parentNode : target\n } catch (err) {\n // COMPAT: In Firefox, `target.nodeType` will throw an error if target is\n // originating from an internal \"restricted\" element (e.g. a stepper\n // arrow on a number input)\n // see github.com/ianstormtaylor/slate/issues/1819\n if (IS_FIREFOX && FIREFOX_NODE_TYPE_ACCESS_ERROR.test(err.message)) {\n return false\n }\n\n throw err\n }\n\n return (\n el.isContentEditable &&\n (el === this.ref.current ||\n el.closest(SELECTORS.EDITOR) === this.ref.current)\n )\n }\n\n /**\n * On `event` with `handler`.\n *\n * @param {String} handler\n * @param {Event} event\n */\n\n onEvent(handler, event) {\n debug('onEvent', handler)\n\n const nativeEvent = event.nativeEvent || event\n const isUndoRedo =\n event.type === 'keydown' &&\n (Hotkeys.isUndo(nativeEvent) || Hotkeys.isRedo(nativeEvent))\n\n // Ignore `onBlur`, `onFocus` and `onSelect` events generated\n // programmatically while updating selection.\n if (\n (this.tmp.isUpdatingSelection || isUndoRedo) &&\n (handler === 'onSelect' || handler === 'onBlur' || handler === 'onFocus')\n ) {\n return\n }\n\n // COMPAT: There are situations where a select event will fire with a new\n // native selection that resolves to the same internal position. In those\n // cases we don't need to trigger any changes, since our internal model is\n // already up to date, but we do want to update the native selection again\n // to make sure it is in sync. (2017/10/16)\n //\n // ANDROID: The updateSelection causes issues in Android when you are\n // at the end of a block. The selection ends up to the left of the inserted\n // character instead of to the right. This behavior continues even if\n // you enter more than one character. (2019/01/03)\n if (!IS_ANDROID && handler === 'onSelect') {\n const { editor } = this.props\n const { value } = editor\n const { selection } = value\n const window = getWindow(event.target)\n const domSelection = window.getSelection()\n const range = editor.findRange(domSelection)\n\n if (range && range.equals(selection.toRange())) {\n this.updateSelection()\n return\n }\n }\n\n // Don't handle drag and drop events coming from embedded editors.\n if (\n handler === 'onDragEnd' ||\n handler === 'onDragEnter' ||\n handler === 'onDragExit' ||\n handler === 'onDragLeave' ||\n handler === 'onDragOver' ||\n handler === 'onDragStart' ||\n handler === 'onDrop'\n ) {\n const closest = event.target.closest(SELECTORS.EDITOR)\n\n if (closest !== this.ref.current) {\n return\n }\n }\n\n // Some events require being in editable in the editor, so if the event\n // target isn't, ignore them.\n if (\n handler === 'onBeforeInput' ||\n handler === 'onBlur' ||\n handler === 'onCompositionEnd' ||\n handler === 'onCompositionStart' ||\n handler === 'onCopy' ||\n handler === 'onCut' ||\n handler === 'onFocus' ||\n handler === 'onInput' ||\n handler === 'onKeyDown' ||\n handler === 'onKeyUp' ||\n handler === 'onPaste' ||\n handler === 'onSelect'\n ) {\n if (!this.isInEditor(event.target)) {\n return\n }\n }\n\n this.props.onEvent(handler, event)\n }\n\n /**\n * On native `selectionchange` event, trigger the `onSelect` handler. This is\n * needed to account for React's `onSelect` being non-standard and not firing\n * until after a selection has been released. This causes issues in situations\n * where another change happens while a selection is being made.\n *\n * @param {Event} event\n */\n\n onNativeSelectionChange = throttle(event => {\n if (this.props.readOnly) return\n\n const window = getWindow(event.target)\n const { activeElement } = window.document\n\n const native = window.getSelection()\n\n debug.update('onNativeSelectionChange', {\n anchorOffset: native.anchorOffset,\n })\n\n if (activeElement !== this.ref.current) return\n\n this.tmp.nativeSelection = {\n anchorNode: native.anchorNode,\n anchorOffset: native.anchorOffset,\n focusNode: native.focusNode,\n focusOffset: native.focusOffset,\n isCollapsed: native.isCollapsed,\n rangeCount: native.rangeCount,\n type: native.type,\n }\n\n this.props.onEvent('onSelect', event)\n }, 100)\n\n /**\n * Render the editor content.\n *\n * @return {Element}\n */\n\n render() {\n const { props, handlers } = this\n const {\n id,\n className,\n readOnly,\n editor,\n tabIndex,\n role,\n tagName,\n spellCheck,\n } = props\n const { value } = editor\n const Container = tagName\n const { document, selection } = value\n\n const style = {\n // Prevent the default outline styles.\n outline: 'none',\n // Preserve adjacent whitespace and new lines.\n whiteSpace: 'pre-wrap',\n // Allow words to break if they are too long.\n wordWrap: 'break-word',\n // COMPAT: In iOS, a formatting menu with bold, italic and underline\n // buttons is shown which causes our internal value to get out of sync in\n // weird ways. This hides that. (2016/06/21)\n ...(readOnly ? {} : { WebkitUserModify: 'read-write-plaintext-only' }),\n // Allow for passed-in styles to override anything.\n ...props.style,\n }\n\n // console.log('rerender content', this.tmp.contentKey, document.text)\n\n debug('render', { props })\n debug.update('render', this.tmp.contentKey, document.text)\n\n this.props.onEvent('onRender')\n\n const data = {\n [DATA_ATTRS.EDITOR]: true,\n [DATA_ATTRS.KEY]: document.key,\n }\n\n const domProps = omit(this.props, Object.keys(Content.propTypes))\n\n return (\n \n \n \n )\n }\n}\n\n/**\n * Export.\n *\n * @type {Component}\n */\n\nexport default Content\n","import EVENT_HANDLERS from '../../constants/event-handlers'\n\n/**\n * Props that can be defined by plugins.\n *\n * @type {Array}\n */\n\nconst PROPS = [\n ...EVENT_HANDLERS,\n 'commands',\n 'decorateNode',\n 'queries',\n 'renderAnnotation',\n 'renderBlock',\n 'renderDecoration',\n 'renderDocument',\n 'renderEditor',\n 'renderInline',\n 'renderMark',\n 'schema',\n]\n\n/**\n * The top-level editor props in a plugin.\n *\n * @param {Object} options\n * @return {Object}\n */\n\nfunction EditorPropsPlugin(options = {}) {\n const plugin = PROPS.reduce((memo, prop) => {\n if (prop in options) memo[prop] = options[prop]\n return memo\n }, {})\n\n return plugin\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default EditorPropsPlugin\n","import React from 'react'\n\n/**\n * The default rendering behavior for the React plugin.\n *\n * @return {Object}\n */\n\nfunction Rendering() {\n return {\n decorateNode() {\n return []\n },\n\n renderAnnotation({ attributes, children }) {\n return {children}\n },\n\n renderBlock({ attributes, children }) {\n return (\n
\n {children}\n
\n )\n },\n\n renderDecoration({ attributes, children }) {\n return {children}\n },\n\n renderDocument({ children }) {\n return children\n },\n\n renderEditor({ children }) {\n return children\n },\n\n renderInline({ attributes, children }) {\n return (\n \n {children}\n \n )\n },\n\n renderMark({ attributes, children }) {\n return {children}\n },\n }\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default Rendering\n","/**\n * A set of commands for the React plugin.\n *\n * @return {Object}\n */\n\nfunction CommandsPlugin() {\n /**\n * Takes a `node`, find the matching `domNode` and uses it to set the text\n * in the `node`.\n *\n * @param {Editor} editor\n * @param {Node} node\n */\n\n function reconcileNode(editor, node) {\n const { value } = editor\n const { document, selection } = value\n const path = document.getPath(node.key)\n\n const domElement = editor.findDOMNode(path)\n const block = document.getClosestBlock(path)\n\n // Get text information\n const { text } = node\n let { textContent: domText } = domElement\n\n const isLastNode = block.nodes.last() === node\n const lastChar = domText.charAt(domText.length - 1)\n\n // COMPAT: If this is the last leaf, and the DOM text ends in a new line,\n // we will have added another new line in 's render method to account\n // for browsers collapsing a single trailing new lines, so remove it.\n if (isLastNode && lastChar === '\\n') {\n domText = domText.slice(0, -1)\n }\n\n // If the text is no different, abort.\n if (text === domText) return\n\n let entire = selection.moveAnchorTo(path, 0).moveFocusTo(path, text.length)\n\n entire = document.resolveRange(entire)\n\n // Change the current value to have the leaf's text replaced.\n editor.insertTextAtRange(entire, domText, node.marks)\n return\n }\n\n /**\n * Takes text from the `domNode` and uses it to set the text in the matching\n * `node` in Slate.\n *\n * @param {Editor} editor\n * @param {DOMNode} domNode\n */\n\n function reconcileDOMNode(editor, domNode) {\n const domElement = domNode.parentElement.closest('[data-key]')\n const node = editor.findNode(domElement)\n editor.reconcileNode(node)\n }\n\n return {\n commands: {\n reconcileNode,\n reconcileDOMNode,\n },\n }\n}\n\nexport default CommandsPlugin\n","import getWindow from 'get-window'\nimport { PathUtils } from 'slate'\n\nimport DATA_ATTRS from '../../constants/data-attributes'\nimport SELECTORS from '../../constants/selectors'\n\n/**\n * A set of queries for the React plugin.\n *\n * @return {Object}\n */\n\nfunction QueriesPlugin() {\n /**\n * Find the native DOM element for a node at `path`.\n *\n * @param {Editor} editor\n * @param {Array|List} path\n * @return {DOMNode|Null}\n */\n\n function findDOMNode(editor, path) {\n path = PathUtils.create(path)\n const content = editor.tmp.contentRef.current\n\n if (!content) {\n return null\n }\n\n if (!path.size) {\n return content.ref.current || null\n }\n\n const search = (instance, p) => {\n if (!instance) {\n return null\n }\n\n if (!p.size) {\n if (instance.ref) {\n return instance.ref.current || null\n } else {\n return instance || null\n }\n }\n\n const index = p.first()\n const rest = p.rest()\n const ref = instance.tmp.nodeRefs[index]\n return search(ref, rest)\n }\n\n const document = content.tmp.nodeRef.current\n const el = search(document, path)\n return el\n }\n\n /**\n * Find a native DOM selection point from a Slate `point`.\n *\n * @param {Editor} editor\n * @param {Point} point\n * @return {Object|Null}\n */\n\n function findDOMPoint(editor, point) {\n const el = editor.findDOMNode(point.path)\n let start = 0\n\n if (!el) {\n return null\n }\n\n // For each leaf, we need to isolate its content, which means filtering to its\n // direct text and zero-width spans. (We have to filter out any other siblings\n // that may have been rendered alongside them.)\n const texts = Array.from(\n el.querySelectorAll(`${SELECTORS.STRING}, ${SELECTORS.ZERO_WIDTH}`)\n )\n\n for (const text of texts) {\n const node = text.childNodes[0]\n const domLength = node.textContent.length\n let slateLength = domLength\n\n if (text.hasAttribute(DATA_ATTRS.LENGTH)) {\n slateLength = parseInt(text.getAttribute(DATA_ATTRS.LENGTH), 10)\n }\n\n const end = start + slateLength\n\n if (point.offset <= end) {\n const offset = Math.min(domLength, Math.max(0, point.offset - start))\n return { node, offset }\n }\n\n start = end\n }\n\n return null\n }\n\n /**\n * Find a native DOM range from a Slate `range`.\n *\n * @param {Editor} editor\n * @param {Range} range\n * @return {DOMRange|Null}\n */\n\n function findDOMRange(editor, range) {\n const { anchor, focus, isBackward, isCollapsed } = range\n const domAnchor = editor.findDOMPoint(anchor)\n const domFocus = isCollapsed ? domAnchor : editor.findDOMPoint(focus)\n\n if (!domAnchor || !domFocus) {\n return null\n }\n\n const window = getWindow(domAnchor.node)\n const r = window.document.createRange()\n const start = isBackward ? domFocus : domAnchor\n const end = isBackward ? domAnchor : domFocus\n r.setStart(start.node, start.offset)\n r.setEnd(end.node, end.offset)\n return r\n }\n\n /**\n * Find a Slate node from a native DOM `element`.\n *\n * @param {Editor} editor\n * @param {Element} element\n * @return {List|Null}\n */\n\n function findNode(editor, element) {\n const path = editor.findPath(element)\n\n if (!path) {\n return null\n }\n\n const { value } = editor\n const { document } = value\n const node = document.getNode(path)\n return node\n }\n\n /**\n * Get the target range from a DOM `event`.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @return {Range}\n */\n\n function findEventRange(editor, event) {\n if (event.nativeEvent) {\n event = event.nativeEvent\n }\n\n const { clientX: x, clientY: y, target } = event\n if (x == null || y == null) return null\n\n const { value } = editor\n const { document } = value\n const path = editor.findPath(event.target)\n if (!path) return null\n\n const node = document.getNode(path)\n\n // If the drop target is inside a void node, move it into either the next or\n // previous node, depending on which side the `x` and `y` coordinates are\n // closest to.\n if (editor.isVoid(node)) {\n const rect = target.getBoundingClientRect()\n const isPrevious =\n node.object === 'inline'\n ? x - rect.left < rect.left + rect.width - x\n : y - rect.top < rect.top + rect.height - y\n\n const range = document.createRange()\n const move = isPrevious ? 'moveToEndOfNode' : 'moveToStartOfNode'\n const entry = document[isPrevious ? 'getPreviousText' : 'getNextText'](\n path\n )\n\n if (entry) {\n return range[move](entry)\n }\n\n return null\n }\n\n // Else resolve a range from the caret position where the drop occured.\n const window = getWindow(target)\n let native\n\n // COMPAT: In Firefox, `caretRangeFromPoint` doesn't exist. (2016/07/25)\n if (window.document.caretRangeFromPoint) {\n native = window.document.caretRangeFromPoint(x, y)\n } else if (window.document.caretPositionFromPoint) {\n const position = window.document.caretPositionFromPoint(x, y)\n native = window.document.createRange()\n native.setStart(position.offsetNode, position.offset)\n native.setEnd(position.offsetNode, position.offset)\n } else if (window.document.body.createTextRange) {\n // COMPAT: In IE, `caretRangeFromPoint` and\n // `caretPositionFromPoint` don't exist. (2018/07/11)\n native = window.document.body.createTextRange()\n\n try {\n native.moveToPoint(x, y)\n } catch (error) {\n // IE11 will raise an `unspecified error` if `moveToPoint` is\n // called during a dropEvent.\n return null\n }\n }\n\n // Resolve a Slate range from the DOM range.\n const range = editor.findRange(native)\n return range\n }\n\n /**\n * Find the path of a native DOM `element` by searching React refs.\n *\n * @param {Editor} editor\n * @param {Element} element\n * @return {List|Null}\n */\n\n function findPath(editor, element) {\n const content = editor.tmp.contentRef.current\n let nodeElement = element\n\n // If element does not have a key, it is likely a string or\n // mark, return the closest parent Node that can be looked up.\n if (!nodeElement.hasAttribute(DATA_ATTRS.KEY)) {\n nodeElement = nodeElement.closest(SELECTORS.KEY)\n }\n\n if (!nodeElement || !nodeElement.getAttribute(DATA_ATTRS.KEY)) {\n return null\n }\n\n if (nodeElement === content.ref.current) {\n return PathUtils.create([])\n }\n\n const search = (instance, p) => {\n if (nodeElement === instance) {\n return p\n }\n\n if (!instance.ref) {\n return null\n }\n\n if (nodeElement === instance.ref.current) {\n return p\n }\n\n // If there's no `tmp` then we're at a leaf node without success.\n if (!instance.tmp) {\n return null\n }\n\n const { nodeRefs } = instance.tmp\n const keys = Object.keys(nodeRefs)\n\n for (const i of keys) {\n const ref = nodeRefs[i]\n const n = parseInt(i, 10)\n const path = search(ref, [...p, n])\n\n if (path) {\n return path\n }\n }\n\n return null\n }\n\n const document = content.tmp.nodeRef.current\n const path = search(document, [])\n\n if (!path) {\n return null\n }\n\n return PathUtils.create(path)\n }\n\n /**\n * Find a Slate point from a DOM selection's `nativeNode` and `nativeOffset`.\n *\n * @param {Editor} editor\n * @param {Element} nativeNode\n * @param {Number} nativeOffset\n * @return {Point}\n */\n\n function findPoint(editor, nativeNode, nativeOffset) {\n const { node: nearestNode, offset: nearestOffset } = normalizeNodeAndOffset(\n nativeNode,\n nativeOffset\n )\n\n const window = getWindow(nativeNode)\n const { parentNode } = nearestNode\n let leafNode = parentNode.closest(SELECTORS.LEAF)\n let textNode\n let offset\n let node\n\n // Calculate how far into the text node the `nearestNode` is, so that we can\n // determine what the offset relative to the text node is.\n if (leafNode) {\n textNode = leafNode.closest(SELECTORS.TEXT)\n const range = window.document.createRange()\n range.setStart(textNode, 0)\n range.setEnd(nearestNode, nearestOffset)\n const contents = range.cloneContents()\n const zeroWidths = contents.querySelectorAll(SELECTORS.ZERO_WIDTH)\n\n Array.from(zeroWidths).forEach(el => {\n el.parentNode.removeChild(el)\n })\n\n // COMPAT: Edge has a bug where Range.prototype.toString() will convert \\n\n // into \\r\\n. The bug causes a loop when slate-react attempts to reposition\n // its cursor to match the native position. Use textContent.length instead.\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10291116/\n offset = contents.textContent.length\n node = textNode\n } else {\n // For void nodes, the element with the offset key will be a cousin, not an\n // ancestor, so find it by going down from the nearest void parent.\n const voidNode = parentNode.closest(SELECTORS.VOID)\n\n if (!voidNode) {\n return null\n }\n\n leafNode = voidNode.querySelector(SELECTORS.LEAF)\n\n if (!leafNode) {\n return null\n }\n\n textNode = leafNode.closest(SELECTORS.TEXT)\n node = leafNode\n offset = node.textContent.length\n }\n\n // COMPAT: If the parent node is a Slate zero-width space, this is because the\n // text node should have no characters. However, during IME composition the\n // ASCII characters will be prepended to the zero-width space, so subtract 1\n // from the offset to account for the zero-width space character.\n if (\n offset === node.textContent.length &&\n parentNode.hasAttribute(DATA_ATTRS.ZERO_WIDTH)\n ) {\n offset--\n }\n\n // COMPAT: If someone is clicking from one Slate editor into another, the\n // select event fires twice, once for the old editor's `element` first, and\n // then afterwards for the correct `element`. (2017/03/03)\n const path = editor.findPath(textNode)\n\n if (!path) {\n return null\n }\n\n const { value } = editor\n const { document } = value\n const point = document.createPoint({ path, offset })\n return point\n }\n\n /**\n * Find a Slate range from a DOM range or selection.\n *\n * @param {Editor} editor\n * @param {Selection} domRange\n * @return {Range}\n */\n\n function findRange(editor, domRange) {\n const el = domRange.anchorNode || domRange.startContainer\n\n if (!el) {\n return null\n }\n\n const window = getWindow(el)\n\n // If the `domRange` object is a DOM `Range` or `StaticRange` object, change it\n // into something that looks like a DOM `Selection` instead.\n if (\n domRange instanceof window.Range ||\n (window.StaticRange && domRange instanceof window.StaticRange)\n ) {\n domRange = {\n anchorNode: domRange.startContainer,\n anchorOffset: domRange.startOffset,\n focusNode: domRange.endContainer,\n focusOffset: domRange.endOffset,\n }\n }\n\n const {\n anchorNode,\n anchorOffset,\n focusNode,\n focusOffset,\n isCollapsed,\n } = domRange\n const { value } = editor\n const anchor = editor.findPoint(anchorNode, anchorOffset)\n const focus = isCollapsed\n ? anchor\n : editor.findPoint(focusNode, focusOffset)\n\n if (!anchor || !focus) {\n return null\n }\n\n const { document } = value\n const range = document.createRange({\n anchor,\n focus,\n })\n\n return range\n }\n\n /**\n * Find a Slate selection from a DOM selection.\n *\n * @param {Editor} editor\n * @param {Selection} domSelection\n * @return {Range}\n */\n\n function findSelection(editor, domSelection) {\n const { value } = editor\n const { document } = value\n\n // If there are no ranges, the editor was blurred natively.\n if (!domSelection.rangeCount) {\n return null\n }\n\n // Otherwise, determine the Slate selection from the native one.\n let range = editor.findRange(domSelection)\n\n if (!range) {\n return null\n }\n\n const { anchor, focus } = range\n const anchorText = document.getNode(anchor.path)\n const focusText = document.getNode(focus.path)\n const anchorInline = document.getClosestInline(anchor.path)\n const focusInline = document.getClosestInline(focus.path)\n const focusBlock = document.getClosestBlock(focus.path)\n const anchorBlock = document.getClosestBlock(anchor.path)\n\n // COMPAT: If the anchor point is at the start of a non-void, and the\n // focus point is inside a void node with an offset that isn't `0`, set\n // the focus offset to `0`. This is due to void nodes 's being\n // positioned off screen, resulting in the offset always being greater\n // than `0`. Since we can't know what it really should be, and since an\n // offset of `0` is less destructive because it creates a hanging\n // selection, go with `0`. (2017/09/07)\n if (\n anchorBlock &&\n !editor.isVoid(anchorBlock) &&\n anchor.offset === 0 &&\n focusBlock &&\n editor.isVoid(focusBlock) &&\n focus.offset !== 0\n ) {\n range = range.setFocus(focus.setOffset(0))\n }\n\n // COMPAT: If the selection is at the end of a non-void inline node, and\n // there is a node after it, put it in the node after instead. This\n // standardizes the behavior, since it's indistinguishable to the user.\n if (\n anchorInline &&\n !editor.isVoid(anchorInline) &&\n anchor.offset === anchorText.text.length\n ) {\n const block = document.getClosestBlock(anchor.path)\n const depth = document.getDepth(block.key)\n const relativePath = PathUtils.drop(anchor.path, depth)\n const [next] = block.texts({ path: relativePath })\n\n if (next) {\n const [, nextPath] = next\n const absolutePath = anchor.path.slice(0, depth).concat(nextPath)\n range = range.moveAnchorTo(absolutePath, 0)\n }\n }\n\n if (\n focusInline &&\n !editor.isVoid(focusInline) &&\n focus.offset === focusText.text.length\n ) {\n const block = document.getClosestBlock(focus.path)\n const depth = document.getDepth(block.key)\n const relativePath = PathUtils.drop(focus.path, depth)\n const [next] = block.texts({ path: relativePath })\n\n if (next) {\n const [, nextPath] = next\n const absolutePath = focus.path.slice(0, depth).concat(nextPath)\n range = range.moveFocusTo(absolutePath, 0)\n }\n }\n\n let selection = document.createSelection(range)\n\n // COMPAT: Ensure that the `isFocused` argument is set.\n selection = selection.setIsFocused(true)\n\n // COMPAT: Preserve the marks, since we have no way of knowing what the DOM\n // selection's marks were. They will be cleared automatically by the\n // `select` command if the selection moves.\n selection = selection.set('marks', value.selection.marks)\n\n return selection\n }\n\n return {\n queries: {\n findDOMNode,\n findDOMPoint,\n findDOMRange,\n findEventRange,\n findNode,\n findPath,\n findPoint,\n findRange,\n findSelection,\n },\n }\n}\n\n/**\n * From a DOM selection's `node` and `offset`, normalize so that it always\n * refers to a text node.\n *\n * @param {Element} node\n * @param {Number} offset\n * @return {Object}\n */\n\nfunction normalizeNodeAndOffset(node, offset) {\n // If it's an element node, its offset refers to the index of its children\n // including comment nodes, so try to find the right text child node.\n if (node.nodeType === 1 && node.childNodes.length) {\n const isLast = offset === node.childNodes.length\n const direction = isLast ? 'backward' : 'forward'\n const index = isLast ? offset - 1 : offset\n node = getEditableChild(node, index, direction)\n\n // If the node has children, traverse until we have a leaf node. Leaf nodes\n // can be either text nodes, or other void DOM nodes.\n while (node.nodeType === 1 && node.childNodes.length) {\n const i = isLast ? node.childNodes.length - 1 : 0\n node = getEditableChild(node, i, direction)\n }\n\n // Determine the new offset inside the text node.\n offset = isLast ? node.textContent.length : 0\n }\n\n // Return the node and offset.\n return { node, offset }\n}\n\n/**\n * Get the nearest editable child at `index` in a `parent`, preferring\n * `direction`.\n *\n * @param {Element} parent\n * @param {Number} index\n * @param {String} direction ('forward' or 'backward')\n * @return {Element|Null}\n */\n\nfunction getEditableChild(parent, index, direction) {\n const { childNodes } = parent\n let child = childNodes[index]\n let i = index\n let triedForward = false\n let triedBackward = false\n\n // While the child is a comment node, or an element node with no children,\n // keep iterating to find a sibling non-void, non-comment node.\n while (\n child.nodeType === 8 ||\n (child.nodeType === 1 && child.childNodes.length === 0) ||\n (child.nodeType === 1 && child.getAttribute('contenteditable') === 'false')\n ) {\n if (triedForward && triedBackward) break\n\n if (i >= childNodes.length) {\n triedForward = true\n i = index - 1\n direction = 'backward'\n continue\n }\n\n if (i < 0) {\n triedBackward = true\n i = index + 1\n direction = 'forward'\n continue\n }\n\n child = childNodes[i]\n if (direction === 'forward') i++\n if (direction === 'backward') i--\n }\n\n return child || null\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default QueriesPlugin\n","/**\n * Returns the number of characters that are the same at the beginning of the\n * String.\n *\n * @param {String} prev\n * @param {String} next\n */\n\nfunction getDiffStart(prev, next) {\n const length = Math.min(prev.length, next.length)\n\n for (let i = 0; i < length; i++) {\n if (prev.charAt(i) !== next.charAt(i)) return i\n }\n\n if (prev.length !== next.length) return length\n return null\n}\n\n/**\n * Returns the number of characters that are the same at the end of the String\n * up to `max`. Max prevents double-counting characters when there are\n * multiple duplicate characters around the diff area.\n *\n * @param {String} prev\n * @param {String} next\n * @param {Number} max\n */\n\nfunction getDiffEnd(prev, next, max) {\n const prevLength = prev.length\n const nextLength = next.length\n const length = Math.min(prevLength, nextLength, max)\n\n for (let i = 0; i < length; i++) {\n const prevChar = prev.charAt(prevLength - i - 1)\n const nextChar = next.charAt(nextLength - i - 1)\n if (prevChar !== nextChar) return i\n }\n\n if (prev.length !== next.length) return length\n return null\n}\n\n/**\n * Takes two strings and returns an object representing two offsets. The\n * first, `start` represents the number of characters that are the same at\n * the front of the String. The `end` represents the number of characters\n * that are the same at the end of the String.\n *\n * Returns null if they are identical.\n *\n * @param {String} prev\n * @param {String} next\n */\n\nfunction getDiffOffsets(prev, next) {\n if (prev === next) return null\n const start = getDiffStart(prev, next)\n const maxEnd = Math.min(prev.length - start, next.length - start)\n const end = getDiffEnd(prev, next, maxEnd)\n return { start, end, total: start + end }\n}\n\n/**\n * Takes a text string and returns a slice from the string at the given offses\n *\n * @param {String} text\n * @param {Object} offsets\n */\n\nfunction sliceText(text, offsets) {\n return text.slice(offsets.start, text.length - offsets.end)\n}\n\n/**\n * Takes two strings and returns a smart diff that can be used to describe the\n * change in a way that can be used as operations like inserting, removing or\n * replacing text.\n *\n * @param {String} prev\n * @param {String} next\n */\n\nexport default function diff(prev, next) {\n const offsets = getDiffOffsets(prev, next)\n if (offsets == null) return null\n const insertText = sliceText(next, offsets)\n const removeText = sliceText(prev, offsets)\n return {\n start: offsets.start,\n end: prev.length - offsets.end,\n cursor: offsets.start + insertText.length,\n insertText,\n removeText,\n }\n}\n","import Debug from 'debug'\nimport getWindow from 'get-window'\nimport ReactDOM from 'react-dom'\nimport diffText from './diff-text'\n\n/**\n * @type {Debug}\n */\n\nconst debug = Debug('slate:composition-manager')\n\n/**\n * Unicode String for a ZERO_WIDTH_SPACE\n *\n * @type {String}\n */\n\nconst ZERO_WIDTH_SPACE = String.fromCharCode(65279)\n\n/**\n * https://github.com/facebook/draft-js/commit/cda13cb8ff9c896cdb9ff832d1edeaa470d3b871\n */\n\nconst flushControlled = ReactDOM.unstable_flushControlled\n\nfunction renderSync(editor, fn) {\n flushControlled(() => {\n fn()\n editor.controller.flush()\n })\n}\n\n/**\n * Takes text from a dom node and an offset within that text and returns an\n * object with fixed text and fixed offset which removes zero width spaces\n * and adjusts the offset.\n *\n * Optionally, if an `isLastNode` argument is passed in, it will also remove\n * a trailing newline.\n *\n * @param {String} text\n * @param {Number} offset\n * @param {Boolean} isLastNode\n */\n\nfunction fixTextAndOffset(prevText, prevOffset = 0, isLastNode = false) {\n let nextOffset = prevOffset\n let nextText = prevText\n let index = 0\n\n while (index !== -1) {\n index = nextText.indexOf(ZERO_WIDTH_SPACE, index)\n if (index === -1) break\n if (nextOffset > index) nextOffset--\n nextText = `${nextText.slice(0, index)}${nextText.slice(index + 1)}`\n }\n\n // remove the last newline if we are in the last node of a block\n const lastChar = nextText.charAt(nextText.length - 1)\n\n if (isLastNode && lastChar === '\\n') {\n nextText = nextText.slice(0, -1)\n }\n\n const maxOffset = nextText.length\n\n if (nextOffset > maxOffset) nextOffset = maxOffset\n return { text: nextText, offset: nextOffset }\n}\n\n/**\n * Based loosely on:\n *\n * https://github.com/facebook/draft-js/blob/master/src/component/handlers/composition/DOMObserver.js\n * https://github.com/ProseMirror/prosemirror-view/blob/master/src/domobserver.js\n *\n * But is an analysis mainly for `backspace` and `enter` as we handle\n * compositions as a single operation.\n *\n * @param {} element\n */\n\nfunction CompositionManager(editor) {\n /**\n * A MutationObserver that flushes to the method `flush`\n *\n * @type {MutationObserver}\n */\n\n const observer = new window.MutationObserver(flush)\n\n let win = null\n\n /**\n * Object that keeps track of the most recent state\n *\n * @type {Range}\n */\n\n const last = {\n rootEl: null, // root element that MutationObserver is attached to\n diff: null, // last text node diff between Slate and DOM\n range: null, // last range selected\n domNode: null, // last DOM node the cursor was in\n }\n\n /**\n * Connect the MutationObserver to a specific editor root element\n */\n\n function connect() {\n debug('connect', { rootEl })\n\n const rootEl = editor.findDOMNode([])\n\n if (last.rootEl === rootEl) return\n\n debug('connect:run')\n\n win = getWindow(rootEl)\n\n observer.observe(rootEl, {\n childList: true,\n characterData: true,\n attributes: true,\n subtree: true,\n characterDataOldValue: true,\n })\n }\n\n function disconnect() {\n debug('disconnect')\n observer.disconnect()\n last.rootEl = null\n }\n\n function clearDiff() {\n debug('clearDIff')\n last.diff = null\n }\n\n /**\n * Clear the `last` properties related to an action only\n */\n\n function clearAction() {\n debug('clearAction')\n last.diff = null\n last.domNode = null\n }\n\n /**\n * Apply the last `diff`\n *\n * We don't want to apply the `diff` at the time it is created because we\n * may be in a composition. There are a few things that trigger the applying\n * of the saved diff. Sometimeson its own and sometimes immediately before\n * doing something else with the Editor.\n *\n * - `onCompositionEnd` event\n * - `onSelect` event only when the user has moved into a different node\n * - The user hits `enter`\n * - The user hits `backspace` and removes an inline node\n * - The user hits `backspace` and merges two blocks\n */\n\n function applyDiff() {\n debug('applyDiff')\n const { diff } = last\n if (diff == null) return\n debug('applyDiff:run')\n const { document } = editor.value\n\n let entire = editor.value.selection\n .moveAnchorTo(diff.path, diff.start)\n .moveFocusTo(diff.path, diff.end)\n\n entire = document.resolveRange(entire)\n\n editor.insertTextAtRange(entire, diff.insertText)\n }\n\n /**\n * Handle `enter` that splits block\n */\n\n function splitBlock() {\n debug('splitBlock')\n\n renderSync(editor, () => {\n applyDiff()\n\n if (last.range) {\n editor.select(last.range)\n } else {\n debug('splitBlock:NO-SELECTION')\n }\n\n editor\n .splitBlock()\n .focus()\n .restoreDOM()\n\n clearAction()\n })\n }\n\n /**\n * Handle `backspace` that merges blocks\n */\n\n function mergeBlock() {\n debug('mergeBlock')\n\n /**\n * The delay is required because hitting `enter`, `enter` then `backspace`\n * in a word results in the cursor being one position to the right in\n * Android 9.\n *\n * Slate sets the position to `0` and we even check it immediately after\n * setting it and it is correct, but somewhere Android moves it to the right.\n *\n * This happens only when using the virtual keyboard. Hitting enter on a\n * hardware keyboard does not trigger this bug.\n *\n * The call to `focus` is required because when we switch examples then\n * merge a block, we lose focus in Android 9 (possibly others).\n */\n\n win.requestAnimationFrame(() => {\n renderSync(editor, () => {\n applyDiff()\n\n editor\n .select(last.range)\n .deleteBackward()\n .focus()\n .restoreDOM()\n\n clearAction()\n })\n })\n }\n\n /**\n * The requestId used to the save selection\n *\n * @type {Any}\n */\n\n let onSelectTimeoutId = null\n\n let bufferedMutations = []\n let startActionFrameId = null\n let isFlushing = false\n\n /**\n * Mark the beginning of an action. The action happens when the\n * `requestAnimationFrame` expires.\n *\n * If `startAction` is called again, it pushes the `action` to a new\n * `requestAnimationFrame` and cancels the old one.\n */\n\n function startAction() {\n if (onSelectTimeoutId) {\n window.cancelAnimationFrame(onSelectTimeoutId)\n onSelectTimeoutId = null\n }\n\n isFlushing = true\n\n if (startActionFrameId) window.cancelAnimationFrame(startActionFrameId)\n\n startActionFrameId = window.requestAnimationFrame(() => {\n if (bufferedMutations.length > 0) {\n flushAction(bufferedMutations)\n }\n\n startActionFrameId = null\n bufferedMutations = []\n isFlushing = false\n })\n }\n\n /**\n * Handle MutationObserver flush\n *\n * @param {MutationList} mutations\n */\n\n function flush(mutations) {\n debug('flush')\n bufferedMutations.push(...mutations)\n startAction()\n }\n\n /**\n * Handle a `requestAnimationFrame` long batch of mutations.\n *\n * @param {Array} mutations\n */\n\n function flushAction(mutations) {\n debug('flushAction', mutations.length, mutations)\n\n // If there is an expanded collection, delete it\n if (last.range && !last.range.isCollapsed) {\n renderSync(editor, () => {\n editor\n .select(last.range)\n .deleteBackward()\n .focus()\n .restoreDOM()\n })\n return\n }\n\n if (mutations.length > 1) {\n // check if one of the mutations matches the signature of an `enter`\n // which we use to signify a `splitBlock`\n const splitBlockMutation = mutations.find(m => {\n if (m.type !== 'childList') return false\n if (m.addedNodes.length === 0) return false\n const addedNode = m.addedNodes[0]\n\n // If a text node is created anywhere with a newline in it, it's an\n // enter\n if (\n addedNode.nodeType === window.Node.TEXT_NODE &&\n addedNode.textContent === '\\n'\n )\n return true\n\n // If an element is created with a key that matches a block in our\n // document, that means the mutation is splitting an existing block\n // by creating a new element with the same key.\n if (addedNode.nodeType !== window.Node.ELEMENT_NODE) return false\n const dataset = addedNode.dataset\n const key = dataset.key\n if (key == null) return false\n const block = editor.value.document.getClosestBlock(key)\n return !!block\n })\n\n if (splitBlockMutation) {\n splitBlock()\n return\n }\n }\n\n // If we haven't matched a more specific mutation already, these general\n // mutation catchers will try and determine what the user was trying to\n // do.\n\n const firstMutation = mutations[0]\n\n if (firstMutation.type === 'characterData') {\n resolveDOMNode(firstMutation.target.parentNode)\n } else if (firstMutation.type === 'childList') {\n if (firstMutation.removedNodes.length > 0) {\n if (mutations.length === 1) {\n removeNode(firstMutation.removedNodes[0])\n } else {\n mergeBlock()\n }\n } else if (firstMutation.addedNodes.length > 0) {\n splitBlock()\n }\n }\n }\n\n /**\n * Takes a DOM Node and resolves it against Slate's Document.\n *\n * Saves the changes to `last.diff` which can be applied later using\n * `applyDiff()`\n *\n * @param {DOMNode} domNode\n */\n\n function resolveDOMNode(domNode) {\n debug('resolveDOMNode')\n\n const { value } = editor\n const { document } = value\n\n const dataElement = domNode.closest(`[data-key]`)\n const key = dataElement.dataset.key\n const path = document.getPath(key)\n const block = document.getClosestBlock(key)\n const node = document.getDescendant(key)\n const prevText = node.text\n\n // COMPAT: If this is the last leaf, and the DOM text ends in a new line,\n // we will have added another new line in 's render method to account\n // for browsers collapsing a single trailing new lines, so remove it.\n const isLastNode = block.nodes.last() === node\n\n const fix = fixTextAndOffset(domNode.textContent, 0, isLastNode)\n\n const nextText = fix.text\n\n // If the text is no different, there is no diff.\n if (nextText === prevText) {\n last.diff = null\n return\n }\n\n const diff = diffText(prevText, nextText)\n\n last.diff = {\n path,\n start: diff.start,\n end: diff.end,\n insertText: diff.insertText,\n }\n\n debug('resolveDOMNode:diff', last.diff)\n }\n\n /**\n * Remove an Inline DOM Node.\n *\n * Happens when you delete the last character in an Inline DOM Node\n */\n\n function removeNode(domNode) {\n debug('removeNode')\n if (domNode.nodeType !== window.Node.ELEMENT_NODE) return\n const { value } = editor\n const { document, selection } = value\n const node = editor.findNode(domNode)\n const nodeSelection = document.resolveRange(\n selection.moveToRangeOfNode(node)\n )\n\n renderSync(editor, () => {\n editor\n .select(nodeSelection)\n .delete()\n .restoreDOM()\n })\n }\n\n /**\n * handle `onCompositionStart`\n */\n\n function onCompositionStart() {\n debug('onCompositionStart')\n }\n\n /**\n * handle `onCompositionEnd`\n */\n\n function onCompositionEnd() {\n debug('onCompositionEnd')\n\n /**\n * The timing on the `setTimeout` with `20` ms is sensitive.\n *\n * It cannot use `requestAnimationFrame` because it is too short.\n *\n * Android 9, for example, when you type `it ` the space will first trigger\n * a `compositionEnd` for the `it` part before the mutation for the ` `.\n * This means that we end up with `it` if we trigger too soon because it\n * is on the wrong value.\n */\n\n window.setTimeout(() => {\n if (last.diff) {\n debug('onCompositionEnd:applyDiff')\n\n renderSync(editor, () => {\n applyDiff()\n\n const domRange = win.getSelection().getRangeAt(0)\n const domText = domRange.startContainer.textContent\n const offset = domRange.startOffset\n\n const fix = fixTextAndOffset(domText, offset)\n\n const range = editor\n .findRange({\n anchorNode: domRange.startContainer,\n anchorOffset: 0,\n focusNode: domRange.startContainer,\n focusOffset: 0,\n isCollapsed: true,\n })\n .moveTo(fix.offset)\n\n /**\n * We must call `restoreDOM` even though this is applying a `diff` which\n * should not require it. But if you type `it me. no.` on a blank line\n * with a block following it, the next line will merge with the this\n * line. A mysterious `keydown` with `input` of backspace appears in the\n * event stream which the user not React caused.\n *\n * `focus` is required as well because otherwise we lose focus on hitting\n * `enter` in such a scenario.\n */\n\n editor\n .select(range)\n .focus()\n .restoreDOM()\n })\n }\n\n clearAction()\n }, 20)\n }\n\n /**\n * Handle `onSelect` event\n *\n * Save the selection after a `requestAnimationFrame`\n *\n * - If we're not in the middle of flushing mutations\n * - and cancel save if a mutation runs before the `requestAnimationFrame`\n */\n\n function onSelect(event) {\n debug('onSelect:try')\n\n // Event can be Synthetic React or native. Grab only the native one so\n // that we don't have to call `event.perist` for performance.\n event = event.nativeEvent ? event.nativeEvent : event\n\n window.cancelAnimationFrame(onSelectTimeoutId)\n onSelectTimeoutId = null\n\n // Don't capture the last selection if the selection was made during the\n // flushing of DOM mutations. This means it is all part of one user action.\n if (isFlushing) return\n\n onSelectTimeoutId = window.requestAnimationFrame(() => {\n debug('onSelect:save-selection')\n\n const domSelection = getWindow(event.target).getSelection()\n let range = editor.findRange(domSelection)\n\n const anchorFix = fixTextAndOffset(\n domSelection.anchorNode.textContent,\n domSelection.anchorOffset\n )\n\n const focusFix = fixTextAndOffset(\n domSelection.focusNode.textContent,\n domSelection.focusOffset\n )\n\n if (range.anchor.offset !== anchorFix.offset) {\n range = range.set(\n 'anchor',\n range.anchor.set('offset', anchorFix.offset)\n )\n }\n\n if (range.focus.offset !== focusFix.offset) {\n range = range.set('focus', range.focus.set('offset', focusFix.offset))\n }\n\n debug('onSelect:save-data', {\n domSelection: normalizeDOMSelection(domSelection),\n range: range.toJS(),\n })\n\n // If the `domSelection` has moved into a new node, then reconcile with\n // `applyDiff`\n if (\n domSelection.isCollapsed &&\n last.node !== domSelection.anchorNode &&\n last.diff != null\n ) {\n debug('onSelect:applyDiff', last.diff)\n applyDiff()\n editor.select(range)\n clearAction()\n }\n\n last.range = range\n last.node = domSelection.anchorNode\n })\n }\n\n return {\n clearDiff,\n connect,\n disconnect,\n onKeyDown: startAction,\n onCompositionStart,\n onCompositionEnd,\n onSelect,\n }\n}\n\nfunction normalizeDOMSelection(selection) {\n return {\n anchorNode: selection.anchorNode,\n anchorOffset: selection.anchorOffset,\n focusNode: selection.focusNode,\n focusOffset: selection.focusOffset,\n }\n}\n\nexport default CompositionManager\n","import getWindow from 'get-window'\nimport CompositionManager from './composition-manager'\n\n/**\n * Fixes a selection within the DOM when the cursor is in Slate's special\n * zero-width block. Slate handles empty blocks in a special manner and the\n * cursor can end up either before or after the non-breaking space. This\n * causes different behavior in Android and so we make sure the seleciton is\n * always before the zero-width space.\n *\n * @param {Window} window\n */\n\nfunction fixSelectionInZeroWidthBlock(window) {\n const domSelection = window.getSelection()\n const { anchorNode } = domSelection\n if (anchorNode == null) return\n const { dataset } = anchorNode.parentElement\n const isZeroWidth = dataset ? dataset.slateZeroWidth === 'n' : false\n\n if (\n isZeroWidth &&\n anchorNode.textContent.length === 1 &&\n domSelection.anchorOffset !== 0\n ) {\n const range = window.document.createRange()\n range.setStart(anchorNode, 0)\n range.setEnd(anchorNode, 0)\n domSelection.removeAllRanges()\n domSelection.addRange(range)\n }\n}\n\n/**\n * Android Plugin\n *\n * @param {Editor} options.editor\n */\n\nfunction AndroidPlugin({ editor }) {\n const observer = new CompositionManager(editor)\n\n /**\n * handle `onCompositionStart`\n */\n\n function onCompositionStart() {\n observer.onCompositionStart()\n }\n\n /**\n * handle `onCompositionEnd`\n */\n\n function onCompositionEnd() {\n observer.onCompositionEnd()\n }\n\n /**\n * handle `onSelect`\n *\n * @param {Event} event\n */\n\n function onSelect(event) {\n const window = getWindow(event.target)\n fixSelectionInZeroWidthBlock(window)\n observer.onSelect(event)\n }\n\n /**\n * handle `onComponentDidMount`\n */\n\n function onComponentDidMount() {\n observer.connect()\n }\n\n /**\n * handle `onComponentDidUpdate`\n */\n\n function onComponentDidUpdate() {\n observer.connect()\n }\n\n /**\n * handle `onComponentWillUnmount`\n *\n * @param {Event} event\n */\n\n function onComponentWillUnmount() {\n observer.disconnect()\n }\n\n /**\n * handle `onRender`\n *\n * @param {Event} event\n */\n\n function onRender() {\n observer.disconnect()\n\n // We don't want the `diff` from a previous render to apply to a\n // potentially different value (e.g. when we switch examples)\n observer.clearDiff()\n }\n\n return {\n onComponentDidMount,\n onComponentDidUpdate,\n onComponentWillUnmount,\n onCompositionEnd,\n onCompositionStart,\n onRender,\n onSelect,\n }\n}\n\nexport default AndroidPlugin\n","import EVENT_HANDLERS from '../../constants/event-handlers'\n\n/**\n * This plugin prevents events from going any further and is useful in dev.\n *\n * The purpose is to see how the editor events and mutations behave without\n * the noise of the editor also adding its own events and mutations.\n *\n * IMPORTANT:\n *\n * This plugin is detached (i.e. there is no way to turn it on in Slate).\n * You must hard code it into `plugins/react/index`.\n *\n * @return {Object}\n */\n\nfunction NoopPlugin() {\n /**\n * Plugin Object\n *\n * @type {Object}\n */\n\n const plugin = {}\n\n for (const eventName of EVENT_HANDLERS) {\n plugin[eventName] = function(event, editor, next) {}\n }\n\n /**\n * Return the plugin.\n *\n * @type {Object}\n */\n\n return plugin\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default NoopPlugin\n","/**\n * The transfer types that Slate recognizes.\n *\n * @type {Object}\n */\n\nexport default {\n FRAGMENT: 'application/x-slate-fragment',\n HTML: 'text/html',\n NODE: 'application/x-slate-node',\n RICH: 'text/rtf',\n TEXT: 'text/plain',\n}\n","import Base64 from 'slate-base64-serializer'\nimport Plain from 'slate-plain-serializer'\nimport getWindow from 'get-window'\nimport invariant from 'tiny-invariant'\nimport { IS_IE } from 'slate-dev-environment'\nimport { Value } from 'slate'\n\nimport TRANSFER_TYPES from '../constants/transfer-types'\nimport removeAllRanges from './remove-all-ranges'\nimport DATA_ATTRS from '../constants/data-attributes'\nimport SELECTORS from '../constants/selectors'\n\nconst { FRAGMENT, HTML, TEXT } = TRANSFER_TYPES\n\n/**\n * Prepares a Slate document fragment to be copied to the clipboard.\n *\n * @param {Event} event\n * @param {Editor} editor\n */\n\nfunction cloneFragment(event, editor, callback = () => undefined) {\n invariant(\n !Value.isValue(editor),\n 'As of Slate 0.42.0, the `cloneFragment` utility takes an `editor` instead of a `value`.'\n )\n\n const window = getWindow(event.target)\n const native = window.getSelection()\n const { value } = editor\n const { document, fragment, selection } = value\n const { start, end } = selection\n const startVoid = document.getClosestVoid(start.path, editor)\n const endVoid = document.getClosestVoid(end.path, editor)\n\n // If the selection is collapsed, and it isn't inside a void node, abort.\n if (native.isCollapsed && !startVoid) return\n\n // Create a fake selection so that we can add a Base64-encoded copy of the\n // fragment to the HTML, to decode on future pastes.\n const encoded = Base64.serializeNode(fragment)\n const range = native.getRangeAt(0)\n let contents = range.cloneContents()\n let attach = contents.childNodes[0]\n\n // Make sure attach is a non-empty node, since empty nodes will not get copied\n contents.childNodes.forEach(node => {\n if (node.textContent && node.textContent.trim() !== '') {\n attach = node\n }\n })\n\n // COMPAT: If the end node is a void node, we need to move the end of the\n // range from the void node's spacer span, to the end of the void node's\n // content, since the spacer is before void's content in the DOM.\n if (endVoid) {\n const r = range.cloneRange()\n const path = document.getPath(endVoid.key)\n\n if (path) {\n const node = editor.findDOMNode(path)\n r.setEndAfter(node)\n contents = r.cloneContents()\n }\n }\n\n // COMPAT: If the start node is a void node, we need to attach the encoded\n // fragment to the void node's content node instead of the spacer, because\n // attaching it to empty `
/` nodes will end up having it erased by\n // most browsers. (2018/04/27)\n if (startVoid) {\n attach = contents.childNodes[0].childNodes[1].firstChild\n }\n\n // Remove any zero-width space spans from the cloned DOM so that they don't\n // show up elsewhere when pasted.\n ;[].slice\n .call(contents.querySelectorAll(SELECTORS.ZERO_WIDTH))\n .forEach(zw => {\n const isNewline = zw.getAttribute(DATA_ATTRS.ZERO_WIDTH) === 'n'\n zw.textContent = isNewline ? '\\n' : ''\n })\n\n // Set a `data-slate-fragment` attribute on a non-empty node, so it shows up\n // in the HTML, and can be used for intra-Slate pasting. If it's a text\n // node, wrap it in a `` so we have something to set an attribute on.\n if (attach.nodeType === 3) {\n const span = window.document.createElement('span')\n\n // COMPAT: In Chrome and Safari, if we don't add the `white-space` style\n // then leading and trailing spaces will be ignored. (2017/09/21)\n span.style.whiteSpace = 'pre'\n\n span.appendChild(attach)\n contents.appendChild(span)\n attach = span\n }\n\n attach.setAttribute(DATA_ATTRS.FRAGMENT, encoded)\n\n // Creates value from only the selected blocks\n // Then gets plaintext for clipboard with proper linebreaks for BLOCK elements\n // Via Plain serializer\n const valFromSelection = Value.create({ document: fragment })\n const plainText = Plain.serialize(valFromSelection)\n\n // Add the phony content to a div element. This is needed to copy the\n // contents into the html clipboard register.\n const div = window.document.createElement('div')\n div.appendChild(contents)\n\n // For browsers supporting it, we set the clipboard registers manually,\n // since the result is more predictable.\n // COMPAT: IE supports the setData method, but only in restricted sense.\n // IE doesn't support arbitrary MIME types or common ones like 'text/plain';\n // it only accepts \"Text\" (which gets mapped to 'text/plain') and \"Url\"\n // (mapped to 'text/url-list'); so, we should only enter block if !IS_IE\n if (event.clipboardData && event.clipboardData.setData && !IS_IE) {\n event.preventDefault()\n event.clipboardData.setData(TEXT, plainText)\n event.clipboardData.setData(FRAGMENT, encoded)\n event.clipboardData.setData(HTML, div.innerHTML)\n callback()\n return\n }\n\n // COMPAT: For browser that don't support the Clipboard API's setData method,\n // we must rely on the browser to natively copy what's selected.\n // So we add the div (containing our content) to the DOM, and select it.\n const editorEl = event.target.closest(SELECTORS.EDITOR)\n div.setAttribute('contenteditable', true)\n div.style.position = 'absolute'\n div.style.left = '-9999px'\n editorEl.appendChild(div)\n native.selectAllChildren(div)\n\n // Revert to the previous selection right after copying.\n window.requestAnimationFrame(() => {\n editorEl.removeChild(div)\n removeAllRanges(native)\n native.addRange(range)\n callback()\n })\n}\n\nexport default cloneFragment\n","import Base64 from 'slate-base64-serializer'\nimport { IS_IE } from 'slate-dev-environment'\n\nimport TRANSFER_TYPES from '../constants/transfer-types'\nimport DATA_ATTRS from '../constants/data-attributes'\n\n/**\n * Transfer types.\n *\n * @type {String}\n */\n\nconst { FRAGMENT, HTML, NODE, RICH, TEXT } = TRANSFER_TYPES\n\n/**\n * Fragment matching regexp for HTML nodes.\n *\n * @type {RegExp}\n */\n\nconst FRAGMENT_MATCHER = / data-slate-fragment=\"([^\\s\"]+)\"/\n\n/**\n * Get the transfer data from an `event`.\n *\n * @param {Event} event\n * @return {Object}\n */\n\nfunction getEventTransfer(event) {\n // COMPAT: IE 11 doesn't populate nativeEvent with either\n // dataTransfer or clipboardData. We'll need to use the base event\n // object (2018/14/6)\n if (!IS_IE && event.nativeEvent) {\n event = event.nativeEvent\n }\n\n const transfer = event.dataTransfer || event.clipboardData\n let fragment = getType(transfer, FRAGMENT)\n let node = getType(transfer, NODE)\n const html = getType(transfer, HTML)\n const rich = getType(transfer, RICH)\n let text = getType(transfer, TEXT)\n let files\n\n // If there isn't a fragment, but there is HTML, check to see if the HTML is\n // actually an encoded fragment.\n if (!fragment && html && ~html.indexOf(` ${DATA_ATTRS.FRAGMENT}=\"`)) {\n const matches = FRAGMENT_MATCHER.exec(html)\n const [full, encoded] = matches // eslint-disable-line no-unused-vars\n if (encoded) fragment = encoded\n }\n\n // COMPAT: Edge doesn't handle custom data types\n // These will be embedded in text/plain in this case (2017/7/12)\n if (text) {\n const embeddedTypes = getEmbeddedTypes(text)\n\n if (embeddedTypes[FRAGMENT]) fragment = embeddedTypes[FRAGMENT]\n if (embeddedTypes[NODE]) node = embeddedTypes[NODE]\n if (embeddedTypes[TEXT]) text = embeddedTypes[TEXT]\n }\n\n // Decode a fragment or node if they exist.\n if (fragment) fragment = Base64.deserializeNode(fragment)\n if (node) node = Base64.deserializeNode(node)\n\n // COMPAT: Edge sometimes throws 'NotSupportedError'\n // when accessing `transfer.items` (2017/7/12)\n try {\n // Get and normalize files if they exist.\n if (transfer.items && transfer.items.length) {\n files = Array.from(transfer.items)\n .map(item => (item.kind === 'file' ? item.getAsFile() : null))\n .filter(exists => exists)\n } else if (transfer.files && transfer.files.length) {\n files = Array.from(transfer.files)\n }\n } catch (err) {\n if (transfer.files && transfer.files.length) {\n files = Array.from(transfer.files)\n }\n }\n\n // Determine the type of the data.\n const data = { files, fragment, html, node, rich, text }\n data.type = getTransferType(data)\n return data\n}\n\n/**\n * Takes text input, checks whether contains embedded data\n * and returns object with original text +/- additional data\n *\n * @param {String} text\n * @return {Object}\n */\n\nfunction getEmbeddedTypes(text) {\n const prefix = 'SLATE-DATA-EMBED::'\n\n if (text.substring(0, prefix.length) !== prefix) {\n return { TEXT: text }\n }\n\n // Attempt to parse, if fails then just standard text/plain\n // Otherwise, already had data embedded\n try {\n return JSON.parse(text.substring(prefix.length))\n } catch (err) {\n throw new Error('Unable to parse custom Slate drag event data.')\n }\n}\n\n/**\n * Get the type of a transfer from its `data`.\n *\n * @param {Object} data\n * @return {String}\n */\n\nfunction getTransferType(data) {\n if (data.fragment) return 'fragment'\n if (data.node) return 'node'\n\n // COMPAT: Microsoft Word adds an image of the selected text to the data.\n // Since files are preferred over HTML or text, this would cause the type to\n // be considered `files`. But it also adds rich text data so we can check\n // for that and properly set the type to `html` or `text`. (2016/11/21)\n if (data.rich && data.html) return 'html'\n if (data.rich && data.text) return 'text'\n\n if (data.files && data.files.length) return 'files'\n if (data.html) return 'html'\n if (data.text) return 'text'\n return 'unknown'\n}\n\n/**\n * Get one of types `TYPES.FRAGMENT`, `TYPES.NODE`, `text/html`, `text/rtf` or\n * `text/plain` from transfers's `data` if possible, otherwise return null.\n *\n * @param {Object} transfer\n * @param {String} type\n * @return {String}\n */\n\nfunction getType(transfer, type) {\n if (!transfer.types || !transfer.types.length) {\n // COMPAT: In IE 11, there is no `types` field but `getData('Text')`\n // is supported`. (2017/06/23)\n return type === TEXT ? transfer.getData('Text') || null : null\n }\n\n // COMPAT: In Edge, transfer.types doesn't respond to `indexOf`. (2017/10/25)\n const types = Array.from(transfer.types)\n\n return types.indexOf(type) !== -1 ? transfer.getData(type) || null : null\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default getEventTransfer\n","import TRANSFER_TYPES from '../constants/transfer-types'\n\n/**\n * The default plain text transfer type.\n *\n * @type {String}\n */\n\nconst { TEXT } = TRANSFER_TYPES\n\n/**\n * Set data with `type` and `content` on an `event`.\n *\n * COMPAT: In Edge, custom types throw errors, so embed all non-standard\n * types in text/plain compound object. (2017/7/12)\n *\n * @param {Event} event\n * @param {String} type\n * @param {String} content\n */\n\nfunction setEventTransfer(event, type, content) {\n const mime = TRANSFER_TYPES[type.toUpperCase()]\n\n if (!mime) {\n throw new Error(`Cannot set unknown transfer type \"${mime}\".`)\n }\n\n if (event.nativeEvent) {\n event = event.nativeEvent\n }\n\n const transfer = event.dataTransfer || event.clipboardData\n\n try {\n transfer.setData(mime, content)\n // COMPAT: Safari needs to have the 'text' (and not 'text/plain') value in dataTransfer\n // to display the cursor while dragging internally.\n transfer.setData('text', transfer.getData('text'))\n } catch (err) {\n const prefix = 'SLATE-DATA-EMBED::'\n const text = transfer.getData(TEXT)\n let obj = {}\n\n // If the existing plain text data is prefixed, it's Slate JSON data.\n if (text.substring(0, prefix.length) === prefix) {\n try {\n obj = JSON.parse(text.substring(prefix.length))\n } catch (e) {\n throw new Error(\n 'Failed to parse Slate data from `DataTransfer` object.'\n )\n }\n } else {\n // Otherwise, it's just set it as is.\n obj[TEXT] = text\n }\n\n obj[mime] = content\n const string = `${prefix}${JSON.stringify(obj)}`\n transfer.setData(TEXT, string)\n }\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default setEventTransfer\n","import Base64 from 'slate-base64-serializer'\nimport Debug from 'debug'\nimport Hotkeys from 'slate-hotkeys'\nimport Plain from 'slate-plain-serializer'\nimport getWindow from 'get-window'\nimport { IS_IOS, IS_IE, IS_EDGE } from 'slate-dev-environment'\n\nimport cloneFragment from '../../utils/clone-fragment'\nimport getEventTransfer from '../../utils/get-event-transfer'\nimport setEventTransfer from '../../utils/set-event-transfer'\n\n/**\n * Debug.\n *\n * @type {Function}\n */\n\nconst debug = Debug('slate:after')\n\n/**\n * A plugin that adds the \"after\" browser-specific logic to the editor.\n *\n * @param {Object} options\n * @return {Object}\n */\n\nfunction AfterPlugin(options = {}) {\n let isDraggingInternally = null\n let isMouseDown = false\n\n /**\n * On before input.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onBeforeInput(event, editor, next) {\n const { value } = editor\n const isSynthetic = !!event.nativeEvent\n\n // If the event is synthetic, it's React's polyfill of `beforeinput` that\n // isn't a true `beforeinput` event with meaningful information. It only\n // gets triggered for character insertions, so we can just insert directly.\n if (isSynthetic) {\n event.preventDefault()\n editor.insertText(event.data)\n return next()\n }\n\n // Otherwise, we can use the information in the `beforeinput` event to\n // figure out the exact change that will occur, and prevent it.\n const [targetRange] = event.getTargetRanges()\n if (!targetRange) return next()\n\n debug('onBeforeInput', { event })\n\n event.preventDefault()\n\n const { document, selection } = value\n const range = editor.findRange(targetRange)\n\n switch (event.inputType) {\n case 'deleteByDrag':\n case 'deleteByCut':\n case 'deleteContent':\n case 'deleteContentBackward':\n case 'deleteContentForward': {\n editor.deleteAtRange(range)\n break\n }\n\n case 'deleteWordBackward': {\n editor.deleteWordBackwardAtRange(range)\n break\n }\n\n case 'deleteWordForward': {\n editor.deleteWordForwardAtRange(range)\n break\n }\n\n case 'deleteSoftLineBackward':\n case 'deleteHardLineBackward': {\n editor.deleteLineBackwardAtRange(range)\n break\n }\n\n case 'deleteSoftLineForward':\n case 'deleteHardLineForward': {\n editor.deleteLineForwardAtRange(range)\n break\n }\n\n case 'insertLineBreak':\n case 'insertParagraph': {\n const hasVoidParent = document.hasVoidParent(\n selection.start.path,\n editor\n )\n\n if (hasVoidParent) {\n editor.moveToStartOfNextText()\n } else {\n editor.splitBlockAtRange(range)\n }\n\n break\n }\n\n case 'insertFromYank':\n case 'insertReplacementText':\n case 'insertText': {\n // COMPAT: `data` should have the text for the `insertText` input type\n // and `dataTransfer` should have the text for the\n // `insertReplacementText` input type, but Safari uses `insertText` for\n // spell check replacements and sets `data` to `null`. (2018/08/09)\n const text =\n event.data == null\n ? event.dataTransfer.getData('text/plain')\n : event.data\n\n if (text == null) break\n\n editor.insertTextAtRange(range, text, selection.marks)\n\n // If the text was successfully inserted, and the selection had marks\n // on it, unset the selection's marks.\n if (selection.marks && value.document !== editor.value.document) {\n editor.select({ marks: null })\n }\n\n break\n }\n }\n\n next()\n }\n\n /**\n * On blur.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onBlur(event, editor, next) {\n debug('onBlur', { event })\n editor.blur()\n next()\n }\n\n /**\n * On click.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onClick(event, editor, next) {\n if (editor.readOnly) return next()\n\n const { value } = editor\n const { document } = value\n const path = editor.findPath(event.target)\n if (!path) return next()\n\n debug('onClick', { event })\n\n const node = document.getNode(path)\n const ancestors = document.getAncestors(path)\n const isVoid =\n node && (editor.isVoid(node) || ancestors.some(a => editor.isVoid(a)))\n\n if (isVoid) {\n // COMPAT: In Chrome & Safari, selections that are at the zero offset of\n // an inline node will be automatically replaced to be at the last offset\n // of a previous inline node, which screws us up, so we always want to set\n // it to the end of the node. (2016/11/29)\n editor.focus().moveToEndOfNode(node)\n }\n\n next()\n }\n\n /**\n * On copy.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onCopy(event, editor, next) {\n debug('onCopy', { event })\n cloneFragment(event, editor)\n next()\n }\n\n /**\n * On cut.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onCut(event, editor, next) {\n debug('onCut', { event })\n\n // Once the fake cut content has successfully been added to the clipboard,\n // delete the content in the current selection.\n cloneFragment(event, editor, () => {\n // If user cuts a void block node or a void inline node,\n // manually removes it since selection is collapsed in this case.\n const { value } = editor\n const { document, selection } = value\n const { end, isCollapsed } = selection\n let voidPath\n\n if (isCollapsed) {\n for (const [node, path] of document.ancestors(end.path)) {\n if (editor.isVoid(node)) {\n voidPath = path\n break\n }\n }\n }\n\n if (voidPath) {\n editor.removeNodeByKey(voidPath)\n } else {\n editor.delete()\n }\n })\n\n next()\n }\n\n /**\n * On drag end.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onDragEnd(event, editor, next) {\n debug('onDragEnd', { event })\n isDraggingInternally = null\n next()\n }\n\n /**\n * On drag start.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onDragStart(event, editor, next) {\n debug('onDragStart', { event })\n\n isDraggingInternally = true\n\n const { value } = editor\n const { document } = value\n const path = editor.findPath(event.target)\n const node = document.getNode(path)\n const ancestors = document.getAncestors(path)\n const isVoid =\n node && (editor.isVoid(node) || ancestors.some(a => editor.isVoid(a)))\n const selectionIncludesNode = value.blocks.some(block => block === node)\n\n // If a void block is dragged and is not selected, select it (necessary for local drags).\n if (isVoid && !selectionIncludesNode) {\n editor.moveToRangeOfNode(node)\n }\n\n const fragment = editor.value.fragment\n const encoded = Base64.serializeNode(fragment)\n setEventTransfer(event, 'fragment', encoded)\n next()\n }\n\n /**\n * On drop.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onDrop(event, editor, next) {\n const { value } = editor\n const { document, selection } = value\n const window = getWindow(event.target)\n const target = editor.findEventRange(event)\n\n if (!target) {\n return next()\n }\n\n debug('onDrop', { event })\n\n const transfer = getEventTransfer(event)\n const { type, fragment, text } = transfer\n\n editor.focus()\n\n // COMPAT: React's onSelect event breaks after an onDrop event\n // has fired in a node: https://github.com/facebook/react/issues/11379.\n // Until this is fixed in React, we dispatch a mouseup event on that\n // DOM node, since that will make it go back to normal.\n const el = editor.findDOMNode(target.focus.path)\n\n if (el) {\n el.dispatchEvent(\n new MouseEvent('mouseup', {\n view: window,\n bubbles: true,\n cancelable: true,\n })\n )\n }\n\n const draggedRange = selection\n\n editor.select(target)\n\n if (isDraggingInternally) {\n editor.deleteAtRange(draggedRange)\n }\n\n if (type === 'text' || type === 'html') {\n const { anchor } = target\n let hasVoidParent = document.hasVoidParent(anchor.path, editor)\n\n if (hasVoidParent) {\n let p = anchor.path\n let n = document.getNode(anchor.path)\n\n while (hasVoidParent) {\n const [nxt] = document.texts({ path: p })\n\n if (!nxt) {\n break\n }\n\n ;[n, p] = nxt\n hasVoidParent = document.hasVoidParent(p, editor)\n }\n\n if (n) editor.moveToStartOfNode(n)\n }\n\n if (text) {\n text.split('\\n').forEach((line, i) => {\n if (i > 0) editor.splitBlock()\n editor.insertText(line)\n })\n }\n }\n\n if (type === 'fragment') {\n editor.insertFragment(fragment)\n }\n\n next()\n }\n\n /**\n * On focus.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onFocus(event, editor, next) {\n debug('onFocus', { event })\n\n // COMPAT: If the focus event is a mouse-based one, it will be shortly\n // followed by a `selectionchange`, so we need to deselect here to prevent\n // the old selection from being set by the `updateSelection` of ``,\n // preventing the `selectionchange` from firing. (2018/11/07)\n if (isMouseDown && !IS_IE && !IS_EDGE) {\n editor.deselect().focus()\n } else {\n editor.focus()\n }\n\n next()\n }\n\n /**\n * On input.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onInput(event, editor, next) {\n debug('onInput')\n\n const window = getWindow(event.target)\n const domSelection = window.getSelection()\n const selection = editor.findSelection(domSelection)\n\n if (selection) {\n editor.select(selection)\n } else {\n editor.blur()\n }\n\n const { anchorNode } = domSelection\n editor.reconcileDOMNode(anchorNode)\n\n next()\n }\n\n /**\n * On key down.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onKeyDown(event, editor, next) {\n debug('onKeyDown', { event })\n\n const { value } = editor\n const { document, selection } = value\n const { start } = selection\n const hasVoidParent = document.hasVoidParent(start.path, editor)\n\n // COMPAT: In iOS, some of these hotkeys are handled in the\n // `onNativeBeforeInput` handler of the `` component in order to\n // preserve native autocorrect behavior, so they shouldn't be handled here.\n if (Hotkeys.isSplitBlock(event) && !IS_IOS) {\n return hasVoidParent\n ? editor.moveToStartOfNextText()\n : editor.splitBlock()\n }\n\n if (Hotkeys.isDeleteBackward(event) && !IS_IOS) {\n return editor.deleteCharBackward()\n }\n\n if (Hotkeys.isDeleteForward(event) && !IS_IOS) {\n return editor.deleteCharForward()\n }\n\n if (Hotkeys.isDeleteLineBackward(event)) {\n return editor.deleteLineBackward()\n }\n\n if (Hotkeys.isDeleteLineForward(event)) {\n return editor.deleteLineForward()\n }\n\n if (Hotkeys.isDeleteWordBackward(event)) {\n return editor.deleteWordBackward()\n }\n\n if (Hotkeys.isDeleteWordForward(event)) {\n return editor.deleteWordForward()\n }\n\n if (Hotkeys.isRedo(event)) {\n return editor.redo()\n }\n\n if (Hotkeys.isUndo(event)) {\n return editor.undo()\n }\n\n // COMPAT: Certain browsers don't handle the selection updates properly. In\n // Chrome, the selection isn't properly extended. And in Firefox, the\n // selection isn't properly collapsed. (2017/10/17)\n if (Hotkeys.isMoveLineBackward(event)) {\n event.preventDefault()\n return editor.moveToStartOfBlock()\n }\n\n if (Hotkeys.isMoveLineForward(event)) {\n event.preventDefault()\n return editor.moveToEndOfBlock()\n }\n\n if (Hotkeys.isExtendLineBackward(event)) {\n event.preventDefault()\n return editor.moveFocusToStartOfBlock()\n }\n\n if (Hotkeys.isExtendLineForward(event)) {\n event.preventDefault()\n return editor.moveFocusToEndOfBlock()\n }\n\n // COMPAT: If a void node is selected, or a zero-width text node adjacent to\n // an inline is selected, we need to handle these hotkeys manually because\n // browsers won't know what to do.\n if (Hotkeys.isMoveBackward(event)) {\n event.preventDefault()\n\n if (!selection.isCollapsed) {\n return editor.moveToStart()\n }\n\n return editor.moveBackward()\n }\n\n if (Hotkeys.isMoveForward(event)) {\n event.preventDefault()\n\n if (!selection.isCollapsed) {\n return editor.moveToEnd()\n }\n\n return editor.moveForward()\n }\n\n if (Hotkeys.isMoveWordBackward(event)) {\n event.preventDefault()\n return editor.moveWordBackward()\n }\n\n if (Hotkeys.isMoveWordForward(event)) {\n event.preventDefault()\n return editor.moveWordForward()\n }\n\n if (Hotkeys.isExtendBackward(event)) {\n const startText = document.getNode(start.path)\n const [prevEntry] = document.texts({\n path: start.path,\n direction: 'backward',\n })\n\n let isPrevInVoid = false\n\n if (prevEntry) {\n const [, prevPath] = prevEntry\n isPrevInVoid = document.hasVoidParent(prevPath, editor)\n }\n\n if (hasVoidParent || isPrevInVoid || startText.text === '') {\n event.preventDefault()\n return editor.moveFocusBackward()\n }\n }\n\n if (Hotkeys.isExtendForward(event)) {\n const startText = document.getNode(start.path)\n const [nextEntry] = document.texts({ path: start.path })\n let isNextInVoid = false\n\n if (nextEntry) {\n const [, nextPath] = nextEntry\n isNextInVoid = document.hasVoidParent(nextPath, editor)\n }\n\n if (hasVoidParent || isNextInVoid || startText.text === '') {\n event.preventDefault()\n return editor.moveFocusForward()\n }\n }\n\n next()\n }\n\n /**\n * On mouse down.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onMouseDown(event, editor, next) {\n debug('onMouseDown', { event })\n isMouseDown = true\n next()\n }\n\n /**\n * On mouse up.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onMouseUp(event, editor, next) {\n debug('onMouseUp', { event })\n isMouseDown = false\n next()\n }\n\n /**\n * On paste.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onPaste(event, editor, next) {\n debug('onPaste', { event })\n\n const { value } = editor\n const transfer = getEventTransfer(event)\n const { type, fragment, text } = transfer\n\n if (type === 'fragment') {\n editor.insertFragment(fragment)\n }\n\n if (type === 'text' || type === 'html') {\n if (!text) return next()\n const { document, selection, startBlock } = value\n if (editor.isVoid(startBlock)) return next()\n\n const defaultBlock = startBlock\n const defaultMarks = document.getInsertMarksAtRange(selection)\n const frag = Plain.deserialize(text, { defaultBlock, defaultMarks })\n .document\n editor.insertFragment(frag)\n }\n\n next()\n }\n\n /**\n * On select.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onSelect(event, editor, next) {\n debug('onSelect', { event })\n const window = getWindow(event.target)\n const domSelection = window.getSelection()\n const selection = editor.findSelection(domSelection)\n\n if (selection) {\n editor.select(selection)\n } else {\n editor.blur()\n }\n\n // COMPAT: reset the `isMouseDown` state here in case a `mouseup` event\n // happens outside the editor. This is needed for `onFocus` handling.\n isMouseDown = false\n\n next()\n }\n\n /**\n * Return the plugin.\n *\n * @type {Object}\n */\n\n return {\n onBeforeInput,\n onBlur,\n onClick,\n onCopy,\n onCut,\n onDragEnd,\n onDragStart,\n onDrop,\n onFocus,\n onInput,\n onKeyDown,\n onMouseDown,\n onMouseUp,\n onPaste,\n onSelect,\n }\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default AfterPlugin\n","import Debug from 'debug'\nimport Hotkeys from 'slate-hotkeys'\nimport getWindow from 'get-window'\nimport {\n IS_FIREFOX,\n IS_IE,\n IS_IOS,\n HAS_INPUT_EVENTS_LEVEL_2,\n} from 'slate-dev-environment'\n\nimport DATA_ATTRS from '../../constants/data-attributes'\n\n/**\n * Debug.\n *\n * @type {Function}\n */\n\nconst debug = Debug('slate:before')\n\n/**\n * A plugin that adds the \"before\" browser-specific logic to the editor.\n *\n * @return {Object}\n */\n\nfunction BeforePlugin() {\n let activeElement = null\n let compositionCount = 0\n let isComposing = false\n let isCopying = false\n let isDragging = false\n let isUserActionPerformed = false\n\n /**\n * On before input.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onBeforeInput(event, editor, next) {\n const isSynthetic = !!event.nativeEvent\n if (editor.readOnly) return\n isUserActionPerformed = true\n\n // COMPAT: If the browser supports Input Events Level 2, we will have\n // attached a custom handler for the real `beforeinput` events, instead of\n // allowing React's synthetic polyfill, so we need to ignore synthetics.\n if (isSynthetic && HAS_INPUT_EVENTS_LEVEL_2) return\n\n debug('onBeforeInput', { event })\n next()\n }\n\n /**\n * On blur.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onBlur(event, editor, next) {\n if (isCopying) return\n if (editor.readOnly) return\n\n const { relatedTarget, target } = event\n const window = getWindow(target)\n\n // COMPAT: If the current `activeElement` is still the previous one, this is\n // due to the window being blurred when the tab itself becomes unfocused, so\n // we want to abort early to allow to editor to stay focused when the tab\n // becomes focused again.\n if (activeElement === window.document.activeElement) return\n\n // COMPAT: The `relatedTarget` can be null when the new focus target is not\n // a \"focusable\" element (eg. a `
` without `tabindex` set).\n if (relatedTarget) {\n const el = editor.findDOMNode([])\n\n // COMPAT: The event should be ignored if the focus is returning to the\n // editor from an embedded editable element (eg. an element inside\n // a void node).\n if (relatedTarget === el) return\n\n // COMPAT: The event should be ignored if the focus is moving from the\n // editor to inside a void node's spacer element.\n if (relatedTarget.hasAttribute(DATA_ATTRS.SPACER)) return\n\n // COMPAT: The event should be ignored if the focus is moving to a non-\n // editable section of an element that isn't a void node (eg. a list item\n // of the check list example).\n const node = editor.findNode(relatedTarget)\n\n if (el.contains(relatedTarget) && node && !editor.isVoid(node)) {\n return\n }\n }\n\n debug('onBlur', { event })\n next()\n }\n\n /**\n * On composition end.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onCompositionEnd(event, editor, next) {\n const n = compositionCount\n isUserActionPerformed = true\n\n // The `count` check here ensures that if another composition starts\n // before the timeout has closed out this one, we will abort unsetting the\n // `isComposing` flag, since a composition is still in affect.\n window.requestAnimationFrame(() => {\n if (compositionCount > n) return\n isComposing = false\n })\n\n debug('onCompositionEnd', { event })\n next()\n }\n\n /**\n * On click.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onClick(event, editor, next) {\n debug('onClick', { event })\n isUserActionPerformed = true\n next()\n }\n\n /**\n * On composition start.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onCompositionStart(event, editor, next) {\n isComposing = true\n compositionCount++\n\n const { value } = editor\n const { selection } = value\n isUserActionPerformed = true\n\n if (!selection.isCollapsed) {\n // https://github.com/ianstormtaylor/slate/issues/1879\n // When composition starts and the current selection is not collapsed, the\n // second composition key-down would drop the text wrapping which\n // resulted on crash in content.updateSelection after composition ends\n // (because it cannot find nodes in DOM). This is a workaround that\n // erases selection as soon as composition starts and preventing \n // to be dropped.\n editor.delete()\n }\n\n debug('onCompositionStart', { event })\n next()\n }\n\n /**\n * On copy.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onCopy(event, editor, next) {\n const window = getWindow(event.target)\n isCopying = true\n window.requestAnimationFrame(() => (isCopying = false))\n\n debug('onCopy', { event })\n next()\n }\n\n /**\n * On cut.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onCut(event, editor, next) {\n if (editor.readOnly) return\n\n const window = getWindow(event.target)\n isCopying = true\n window.requestAnimationFrame(() => (isCopying = false))\n\n debug('onCut', { event })\n next()\n }\n\n /**\n * On drag end.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onDragEnd(event, editor, next) {\n isDragging = false\n debug('onDragEnd', { event })\n next()\n }\n\n /**\n * On drag enter.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onDragEnter(event, editor, next) {\n debug('onDragEnter', { event })\n next()\n }\n\n /**\n * On drag exit.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onDragExit(event, editor, next) {\n debug('onDragExit', { event })\n next()\n }\n\n /**\n * On drag leave.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onDragLeave(event, editor, next) {\n debug('onDragLeave', { event })\n next()\n }\n\n /**\n * On drag over.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onDragOver(event, editor, next) {\n // If the target is inside a void node, and only in this case,\n // call `preventDefault` to signal that drops are allowed.\n // When the target is editable, dropping is already allowed by\n // default, and calling `preventDefault` hides the cursor.\n const node = editor.findNode(event.target)\n\n if (!node || editor.isVoid(node)) {\n event.preventDefault()\n }\n\n // COMPAT: IE won't call onDrop on contentEditables unless the\n // default dragOver is prevented:\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/913982/\n // (2018/07/11)\n if (IS_IE) {\n event.preventDefault()\n }\n\n // If a drag is already in progress, don't do this again.\n if (!isDragging) {\n isDragging = true\n\n // COMPAT: IE will raise an `unspecified error` if dropEffect is\n // set. (2018/07/11)\n if (!IS_IE) {\n event.nativeEvent.dataTransfer.dropEffect = 'move'\n }\n }\n\n debug('onDragOver', { event })\n next()\n }\n\n /**\n * On drag start.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onDragStart(event, editor, next) {\n isDragging = true\n debug('onDragStart', { event })\n next()\n }\n\n /**\n * On drop.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onDrop(event, editor, next) {\n if (editor.readOnly) return\n isUserActionPerformed = true\n\n // Prevent default so the DOM's value isn't corrupted.\n event.preventDefault()\n\n debug('onDrop', { event })\n next()\n }\n\n /**\n * On focus.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onFocus(event, editor, next) {\n if (isCopying) return\n if (editor.readOnly) return\n\n const el = editor.findDOMNode([])\n\n // Save the new `activeElement`.\n const window = getWindow(event.target)\n activeElement = window.document.activeElement\n\n // COMPAT: If the editor has nested editable elements, the focus can go to\n // those elements. In Firefox, this must be prevented because it results in\n // issues with keyboard navigation. (2017/03/30)\n if (IS_FIREFOX && event.target !== el) {\n el.focus()\n return\n }\n\n debug('onFocus', { event })\n next()\n }\n\n /**\n * On input.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onInput(event, editor, next) {\n if (isComposing) return\n if (editor.value.selection.isBlurred) return\n isUserActionPerformed = true\n debug('onInput', { event })\n next()\n }\n\n /**\n * On key down.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onKeyDown(event, editor, next) {\n if (editor.readOnly) return\n\n // When composing, we need to prevent all hotkeys from executing while\n // typing. However, certain characters also move the selection before\n // we're able to handle it, so prevent their default behavior.\n if (isComposing) {\n if (Hotkeys.isCompose(event)) event.preventDefault()\n return\n }\n\n // Certain hotkeys have native editing behaviors in `contenteditable`\n // elements which will editor the DOM and cause our value to be out of sync,\n // so they need to always be prevented.\n if (\n !IS_IOS &&\n (Hotkeys.isBold(event) ||\n Hotkeys.isDeleteBackward(event) ||\n Hotkeys.isDeleteForward(event) ||\n Hotkeys.isDeleteLineBackward(event) ||\n Hotkeys.isDeleteLineForward(event) ||\n Hotkeys.isDeleteWordBackward(event) ||\n Hotkeys.isDeleteWordForward(event) ||\n Hotkeys.isItalic(event) ||\n Hotkeys.isRedo(event) ||\n Hotkeys.isSplitBlock(event) ||\n Hotkeys.isTransposeCharacter(event) ||\n Hotkeys.isUndo(event))\n ) {\n event.preventDefault()\n }\n\n isUserActionPerformed = true\n debug('onKeyDown', { event })\n next()\n }\n\n /**\n * On paste.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onPaste(event, editor, next) {\n if (editor.readOnly) return\n isUserActionPerformed = true\n\n // Prevent defaults so the DOM state isn't corrupted.\n event.preventDefault()\n\n debug('onPaste', { event })\n next()\n }\n\n /**\n * On select.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @param {Function} next\n */\n\n function onSelect(event, editor, next) {\n if (isCopying) return\n if (isComposing) return\n\n if (editor.readOnly) return\n\n // Save the new `activeElement`.\n const window = getWindow(event.target)\n activeElement = window.document.activeElement\n isUserActionPerformed = true\n\n debug('onSelect', { event })\n next()\n }\n\n function userActionPerformed() {\n return isUserActionPerformed\n }\n\n function clearUserActionPerformed() {\n isUserActionPerformed = false\n return null\n }\n\n /**\n * Return the plugin.\n *\n * @type {Object}\n */\n\n return {\n onBeforeInput,\n onBlur,\n onClick,\n onCompositionEnd,\n onCompositionStart,\n onCopy,\n onCut,\n onDragEnd,\n onDragEnter,\n onDragExit,\n onDragLeave,\n onDragOver,\n onDragStart,\n onDrop,\n onFocus,\n onInput,\n onKeyDown,\n onPaste,\n onSelect,\n queries: { userActionPerformed },\n commands: { clearUserActionPerformed },\n }\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default BeforePlugin\n","import { IS_ANDROID } from 'slate-dev-environment'\n\nimport AndroidPlugin from '../android'\nimport NoopPlugin from '../debug/noop'\n\nimport AfterPlugin from './after'\nimport BeforePlugin from './before'\n\n/**\n * A plugin that adds the browser-specific logic to the editor.\n *\n * @param {Object} options\n * @return {Object}\n */\n\nfunction DOMPlugin(options = {}) {\n const { plugins = [] } = options\n const beforePlugin = BeforePlugin()\n const afterPlugin = AfterPlugin()\n\n // COMPAT: Add Android specific handling separately before it gets to the\n // other plugins because it is specific (other browser don't need it) and\n // finicky (it has to come before other plugins to work).\n const androidPlugins = IS_ANDROID\n ? [AndroidPlugin(options), NoopPlugin(options)]\n : []\n\n return [...androidPlugins, beforePlugin, ...plugins, afterPlugin]\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default DOMPlugin\n","function RestoreDOMPlugin() {\n /**\n * Makes sure that on the next Content `render` the DOM is restored.\n * This gets us around issues where the DOM is in a different state than\n * React's virtual DOM and would crash.\n *\n * @param {Editor} editor\n */\n\n function restoreDOM(editor) {\n const tmp = editor.tmp.contentRef.current.tmp\n tmp.contentKey = tmp.contentKey + 1\n }\n\n return {\n commands: {\n restoreDOM,\n },\n }\n}\n\nexport default RestoreDOMPlugin\n","/**\n * Takes a React Synthetic Event or a DOM Event and turns it into a String that\n * is easy to log. It's succinct and keeps info to a bare minimum.\n *\n * @param {Event} event\n */\n\nexport default function stringifyEvent(event) {\n const e = event.nativeEvent || event\n\n switch (e.type) {\n case 'keydown':\n return `${e.type} ${JSON.stringify(e.key)}`\n case 'input':\n case 'beforeinput':\n case 'textInput':\n return `${e.type}:${e.inputType} ${JSON.stringify(e.data)}`\n default:\n return e.type\n }\n}\n","import Debug from 'debug'\nimport EVENT_HANDLERS from '../../constants/event-handlers'\nimport stringifyEvent from './stringify-event'\n\n/**\n * Debug events function.\n *\n * @type {Function}\n */\n\nconst debug = Debug('slate:events')\n\n/**\n * A plugin that sends short easy to digest debug info about each event to\n * browser.\n *\n * @return {Object}\n */\n\nfunction DebugEventsPlugin() {\n /**\n * Plugin Object\n *\n * @type {Object}\n */\n\n const plugin = {}\n\n for (const eventName of EVENT_HANDLERS) {\n plugin[eventName] = function(event, editor, next) {\n const s = stringifyEvent(event)\n debug(s)\n next()\n }\n }\n\n /**\n * Return the plugin.\n *\n * @type {Object}\n */\n\n return plugin\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default DebugEventsPlugin\n","import Debug from 'debug'\nimport EVENT_HANDLERS from '../../constants/event-handlers'\nimport stringifyEvent from './stringify-event'\n\n/**\n * Constants\n */\n\nconst INTERVAL = 2000\n\n/**\n * Debug events function.\n *\n * @type {Function}\n */\n\nconst debug = Debug('slate:batch-events')\n\n/**\n * A plugin that sends short easy to digest debug info about each event to\n * browser.\n *\n * @return {Object}\n */\n\nfunction DebugBatchEventsPlugin() {\n /**\n * When the batch started\n *\n * @type {Date}\n */\n\n let startDate = null\n\n /**\n * The timeoutId used to cancel the timeout\n *\n * @type {Any}\n */\n\n let timeoutId = null\n\n /**\n * An array of events not yet dumped with `debug`\n *\n * @type {Array}\n */\n\n const events = []\n\n /**\n * Send all events to debug\n *\n * Note: Formatted so it can easily be cut and pasted as text for analysis or\n * documentation.\n */\n\n function dumpEvents() {\n debug(`\\n${events.join('\\n')}`)\n events.length = 0\n }\n\n /**\n * Push an event on to the Array of events for debugging in a batch\n *\n * @param {Event} event\n */\n\n function pushEvent(event) {\n if (events.length === 0) {\n startDate = new Date()\n }\n\n const s = stringifyEvent(event)\n const now = new Date()\n events.push(`- ${now - startDate} - ${s}`)\n clearTimeout(timeoutId)\n timeoutId = setTimeout(dumpEvents, INTERVAL)\n }\n\n /**\n * Plugin Object\n *\n * @type {Object}\n */\n\n const plugin = {}\n\n for (const eventName of EVENT_HANDLERS) {\n plugin[eventName] = function(event, editor, next) {\n pushEvent(event)\n next()\n }\n }\n\n /**\n * Return the plugin.\n *\n * @type {Object}\n */\n\n return plugin\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default DebugBatchEventsPlugin\n","import Debug from 'debug'\n\n/**\n * Debug mutations function.\n *\n * @type {Function}\n */\n\nconst debug = Debug('slate:mutations')\n\n/**\n * Properties on a MutationRecord\n *\n * @type {Object}\n */\n\nconst MUTATION_PROPERTIES = [\n 'type',\n 'oldValue',\n 'target',\n 'addedNodes',\n 'removedNodes',\n 'attributeName',\n 'attributeNamespace',\n 'nextSibling',\n 'previousSibling',\n]\n\n/**\n * Takes a DOM node and returns an easily readable version of it.\n *\n * @param {DOMNode} node\n */\n\nfunction normalizeNode(node) {\n if (node.nodeType === window.Node.TEXT_NODE) {\n return node.textContent\n } else if (node.nodeType === window.Node.ELEMENT_NODE) {\n const { outerHTML, innerHTML } = node\n if (outerHTML == null) return JSON.stringify(node.textContent)\n return outerHTML.slice(0, outerHTML.indexOf(innerHTML))\n } else {\n return `Node(type=${node.nodeType}`\n }\n}\n\n/**\n * A plugin that sends short easy to digest debug info about each dom mutation\n * to browser.\n *\n * More information about mutations here:\n *\n * \n * \n *\n * @param {Object} options\n */\n\nfunction DebugMutationsPlugin() {\n const observer = new window.MutationObserver(mutations => {\n const array = Array.from(mutations).map(mutationRecord => {\n const object = {}\n\n // Only add properties that provide meaningful values to the object\n // to make the debug info easier to read\n MUTATION_PROPERTIES.forEach(key => {\n let value = mutationRecord[key]\n if (value == null) return\n\n // Make NodeList easier to read\n if (value instanceof window.NodeList) {\n if (value.length === 0) return\n\n object[key] = Array.from(value)\n .map(normalizeNode)\n .join(', ')\n return\n }\n\n // Make Node easier to read\n if (value instanceof window.Node) {\n value = normalizeNode(value)\n }\n\n object[key] = value\n })\n\n return object\n })\n\n // The first argument must not be the array as `debug` renders the first\n // argument in a different way than the rest\n debug(`${array.length} Mutations`, ...array)\n })\n\n /**\n * The previously observed DOM node\n *\n * @type {DOMNode}\n */\n\n let prevRootEl = null\n\n /**\n * Start observing the DOM node for mutations if it isn't being observed\n */\n\n function start(event, editor, next) {\n const rootEl = editor.findDOMNode([])\n\n if (rootEl === prevRootEl) return next()\n\n debug('start')\n\n observer.observe(rootEl, {\n childList: true,\n characterData: true,\n attributes: true,\n subtree: true,\n characterDataOldValue: true,\n })\n\n prevRootEl = rootEl\n\n next()\n }\n\n /**\n * Stop observing the DOM node for mutations\n */\n\n function stop(event, editor, next) {\n debug('stop')\n\n observer.disconnect()\n prevRootEl = null\n next()\n }\n\n return {\n onComponentDidMount: start,\n onComponentDidUpdate: start,\n onComponentWillUnmount: stop,\n }\n}\n\nexport default DebugMutationsPlugin\n","import Debug from 'debug'\n\nimport { IS_ANDROID } from 'slate-dev-environment'\nimport PlaceholderPlugin from 'slate-react-placeholder'\nimport EditorPropsPlugin from './editor-props'\nimport RenderingPlugin from './rendering'\nimport CommandsPlugin from './commands'\nimport QueriesPlugin from './queries'\nimport DOMPlugin from '../dom'\nimport RestoreDOMPlugin from './restore-dom'\nimport DebugEventsPlugin from '../debug/debug-events'\nimport DebugBatchEventsPlugin from '../debug/debug-batch-events'\nimport DebugMutationsPlugin from '../debug/debug-mutations'\n\n/**\n * A plugin that adds the React-specific rendering logic to the editor.\n *\n * @param {Object} options\n * @return {Object}\n */\n\nfunction ReactPlugin(options = {}) {\n const { placeholder = '' } = options\n const debugEventsPlugin = Debug.enabled('slate:events')\n ? DebugEventsPlugin(options)\n : null\n const debugBatchEventsPlugin = Debug.enabled('slate:batch-events')\n ? DebugBatchEventsPlugin(options)\n : null\n const debugMutationsPlugin = Debug.enabled('slate:mutations')\n ? DebugMutationsPlugin(options)\n : null\n const renderingPlugin = RenderingPlugin(options)\n const commandsPlugin = CommandsPlugin(options)\n const queriesPlugin = QueriesPlugin(options)\n const editorPropsPlugin = EditorPropsPlugin(options)\n const domPlugin = DOMPlugin(options)\n const restoreDomPlugin = RestoreDOMPlugin()\n\n // Disable placeholder for Android because it messes with reconciliation\n // and doesn't disappear until composition is complete.\n // e.g. In empty, type \"h\" and autocomplete on Android 9 and deletes all text.\n const placeholderPlugin = IS_ANDROID\n ? null\n : PlaceholderPlugin({\n placeholder,\n when: (editor, node) =>\n node.object === 'document' &&\n node.text === '' &&\n node.nodes.size === 1 &&\n Array.from(node.texts()).length === 1,\n })\n\n return [\n debugEventsPlugin,\n debugBatchEventsPlugin,\n debugMutationsPlugin,\n editorPropsPlugin,\n domPlugin,\n restoreDomPlugin,\n placeholderPlugin,\n renderingPlugin,\n commandsPlugin,\n queriesPlugin,\n ]\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default ReactPlugin\n","import Debug from 'debug'\nimport React from 'react'\nimport SlateTypes from 'slate-prop-types'\nimport Types from 'prop-types'\nimport invariant from 'tiny-invariant'\nimport memoizeOne from 'memoize-one'\nimport warning from 'tiny-warning'\nimport omit from 'lodash/omit'\nimport { Editor as Controller } from 'slate'\n\nimport EVENT_HANDLERS from '../constants/event-handlers'\nimport OTHER_HANDLERS from '../constants/other-handlers'\nimport Content from './content'\nimport ReactPlugin from '../plugins/react'\n\n/**\n * Debug.\n *\n * @type {Function}\n */\n\nconst debug = Debug('slate:editor')\n\n/**\n * Editor.\n *\n * @type {Component}\n */\n\nclass Editor extends React.Component {\n /**\n * Property types.\n *\n * @type {Object}\n */\n\n static propTypes = {\n autoCorrect: Types.bool,\n autoFocus: Types.bool,\n className: Types.string,\n defaultValue: SlateTypes.value,\n id: Types.string,\n onChange: Types.func,\n options: Types.object,\n placeholder: Types.any,\n plugins: Types.array,\n readOnly: Types.bool,\n role: Types.string,\n schema: Types.object,\n spellCheck: Types.bool,\n style: Types.object,\n tabIndex: Types.number,\n value: SlateTypes.value,\n ...EVENT_HANDLERS.reduce((obj, handler) => {\n obj[handler] = Types.func\n return obj\n }, {}),\n ...OTHER_HANDLERS.reduce((obj, handler) => {\n obj[handler] = Types.func\n return obj\n }, {}),\n }\n\n /**\n * Default properties.\n *\n * @type {Object}\n */\n\n static defaultProps = {\n autoFocus: false,\n autoCorrect: true,\n onChange: () => {},\n options: {},\n placeholder: '',\n plugins: [],\n readOnly: false,\n schema: {},\n spellCheck: true,\n }\n\n /**\n * Initial state.\n *\n * @type {Object}\n */\n\n state = { value: this.props.defaultValue, contentKey: 0 }\n\n /**\n * Temporary values.\n *\n * @type {Object}\n */\n\n tmp = {\n mounted: false,\n change: null,\n resolves: 0,\n updates: 0,\n contentRef: React.createRef(),\n }\n\n /**\n * When the component first mounts, flush a queued change if one exists.\n */\n\n componentDidMount() {\n this.tmp.mounted = true\n this.tmp.updates++\n\n if (this.props.autoFocus) {\n this.focus()\n }\n\n if (this.tmp.change) {\n this.handleChange(this.tmp.change)\n this.tmp.change = null\n }\n }\n\n /**\n * When the component updates, flush a queued change if one exists.\n */\n\n componentDidUpdate() {\n this.tmp.updates++\n\n if (this.tmp.change) {\n this.handleChange(this.tmp.change)\n this.tmp.change = null\n }\n }\n\n /**\n * When the component unmounts, make sure async commands don't trigger react updates.\n */\n\n componentWillUnmount() {\n this.tmp.mounted = false\n }\n\n /**\n * Render the editor.\n *\n * @return {Element}\n */\n\n render() {\n debug('render', this)\n\n // Re-resolve the controller if needed based on memoized props.\n const { commands, placeholder, plugins, queries, schema } = this.props\n\n this.resolveController(\n plugins,\n schema,\n commands,\n queries,\n placeholder,\n ReactPlugin\n )\n\n // Set the current props on the controller.\n const { options, readOnly, value: valueFromProps } = this.props\n const { value: valueFromState } = this.state\n const value = valueFromProps || valueFromState\n const { contentKey } = this.state\n this.controller.setReadOnly(readOnly)\n this.controller.setValue(value, options)\n\n const {\n autoCorrect,\n className,\n id,\n role,\n spellCheck,\n tabIndex,\n style,\n tagName,\n } = this.props\n\n const domProps = omit(this.props, Object.keys(Editor.propTypes))\n\n const children = (\n this.run(handler, event)}\n readOnly={readOnly}\n role={role}\n spellCheck={spellCheck}\n style={style}\n tabIndex={tabIndex}\n tagName={tagName}\n />\n )\n\n // Render the editor's children with the controller.\n const element = this.controller.run('renderEditor', {\n ...this.props,\n editor: this,\n children,\n })\n\n return element\n }\n\n /**\n * Resolve an editor controller from the passed-in props. This method takes\n * all of the props as individual arguments to be able to properly memoize\n * against anything that could change and invalidate the old editor.\n *\n * @param {Array} plugins\n * @param {Object} schema\n * @param {Object} commands\n * @param {Object} queries\n * @param {String} placeholder\n * @return {Editor}\n */\n\n resolveController = memoizeOne(\n (plugins = [], schema, commands, queries, placeholder, TheReactPlugin) => {\n // If we've resolved a few times already, and it's exactly in line with\n // the updates, then warn the user that they may be doing something wrong.\n warning(\n this.tmp.resolves < 5 || this.tmp.resolves !== this.tmp.updates,\n 'A Slate component is re-resolving the `plugins`, `schema`, `commands`, `queries` or `placeholder` prop on each update, which leads to poor performance. This is often due to passing in a new references for these props with each render by declaring them inline in your render function. Do not do this! Declare them outside your render function, or memoize them instead.'\n )\n\n this.tmp.resolves++\n const react = TheReactPlugin({\n ...this.props,\n editor: this,\n value: this.props.value || this.state.value,\n })\n\n const onChange = change => {\n if (this.tmp.mounted) {\n this.handleChange(change)\n } else {\n this.tmp.change = change\n }\n }\n\n this.controller = new Controller(\n { plugins: [react], onChange },\n { controller: this, construct: false }\n )\n\n this.controller.run('onConstruct')\n }\n )\n\n handleChange(change) {\n const { onChange } = this.props\n const { value } = this.state\n\n if (value) {\n // Syncing value inside this component since parent does not want control of it (defaultValue was used)\n this.setState({ value: change.value })\n }\n\n onChange(change)\n }\n\n /**\n * Mimic the API of the `Editor` controller, so that this component instance\n * can be passed in its place to plugins.\n */\n\n get operations() {\n return this.controller.operations\n }\n\n get readOnly() {\n return this.controller.readOnly\n }\n\n get value() {\n return this.controller.value\n }\n\n applyOperation(...args) {\n return this.controller.applyOperation(...args)\n }\n\n command(...args) {\n return this.controller.command(...args)\n }\n\n hasCommand(...args) {\n return this.controller.hasCommand(...args)\n }\n\n hasQuery(...args) {\n return this.controller.hasQuery(...args)\n }\n\n normalize(...args) {\n return this.controller.normalize(...args)\n }\n\n query(...args) {\n return this.controller.query(...args)\n }\n\n registerCommand(...args) {\n return this.controller.registerCommand(...args)\n }\n\n registerQuery(...args) {\n return this.controller.registerQuery(...args)\n }\n\n run(...args) {\n return this.controller.run(...args)\n }\n\n withoutNormalizing(...args) {\n return this.controller.withoutNormalizing(...args)\n }\n\n /**\n * Deprecated.\n */\n\n get editor() {\n return this.controller.editor\n }\n\n get schema() {\n invariant(\n false,\n 'As of Slate 0.42, the `editor.schema` property no longer exists, and its functionality has been folded into the editor itself. Use the `editor` instead.'\n )\n }\n\n get stack() {\n invariant(\n false,\n 'As of Slate 0.42, the `editor.stack` property no longer exists, and its functionality has been folded into the editor itself. Use the `editor` instead.'\n )\n }\n\n call(...args) {\n return this.controller.call(...args)\n }\n\n change(...args) {\n return this.controller.change(...args)\n }\n\n onChange(...args) {\n return this.controller.onChange(...args)\n }\n\n applyOperations(...args) {\n return this.controller.applyOperations(...args)\n }\n\n setOperationFlag(...args) {\n return this.controller.setOperationFlag(...args)\n }\n\n getFlag(...args) {\n return this.controller.getFlag(...args)\n }\n\n unsetOperationFlag(...args) {\n return this.controller.unsetOperationFlag(...args)\n }\n\n withoutNormalization(...args) {\n return this.controller.withoutNormalization(...args)\n }\n}\n\n/**\n * Export.\n *\n * @type {Component}\n */\n\nexport default Editor\n","import { Node } from 'slate'\nimport warning from 'tiny-warning'\n\nimport DATA_ATTRS from '../constants/data-attributes'\n\n/**\n * Find the DOM node for a `key`.\n *\n * @param {String|Node} key\n * @param {Window} win (optional)\n * @return {Element}\n */\n\nfunction findDOMNode(key, win = window) {\n warning(\n false,\n 'As of slate-react@0.22 the `findDOMNode(key)` helper is deprecated in favor of `editor.findDOMNode(path)`.'\n )\n\n if (Node.isNode(key)) {\n key = key.key\n }\n\n const el = win.document.querySelector(`[${DATA_ATTRS.KEY}=\"${key}\"]`)\n\n if (!el) {\n throw new Error(\n `Unable to find a DOM node for \"${key}\". This is often because of forgetting to add \\`props.attributes\\` to a custom component.`\n )\n }\n\n return el\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default findDOMNode\n","import findDOMNode from './find-dom-node'\nimport warning from 'tiny-warning'\n\nimport DATA_ATTRS from '../constants/data-attributes'\nimport SELECTORS from '../constants/selectors'\n\n/**\n * Find a native DOM selection point from a Slate `point`.\n *\n * @param {Point} point\n * @param {Window} win (optional)\n * @return {Object|Null}\n */\n\nfunction findDOMPoint(point, win = window) {\n warning(\n false,\n 'As of slate-react@0.22 the `findDOMPoint(point)` helper is deprecated in favor of `editor.findDOMPoint(point)`.'\n )\n\n const el = findDOMNode(point.key, win)\n let start = 0\n\n // For each leaf, we need to isolate its content, which means filtering to its\n // direct text and zero-width spans. (We have to filter out any other siblings\n // that may have been rendered alongside them.)\n const texts = Array.from(\n el.querySelectorAll(`${SELECTORS.STRING}, ${SELECTORS.ZERO_WIDTH}`)\n )\n\n for (const text of texts) {\n const node = text.childNodes[0]\n const domLength = node.textContent.length\n let slateLength = domLength\n\n if (text.hasAttribute(DATA_ATTRS.LENGTH)) {\n slateLength = parseInt(text.getAttribute(DATA_ATTRS.LENGTH), 10)\n }\n\n const end = start + slateLength\n\n if (point.offset <= end) {\n const offset = Math.min(domLength, Math.max(0, point.offset - start))\n return { node, offset }\n }\n\n start = end\n }\n\n return null\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default findDOMPoint\n","import findDOMPoint from './find-dom-point'\nimport warning from 'tiny-warning'\n\n/**\n * Find a native DOM range Slate `range`.\n *\n * @param {Range} range\n * @param {Window} win (optional)\n * @return {Object|Null}\n */\n\nfunction findDOMRange(range, win = window) {\n warning(\n false,\n 'As of slate-react@0.22 the `findDOMRange(range)` helper is deprecated in favor of `editor.findDOMRange(range)`.'\n )\n\n const { anchor, focus, isBackward, isCollapsed } = range\n const domAnchor = findDOMPoint(anchor, win)\n const domFocus = isCollapsed ? domAnchor : findDOMPoint(focus, win)\n\n if (!domAnchor || !domFocus) return null\n\n const r = win.document.createRange()\n const start = isBackward ? domFocus : domAnchor\n const end = isBackward ? domAnchor : domFocus\n r.setStart(start.node, start.offset)\n r.setEnd(end.node, end.offset)\n return r\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default findDOMRange\n","import invariant from 'tiny-invariant'\nimport warning from 'tiny-warning'\nimport { Value } from 'slate'\n\nimport DATA_ATTRS from '../constants/data-attributes'\nimport SELECTORS from '../constants/selectors'\n\n/**\n * Find a Slate node from a DOM `element`.\n *\n * @param {Element} element\n * @param {Editor} editor\n * @return {Node|Null}\n */\n\nfunction findNode(element, editor) {\n warning(\n false,\n 'As of slate-react@0.22 the `findNode(element)` helper is deprecated in favor of `editor.findNode(element)`.'\n )\n\n invariant(\n !Value.isValue(editor),\n 'As of Slate 0.42.0, the `findNode` utility takes an `editor` instead of a `value`.'\n )\n\n const closest = element.closest(SELECTORS.KEY)\n if (!closest) return null\n\n const key = closest.getAttribute(DATA_ATTRS.KEY)\n if (!key) return null\n\n const { value } = editor\n const { document } = value\n const node = document.getNode(key)\n return node || null\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default findNode\n","import findNode from './find-node'\nimport warning from 'tiny-warning'\n\n/**\n * Find a Slate path from a DOM `element`.\n *\n * @param {Element} element\n * @param {Editor} editor\n * @return {List|Null}\n */\n\nfunction findPath(element, editor) {\n warning(\n false,\n 'As of slate-react@0.22 the `findPath(element)` helper is deprecated in favor of `editor.findPath(element)`.'\n )\n\n const node = findNode(element, editor)\n\n if (!node) {\n return null\n }\n\n const { value } = editor\n const { document } = value\n const path = document.getPath(node)\n return path\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default findPath\n","import getWindow from 'get-window'\nimport invariant from 'tiny-invariant'\nimport warning from 'tiny-warning'\nimport { Value } from 'slate'\n\nimport OffsetKey from './offset-key'\nimport DATA_ATTRS from '../constants/data-attributes'\nimport SELECTORS from '../constants/selectors'\n\n/**\n * Find a Slate point from a DOM selection's `nativeNode` and `nativeOffset`.\n *\n * @param {Element} nativeNode\n * @param {Number} nativeOffset\n * @param {Editor} editor\n * @return {Point}\n */\n\nfunction findPoint(nativeNode, nativeOffset, editor) {\n warning(\n false,\n 'As of slate-react@0.22 the `findPoint(node, offset)` helper is deprecated in favor of `editor.findPoint(node, offset)`.'\n )\n\n invariant(\n !Value.isValue(editor),\n 'As of Slate 0.42.0, the `findPoint` utility takes an `editor` instead of a `value`.'\n )\n\n const { node: nearestNode, offset: nearestOffset } = normalizeNodeAndOffset(\n nativeNode,\n nativeOffset\n )\n\n const window = getWindow(nativeNode)\n const { parentNode } = nearestNode\n let rangeNode = parentNode.closest(SELECTORS.LEAF)\n let offset\n let node\n\n // Calculate how far into the text node the `nearestNode` is, so that we can\n // determine what the offset relative to the text node is.\n if (rangeNode) {\n const range = window.document.createRange()\n const textNode = rangeNode.closest(SELECTORS.TEXT)\n range.setStart(textNode, 0)\n range.setEnd(nearestNode, nearestOffset)\n node = textNode\n\n // COMPAT: Edge has a bug where Range.prototype.toString() will convert \\n\n // into \\r\\n. The bug causes a loop when slate-react attempts to reposition\n // its cursor to match the native position. Use textContent.length instead.\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10291116/\n const fragment = range.cloneContents()\n const zeroWidthNodes = fragment.querySelectorAll(\n `[${DATA_ATTRS.ZERO_WIDTH}]`\n )\n offset = fragment.textContent.length - zeroWidthNodes.length\n } else {\n // For void nodes, the element with the offset key will be a cousin, not an\n // ancestor, so find it by going down from the nearest void parent.\n const voidNode = parentNode.closest(SELECTORS.VOID)\n if (!voidNode) return null\n rangeNode = voidNode.querySelector(SELECTORS.LEAF)\n if (!rangeNode) return null\n node = rangeNode\n offset = node.textContent.length\n }\n\n // COMPAT: If the parent node is a Slate zero-width space, this is because the\n // text node should have no characters. However, during IME composition the\n // ASCII characters will be prepended to the zero-width space, so subtract 1\n // from the offset to account for the zero-width space character.\n if (\n offset === node.textContent.length &&\n parentNode.hasAttribute(DATA_ATTRS.ZERO_WIDTH)\n ) {\n offset--\n }\n\n // Get the string value of the offset key attribute.\n const offsetKey = rangeNode.getAttribute(DATA_ATTRS.OFFSET_KEY)\n if (!offsetKey) return null\n\n const { key } = OffsetKey.parse(offsetKey)\n\n // COMPAT: If someone is clicking from one Slate editor into another, the\n // select event fires twice, once for the old editor's `element` first, and\n // then afterwards for the correct `element`. (2017/03/03)\n const { value } = editor\n if (!value.document.hasDescendant(key)) return null\n\n const point = value.document.createPoint({ key, offset })\n return point\n}\n\n/**\n * From a DOM selection's `node` and `offset`, normalize so that it always\n * refers to a text node.\n *\n * @param {Element} node\n * @param {Number} offset\n * @return {Object}\n */\n\nfunction normalizeNodeAndOffset(node, offset) {\n // If it's an element node, its offset refers to the index of its children\n // including comment nodes, so try to find the right text child node.\n if (node.nodeType === 1 && node.childNodes.length) {\n const isLast = offset === node.childNodes.length\n const direction = isLast ? 'backward' : 'forward'\n const index = isLast ? offset - 1 : offset\n node = getEditableChild(node, index, direction)\n\n // If the node has children, traverse until we have a leaf node. Leaf nodes\n // can be either text nodes, or other void DOM nodes.\n while (node.nodeType === 1 && node.childNodes.length) {\n const i = isLast ? node.childNodes.length - 1 : 0\n node = getEditableChild(node, i, direction)\n }\n\n // Determine the new offset inside the text node.\n offset = isLast ? node.textContent.length : 0\n }\n\n // Return the node and offset.\n return { node, offset }\n}\n\n/**\n * Get the nearest editable child at `index` in a `parent`, preferring\n * `direction`.\n *\n * @param {Element} parent\n * @param {Number} index\n * @param {String} direction ('forward' or 'backward')\n * @return {Element|Null}\n */\n\nfunction getEditableChild(parent, index, direction) {\n const { childNodes } = parent\n let child = childNodes[index]\n let i = index\n let triedForward = false\n let triedBackward = false\n\n // While the child is a comment node, or an element node with no children,\n // keep iterating to find a sibling non-void, non-comment node.\n while (\n child.nodeType === 8 ||\n (child.nodeType === 1 && child.childNodes.length === 0) ||\n (child.nodeType === 1 && child.getAttribute('contenteditable') === 'false')\n ) {\n if (triedForward && triedBackward) break\n\n if (i >= childNodes.length) {\n triedForward = true\n i = index - 1\n direction = 'backward'\n continue\n }\n\n if (i < 0) {\n triedBackward = true\n i = index + 1\n direction = 'forward'\n continue\n }\n\n child = childNodes[i]\n if (direction === 'forward') i++\n if (direction === 'backward') i--\n }\n\n return child || null\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default findPoint\n","import getWindow from 'get-window'\nimport invariant from 'tiny-invariant'\nimport warning from 'tiny-warning'\nimport { Value } from 'slate'\n\nimport findPoint from './find-point'\n\n/**\n * Find a Slate range from a DOM `native` selection.\n *\n * @param {Selection} native\n * @param {Editor} editor\n * @return {Range}\n */\n\nfunction findRange(native, editor) {\n warning(\n false,\n 'As of slate-react@0.22 the `findRange(selection)` helper is deprecated in favor of `editor.findRange(selection)`.'\n )\n\n invariant(\n !Value.isValue(editor),\n 'As of Slate 0.42.0, the `findNode` utility takes an `editor` instead of a `value`.'\n )\n\n const el = native.anchorNode || native.startContainer\n if (!el) return null\n\n const window = getWindow(el)\n\n // If the `native` object is a DOM `Range` or `StaticRange` object, change it\n // into something that looks like a DOM `Selection` instead.\n if (\n native instanceof window.Range ||\n (window.StaticRange && native instanceof window.StaticRange)\n ) {\n native = {\n anchorNode: native.startContainer,\n anchorOffset: native.startOffset,\n focusNode: native.endContainer,\n focusOffset: native.endOffset,\n }\n }\n\n const {\n anchorNode,\n anchorOffset,\n focusNode,\n focusOffset,\n isCollapsed,\n } = native\n const { value } = editor\n const anchor = findPoint(anchorNode, anchorOffset, editor)\n const focus = isCollapsed ? anchor : findPoint(focusNode, focusOffset, editor)\n if (!anchor || !focus) return null\n\n const { document } = value\n const range = document.createRange({\n anchor,\n focus,\n })\n\n return range\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default findRange\n","import getWindow from 'get-window'\nimport invariant from 'tiny-invariant'\nimport warning from 'tiny-warning'\nimport { Value } from 'slate'\n\nimport findPath from './find-path'\nimport findRange from './find-range'\n\n/**\n * Get the target range from a DOM `event`.\n *\n * @param {Event} event\n * @param {Editor} editor\n * @return {Range}\n */\n\nfunction getEventRange(event, editor) {\n warning(\n false,\n 'As of slate-react@0.22 the `getEventRange(event, editor)` helper is deprecated in favor of `editor.findEventRange(event)`.'\n )\n\n invariant(\n !Value.isValue(editor),\n 'As of Slate 0.42.0, the `findNode` utility takes an `editor` instead of a `value`.'\n )\n\n if (event.nativeEvent) {\n event = event.nativeEvent\n }\n\n const { clientX: x, clientY: y, target } = event\n if (x == null || y == null) return null\n\n const { value } = editor\n const { document } = value\n const path = findPath(event.target, editor)\n if (!path) return null\n\n const node = document.getNode(path)\n\n // If the drop target is inside a void node, move it into either the next or\n // previous node, depending on which side the `x` and `y` coordinates are\n // closest to.\n if (editor.isVoid(node)) {\n const rect = target.getBoundingClientRect()\n const isPrevious =\n node.object === 'inline'\n ? x - rect.left < rect.left + rect.width - x\n : y - rect.top < rect.top + rect.height - y\n\n const range = document.createRange()\n const move = isPrevious ? 'moveToEndOfNode' : 'moveToStartOfNode'\n const entry = document[isPrevious ? 'getPreviousText' : 'getNextText'](path)\n\n if (entry) {\n return range[move](entry)\n }\n\n return null\n }\n\n // Else resolve a range from the caret position where the drop occured.\n const window = getWindow(target)\n let native\n\n // COMPAT: In Firefox, `caretRangeFromPoint` doesn't exist. (2016/07/25)\n if (window.document.caretRangeFromPoint) {\n native = window.document.caretRangeFromPoint(x, y)\n } else if (window.document.caretPositionFromPoint) {\n const position = window.document.caretPositionFromPoint(x, y)\n native = window.document.createRange()\n native.setStart(position.offsetNode, position.offset)\n native.setEnd(position.offsetNode, position.offset)\n } else if (window.document.body.createTextRange) {\n // COMPAT: In IE, `caretRangeFromPoint` and\n // `caretPositionFromPoint` don't exist. (2018/07/11)\n native = window.document.body.createTextRange()\n\n try {\n native.moveToPoint(x, y)\n } catch (error) {\n // IE11 will raise an `unspecified error` if `moveToPoint` is\n // called during a dropEvent.\n return null\n }\n }\n\n // Resolve a Slate range from the DOM range.\n const range = findRange(native, editor)\n if (!range) return null\n\n return range\n}\n\n/**\n * Export.\n *\n * @type {Function}\n */\n\nexport default getEventRange\n","!function(t,e){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=e(require(\"react\")):\"function\"==typeof define&&define.amd?define(\"MathquillComponent\",[\"react\"],e):\"object\"==typeof exports?exports.MathquillComponent=e(require(\"react\")):t.MathquillComponent=e(t.react)}(global,function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(t,\"__esModule\",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&\"object\"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,\"default\",{enumerable:!0,value:t}),2&e&&\"string\"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,\"a\",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p=\"\",n(n.s=4)}([function(t,e,n){t.exports=n(7)()},function(e,n){e.exports=t},function(t,e,n){\"use strict\";n.d(e,\"a\",function(){return r});var r=n(9);r.getInterface(2)},function(t,e,n){(t.exports=n(5)(!1)).push([t.i,\"/*\\n * MathQuill v0.11.0, by Han, Jeanine, and Mary\\n * http://mathquill.com | maintainers@mathquill.com\\n *\\n * This Source Code Form is subject to the terms of the\\n * Mozilla Public License, v. 2.0. If a copy of the MPL\\n * was not distributed with this file, You can obtain\\n * one at http://mozilla.org/MPL/2.0/.\\n */\\n@font-face {\\n /* Heavy fonts have been removed */\\n font-family: Symbola;\\n}\\n.mq-editable-field {\\n display: -moz-inline-box;\\n display: inline-block;\\n}\\n.mq-editable-field .mq-cursor {\\n border-left: 1px solid black;\\n margin-left: -1px;\\n position: relative;\\n z-index: 1;\\n padding: 0;\\n display: -moz-inline-box;\\n display: inline-block;\\n}\\n.mq-editable-field .mq-cursor.mq-blink {\\n visibility: hidden;\\n}\\n.mq-editable-field,\\n.mq-math-mode .mq-editable-field {\\n border: 1px solid gray;\\n}\\n.mq-editable-field.mq-focused,\\n.mq-math-mode .mq-editable-field.mq-focused {\\n -webkit-box-shadow: #8bd 0 0 1px 2px, inset #6ae 0 0 2px 0;\\n -moz-box-shadow: #8bd 0 0 1px 2px, inset #6ae 0 0 2px 0;\\n box-shadow: #8bd 0 0 1px 2px, inset #6ae 0 0 2px 0;\\n border-color: #709AC0;\\n border-radius: 1px;\\n}\\n.mq-math-mode .mq-editable-field {\\n margin: 1px;\\n}\\n.mq-editable-field .mq-latex-command-input {\\n color: inherit;\\n font-family: \\\"Courier New\\\", monospace;\\n border: 1px solid gray;\\n padding-right: 1px;\\n margin-right: 1px;\\n margin-left: 2px;\\n}\\n.mq-editable-field .mq-latex-command-input.mq-empty {\\n background: transparent;\\n}\\n.mq-editable-field .mq-latex-command-input.mq-hasCursor {\\n border-color: ActiveBorder;\\n}\\n.mq-editable-field.mq-empty:after,\\n.mq-editable-field.mq-text-mode:after,\\n.mq-math-mode .mq-empty:after {\\n visibility: hidden;\\n content: 'c';\\n}\\n.mq-editable-field .mq-cursor:only-child:after,\\n.mq-editable-field .mq-textarea + .mq-cursor:last-child:after {\\n visibility: hidden;\\n content: 'c';\\n}\\n.mq-editable-field .mq-text-mode .mq-cursor:only-child:after {\\n content: '';\\n}\\n.mq-editable-field.mq-text-mode {\\n overflow-x: auto;\\n overflow-y: hidden;\\n}\\n.mq-root-block,\\n.mq-math-mode .mq-root-block {\\n display: -moz-inline-box;\\n display: inline-block;\\n width: 100%;\\n padding: 2px;\\n -webkit-box-sizing: border-box;\\n -moz-box-sizing: border-box;\\n box-sizing: border-box;\\n white-space: nowrap;\\n overflow: hidden;\\n vertical-align: middle;\\n}\\n.mq-math-mode {\\n font-variant: normal;\\n font-weight: normal;\\n font-style: normal;\\n font-size: 115%;\\n line-height: 1;\\n display: -moz-inline-box;\\n display: inline-block;\\n}\\n.mq-math-mode .mq-non-leaf,\\n.mq-math-mode .mq-scaled {\\n display: -moz-inline-box;\\n display: inline-block;\\n}\\n.mq-math-mode var,\\n.mq-math-mode .mq-text-mode,\\n.mq-math-mode .mq-nonSymbola {\\n font-family: \\\"Times New Roman\\\", Symbola, serif;\\n line-height: 0.9;\\n}\\n.mq-math-mode * {\\n font-size: inherit;\\n line-height: inherit;\\n margin: 0;\\n padding: 0;\\n border-color: black;\\n -webkit-user-select: none;\\n -moz-user-select: none;\\n user-select: none;\\n box-sizing: border-box;\\n}\\n.mq-math-mode .mq-empty {\\n background: #ccc;\\n}\\n.mq-math-mode .mq-empty.mq-root-block {\\n background: transparent;\\n}\\n.mq-math-mode.mq-empty {\\n background: transparent;\\n}\\n.mq-math-mode .mq-text-mode {\\n display: inline-block;\\n white-space: pre;\\n}\\n.mq-math-mode .mq-text-mode.mq-hasCursor {\\n box-shadow: inset darkgray 0 0.1em 0.2em;\\n padding: 0 0.1em;\\n margin: 0 -0.1em;\\n min-width: 1ex;\\n}\\n.mq-math-mode .mq-font {\\n font: 1em \\\"Times New Roman\\\", Symbola, serif;\\n}\\n.mq-math-mode .mq-font * {\\n font-family: inherit;\\n font-style: inherit;\\n}\\n.mq-math-mode b,\\n.mq-math-mode b.mq-font {\\n font-weight: bolder;\\n}\\n.mq-math-mode var,\\n.mq-math-mode i,\\n.mq-math-mode i.mq-font {\\n font-style: italic;\\n}\\n.mq-math-mode var.mq-f {\\n margin-right: 0.2em;\\n margin-left: 0.1em;\\n}\\n.mq-math-mode .mq-roman var.mq-f {\\n margin: 0;\\n}\\n.mq-math-mode big {\\n font-size: 200%;\\n}\\n.mq-math-mode .mq-int > big {\\n display: inline-block;\\n -webkit-transform: scaleX(0.7);\\n -moz-transform: scaleX(0.7);\\n -ms-transform: scaleX(0.7);\\n -o-transform: scaleX(0.7);\\n transform: scaleX(0.7);\\n vertical-align: -0.16em;\\n}\\n.mq-math-mode .mq-int > .mq-supsub {\\n font-size: 80%;\\n vertical-align: -1.1em;\\n padding-right: 0.2em;\\n}\\n.mq-math-mode .mq-int > .mq-supsub > .mq-sup > .mq-sup-inner {\\n vertical-align: 1.3em;\\n}\\n.mq-math-mode .mq-int > .mq-supsub > .mq-sub {\\n margin-left: -0.35em;\\n}\\n.mq-math-mode .mq-roman {\\n font-style: normal;\\n}\\n.mq-math-mode .mq-sans-serif {\\n font-family: sans-serif, Symbola, serif;\\n}\\n.mq-math-mode .mq-monospace {\\n font-family: monospace, Symbola, serif;\\n}\\n.mq-math-mode .mq-overline {\\n border-top: 1px solid black;\\n margin-top: 1px;\\n}\\n.mq-math-mode .mq-underline {\\n border-bottom: 1px solid black;\\n margin-bottom: 1px;\\n}\\n.mq-math-mode .mq-binary-operator {\\n padding: 0 0.2em;\\n display: -moz-inline-box;\\n display: inline-block;\\n}\\n.mq-math-mode .mq-supsub {\\n text-align: left;\\n font-size: 90%;\\n vertical-align: -0.5em;\\n}\\n.mq-math-mode .mq-supsub.mq-sup-only {\\n vertical-align: 0.5em;\\n}\\n.mq-math-mode .mq-supsub.mq-sup-only .mq-sup {\\n display: inline-block;\\n vertical-align: text-bottom;\\n}\\n.mq-math-mode .mq-supsub .mq-sup {\\n display: block;\\n}\\n.mq-math-mode .mq-supsub .mq-sub {\\n display: block;\\n float: left;\\n}\\n.mq-math-mode .mq-supsub .mq-binary-operator {\\n padding: 0 0.1em;\\n}\\n.mq-math-mode .mq-supsub .mq-fraction {\\n font-size: 70%;\\n}\\n.mq-math-mode sup.mq-nthroot {\\n font-size: 80%;\\n vertical-align: 0.8em;\\n margin-right: -0.6em;\\n margin-left: 0.2em;\\n min-width: 0.5em;\\n}\\n.mq-math-mode .mq-paren {\\n padding: 0 0.1em;\\n vertical-align: top;\\n -webkit-transform-origin: center 0.06em;\\n -moz-transform-origin: center 0.06em;\\n -ms-transform-origin: center 0.06em;\\n -o-transform-origin: center 0.06em;\\n transform-origin: center 0.06em;\\n}\\n.mq-math-mode .mq-paren.mq-ghost {\\n color: silver;\\n}\\n.mq-math-mode .mq-paren + span {\\n margin-top: 0.1em;\\n margin-bottom: 0.1em;\\n}\\n.mq-math-mode .mq-array {\\n vertical-align: middle;\\n text-align: center;\\n}\\n.mq-math-mode .mq-array > span {\\n display: block;\\n}\\n.mq-math-mode .mq-operator-name {\\n font-family: Symbola, \\\"Times New Roman\\\", serif;\\n line-height: 0.9;\\n font-style: normal;\\n}\\n.mq-math-mode var.mq-operator-name.mq-first {\\n padding-left: 0.2em;\\n}\\n.mq-math-mode var.mq-operator-name.mq-last,\\n.mq-math-mode .mq-supsub.mq-after-operator-name {\\n padding-right: 0.2em;\\n}\\n.mq-math-mode .mq-fraction {\\n font-size: 90%;\\n text-align: center;\\n vertical-align: -0.4em;\\n padding: 0 0.2em;\\n}\\n.mq-math-mode .mq-fraction,\\n.mq-math-mode .mq-large-operator,\\n.mq-math-mode x:-moz-any-link {\\n display: -moz-groupbox;\\n}\\n.mq-math-mode .mq-fraction,\\n.mq-math-mode .mq-large-operator,\\n.mq-math-mode x:-moz-any-link,\\n.mq-math-mode x:default {\\n display: inline-block;\\n}\\n.mq-math-mode .mq-numerator,\\n.mq-math-mode .mq-denominator,\\n.mq-math-mode .mq-dot-recurring {\\n display: block;\\n}\\n.mq-math-mode .mq-numerator {\\n padding: 0 0.1em;\\n}\\n.mq-math-mode .mq-denominator {\\n border-top: 1px solid;\\n float: right;\\n width: 100%;\\n padding: 0.1em;\\n}\\n.mq-math-mode .mq-dot-recurring {\\n text-align: center;\\n height: 0.3em;\\n}\\n.mq-math-mode .mq-sqrt-prefix {\\n padding-top: 0;\\n position: relative;\\n top: 0.1em;\\n vertical-align: top;\\n -webkit-transform-origin: top;\\n -moz-transform-origin: top;\\n -ms-transform-origin: top;\\n -o-transform-origin: top;\\n transform-origin: top;\\n}\\n.mq-math-mode .mq-sqrt-stem {\\n border-top: 1px solid;\\n margin-top: 1px;\\n padding-left: 0.15em;\\n padding-right: 0.2em;\\n margin-right: 0.1em;\\n padding-top: 1px;\\n}\\n.mq-math-mode .mq-diacritic-above {\\n display: block;\\n text-align: center;\\n line-height: 0.4em;\\n}\\n.mq-math-mode .mq-diacritic-stem {\\n display: block;\\n text-align: center;\\n}\\n.mq-math-mode .mq-hat-prefix {\\n display: block;\\n text-align: center;\\n line-height: 0.95em;\\n margin-bottom: -0.7em;\\n transform: scaleX(1.5);\\n -moz-transform: scaleX(1.5);\\n -o-transform: scaleX(1.5);\\n -webkit-transform: scaleX(1.5);\\n}\\n.mq-math-mode .mq-hat-stem {\\n display: block;\\n}\\n.mq-math-mode .mq-large-operator {\\n vertical-align: -0.2em;\\n padding: 0.2em;\\n text-align: center;\\n}\\n.mq-math-mode .mq-large-operator .mq-from,\\n.mq-math-mode .mq-large-operator big,\\n.mq-math-mode .mq-large-operator .mq-to {\\n display: block;\\n}\\n.mq-math-mode .mq-large-operator .mq-from,\\n.mq-math-mode .mq-large-operator .mq-to {\\n font-size: 80%;\\n}\\n.mq-math-mode .mq-large-operator .mq-from {\\n float: right;\\n /* take out of normal flow to manipulate baseline */\\n width: 100%;\\n}\\n.mq-math-mode,\\n.mq-math-mode .mq-editable-field {\\n cursor: text;\\n font-family: Symbola, \\\"Times New Roman\\\", serif;\\n}\\n.mq-math-mode .mq-overarc {\\n border-top: 1px solid black;\\n -webkit-border-top-right-radius: 50% 0.3em;\\n -moz-border-radius-topright: 50% 0.3em;\\n border-top-right-radius: 50% 0.3em;\\n -webkit-border-top-left-radius: 50% 0.3em;\\n -moz-border-radius-topleft: 50% 0.3em;\\n border-top-left-radius: 50% 0.3em;\\n margin-top: 1px;\\n padding-top: 0.15em;\\n}\\n.mq-math-mode .mq-overarrow {\\n min-width: 0.5em;\\n border-top: 1px solid black;\\n margin-top: 1px;\\n padding-top: 0.2em;\\n text-align: center;\\n}\\n.mq-math-mode .mq-overarrow:before {\\n display: block;\\n position: relative;\\n top: -0.34em;\\n font-size: 0.5em;\\n line-height: 0em;\\n content: '\\\\27A4';\\n text-align: right;\\n}\\n.mq-math-mode .mq-overarrow.mq-arrow-left:before {\\n -moz-transform: scaleX(-1);\\n -o-transform: scaleX(-1);\\n -webkit-transform: scaleX(-1);\\n transform: scaleX(-1);\\n filter: FlipH;\\n -ms-filter: \\\"FlipH\\\";\\n}\\n.mq-math-mode .mq-overarrow.mq-arrow-both {\\n vertical-align: text-bottom;\\n}\\n.mq-math-mode .mq-overarrow.mq-arrow-both.mq-empty {\\n min-height: 1.23em;\\n}\\n.mq-math-mode .mq-overarrow.mq-arrow-both.mq-empty:after {\\n top: -0.34em;\\n}\\n.mq-math-mode .mq-overarrow.mq-arrow-both:before {\\n -moz-transform: scaleX(-1);\\n -o-transform: scaleX(-1);\\n -webkit-transform: scaleX(-1);\\n transform: scaleX(-1);\\n filter: FlipH;\\n -ms-filter: \\\"FlipH\\\";\\n}\\n.mq-math-mode .mq-overarrow.mq-arrow-both:after {\\n display: block;\\n position: relative;\\n top: -2.3em;\\n font-size: 0.5em;\\n line-height: 0em;\\n content: '\\\\27A4';\\n visibility: visible;\\n text-align: right;\\n}\\n.mq-math-mode .mq-selection,\\n.mq-editable-field .mq-selection,\\n.mq-math-mode .mq-selection .mq-non-leaf,\\n.mq-editable-field .mq-selection .mq-non-leaf,\\n.mq-math-mode .mq-selection .mq-scaled,\\n.mq-editable-field .mq-selection .mq-scaled {\\n background: #B4D5FE !important;\\n background: Highlight !important;\\n color: HighlightText;\\n border-color: HighlightText;\\n}\\n.mq-math-mode .mq-selection .mq-matrixed,\\n.mq-editable-field .mq-selection .mq-matrixed {\\n background: #39F !important;\\n}\\n.mq-math-mode .mq-selection .mq-matrixed-container,\\n.mq-editable-field .mq-selection .mq-matrixed-container {\\n filter: progid:DXImageTransform.Microsoft.Chroma(color='#3399FF') !important;\\n}\\n.mq-math-mode .mq-selection.mq-blur,\\n.mq-editable-field .mq-selection.mq-blur,\\n.mq-math-mode .mq-selection.mq-blur .mq-non-leaf,\\n.mq-editable-field .mq-selection.mq-blur .mq-non-leaf,\\n.mq-math-mode .mq-selection.mq-blur .mq-scaled,\\n.mq-editable-field .mq-selection.mq-blur .mq-scaled,\\n.mq-math-mode .mq-selection.mq-blur .mq-matrixed,\\n.mq-editable-field .mq-selection.mq-blur .mq-matrixed {\\n background: #D4D4D4 !important;\\n color: black;\\n border-color: black;\\n}\\n.mq-math-mode .mq-selection.mq-blur .mq-matrixed-container,\\n.mq-editable-field .mq-selection.mq-blur .mq-matrixed-container {\\n filter: progid:DXImageTransform.Microsoft.Chroma(color='#D4D4D4') !important;\\n}\\n.mq-editable-field .mq-textarea,\\n.mq-math-mode .mq-textarea {\\n position: relative;\\n -webkit-user-select: text;\\n -moz-user-select: text;\\n user-select: text;\\n}\\n.mq-editable-field .mq-textarea *,\\n.mq-math-mode .mq-textarea *,\\n.mq-editable-field .mq-selectable,\\n.mq-math-mode .mq-selectable {\\n -webkit-user-select: text;\\n -moz-user-select: text;\\n user-select: text;\\n position: absolute;\\n clip: rect(1em 1em 1em 1em);\\n -webkit-transform: scale(0);\\n -moz-transform: scale(0);\\n -ms-transform: scale(0);\\n -o-transform: scale(0);\\n transform: scale(0);\\n resize: none;\\n width: 1px;\\n height: 1px;\\n box-sizing: content-box;\\n}\\n.mq-math-mode .mq-matrixed {\\n background: white;\\n display: -moz-inline-box;\\n display: inline-block;\\n}\\n.mq-math-mode .mq-matrixed-container {\\n filter: progid:DXImageTransform.Microsoft.Chroma(color='white');\\n margin-top: -0.1em;\\n}\\n\",\"\"])},function(t,e,n){\"use strict\";n.r(e),n.d(e,\"addStyles\",function(){return o}),n.d(e,\"EditableMathField\",function(){return s}),n.d(e,\"StaticMathField\",function(){return a});var r=n(3),i=n.n(r);function o(){if(null==document.getElementById(\"react-mathquill-styles\")){var t=document.createElement(\"style\");t.setAttribute(\"id\",\"react-mathquill-styles\"),t.innerHTML=i.a[0][1],document.getElementsByTagName(\"head\")[0].appendChild(t)}}var s=n(6).default,a=n(11).default;e.default=s},function(t,e,n){\"use strict\";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||\"\",r=t[3];if(!r)return n;if(e&&\"function\"==typeof btoa){var i=(s=r,a=btoa(unescape(encodeURIComponent(JSON.stringify(s)))),l=\"sourceMappingURL=data:application/json;charset=utf-8;base64,\".concat(a),\"/*# \".concat(l,\" */\")),o=r.sources.map(function(t){return\"/*# sourceURL=\".concat(r.sourceRoot).concat(t,\" */\")});return[n].concat(o).concat([i]).join(\"\\n\")}var s,a,l;return[n].join(\"\\n\")}(e,t);return e[2]?\"@media \".concat(e[2],\"{\").concat(n,\"}\"):n}).join(\"\")},e.i=function(t,n){\"string\"==typeof t&&(t=[[null,t,\"\"]]);for(var r={},i=0;i=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function f(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function p(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h(t,e){for(var n=0;n0?t.ignoreEditEvents-=1:t.props.onChange&&t.props.onChange(e)},this.mathField=a.a.MathField(this.element,e),this.mathField.latex(this.props.latex||\"\"),this.props.mathquillDidMount&&this.props.mathquillDidMount(this.mathField)}},{key:\"componentDidUpdate\",value:function(t){var e=this.mathField,n=this.props.latex;e&&t.latex!==n&&e.latex()!==n&&e.latex(n)}},{key:\"render\",value:function(){var t=this,e=this.props,n=(e.latex,e.onChange,e.config,e.mathquillDidMount,u(e,[\"latex\",\"onChange\",\"config\",\"mathquillDidMount\"]));return i.a.createElement(\"div\",c({},n,{ref:function(e){t.element=e}}))}}])&&h(n.prototype,r),o&&h(n,o),e}();v.propTypes={latex:s.a.string,onChange:s.a.func,config:s.a.object,mathquillDidMount:s.a.func},e.default=v},function(t,e,n){\"use strict\";var r=n(8);function i(){}function o(){}o.resetWarningCache=i,t.exports=function(){function t(t,e,n,i,o,s){if(s!==r){var a=new Error(\"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types\");throw a.name=\"Invariant Violation\",a}}function e(){return t}t.isRequired=t;var n={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},function(t,e,n){\"use strict\";t.exports=\"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED\"},function(t,e,n){var r=r||{};r.jQuery=n(10),function(){var t,e=r.jQuery,n=\"mathquill-block-id\",i=Math.min,o=Math.max;if(!e)throw\"MathQuill requires jQuery 1.5.2+ to be loaded first\";function s(){}var a=[].slice;function l(t){var e=t.length-1;return function(){var n=a.call(arguments,0,e),r=a.call(arguments,e);return t.apply(this,n.concat([r]))}}var c=l(function(t,e){return l(function(n,r){if(t in n)return n[t].apply(n,e.concat(r))})});function u(t){return l(function(e,n){\"function\"!=typeof e&&(e=c(e));return t.call(this,function(t){return e.apply(t,[t].concat(n))})})}function f(t){var e=a.call(arguments,1);return function(){return t.apply(this,e)}}function p(t,e){if(!e)throw new Error(\"prayer failed: \"+t)}var h=function(t,e,n){function r(t){return\"object\"==typeof t}function i(t){return\"function\"==typeof t}function o(){}return function t(n,s){function a(){var t=new l;return i(t.init)&&t.init.apply(t,arguments),t}function l(){}void 0===s&&(s=n,n=Object),a.Bare=l;var c,u=o.prototype=n.prototype,f=l.prototype=a.prototype=a.p=new o;return f.constructor=a,a.extend=function(e){return t(a,e)},(a.open=function(t){if(c={},i(t)?c=t.call(a,f,u,a,n):r(t)&&(c=t),r(c))for(var o in c)e.call(c,o)&&(f[o]=c[o]);return i(f.init)||(f.init=n),a})(s)}}(0,{}.hasOwnProperty),d=-1,m=1;function g(t){p(\"a direction was passed\",t===d||t===m)}var v=h(e,function(t){t.insDirOf=function(t,e){return t===d?this.insertBefore(e.first()):this.insertAfter(e.last())},t.insAtDirEnd=function(t,e){return t===d?this.prependTo(e):this.appendTo(e)}}),b=h(function(t){t.parent=0,t[d]=0,t[m]=0,t.init=function(t,e,n){this.parent=t,this[d]=e,this[m]=n},this.copy=function(t){return b(t.parent,t[d],t[m])}}),y=h(function(t){t[d]=0,t[m]=0,t.parent=0;var e=0;this.byId={},t.init=function(){this.id=e+=1,y.byId[this.id]=this,this.ends={},this.ends[d]=0,this.ends[m]=0},t.dispose=function(){delete y.byId[this.id]},t.toString=function(){return\"{{ MathQuill Node #\"+this.id+\" }}\"},t.jQ=v(),t.jQadd=function(t){return this.jQ=this.jQ.add(t)},t.jQize=function(t){t=v(t||this.html());function e(t){if(t.getAttribute){var n=t.getAttribute(\"mathquill-command-id\"),r=t.getAttribute(\"mathquill-block-id\");n&&y.byId[n].jQadd(t),r&&y.byId[r].jQadd(t)}for(t=t.firstChild;t;t=t.nextSibling)e(t)}for(var n=0;n');this.blink=function(){n.toggleClass(\"mq-blink\")},this.upDownCache={}},e.show=function(){return this.jQ=this._jQ.removeClass(\"mq-blink\"),\"intervalId\"in this?clearInterval(this.intervalId):(this[m]?this.selection&&this.selection.ends[d][d]===this[d]?this.jQ.insertBefore(this.selection.jQ):this.jQ.insertBefore(this[m].jQ.first()):this.jQ.appendTo(this.parent.jQ),this.parent.focus()),this.intervalId=setInterval(this.blink,500),this},e.hide=function(){return\"intervalId\"in this&&clearInterval(this.intervalId),delete this.intervalId,this.jQ.detach(),this.jQ=v(),this},e.withDirInsertAt=function(t,e,n,r){var i=this.parent;this.parent=e,this[t]=n,this[-t]=r,i!==e&&i.blur&&i.blur(this)},e.insDirOf=function(t,e){return g(t),this.jQ.insDirOf(t,e.jQ),this.withDirInsertAt(t,e.parent,e[t],e),this.parent.jQ.addClass(\"mq-hasCursor\"),this},e.insLeftOf=function(t){return this.insDirOf(d,t)},e.insRightOf=function(t){return this.insDirOf(m,t)},e.insAtDirEnd=function(t,e){return g(t),this.jQ.insAtDirEnd(t,e.jQ),this.withDirInsertAt(t,e,0,e.ends[t]),e.focus(),this},e.insAtLeftEnd=function(t){return this.insAtDirEnd(d,t)},e.insAtRightEnd=function(t){return this.insAtDirEnd(m,t)},e.jumpUpDown=function(t,e){this.upDownCache[t.id]=b.copy(this);var n=this.upDownCache[e.id];if(n)n[m]?this.insLeftOf(n[m]):this.insAtRightEnd(n.parent);else{var r=this.offset().left;e.seek(r,this)}},e.offset=function(){var t=this.jQ.removeClass(\"mq-cursor\").offset();return this.jQ.addClass(\"mq-cursor\"),t},e.unwrapGramp=function(){var t=this.parent.parent,e=t.parent,n=t[m],r=t[d];if(t.disown().eachChild(function(i){i.isEmpty()||(i.children().adopt(e,r,n).each(function(e){e.jQ.insertBefore(t.jQ.first())}),r=i.ends[m])}),!this[m])if(this[d])this[m]=this[d][m];else for(;!this[m];){if(this.parent=this.parent[m],!this.parent){this[m]=t[m],this.parent=e;break}this[m]=this.parent.ends[d]}this[m]?this.insLeftOf(this[m]):this.insAtRightEnd(e),t.jQ.remove(),t[d].siblingDeleted&&t[d].siblingDeleted(this.options,m),t[m].siblingDeleted&&t[m].siblingDeleted(this.options,d)},e.startSelection=function(){for(var t=this.anticursor=b.copy(this),e=t.ancestors={},n=t;n.parent;n=n.parent)e[n.parent.id]=n},e.endSelection=function(){delete this.anticursor},e.select=function(){var t=this.anticursor;if(this[d]===t[d]&&this.parent===t.parent)return!1;for(var e=this;e.parent;e=e.parent)if(e.parent.id in t.ancestors){var n=e.parent;break}p(\"cursor and anticursor in the same tree\",n);var r,i,o=t.ancestors[n.id],s=m;if(e[d]!==o)for(var a=e;a;a=a[m])if(a[m]===o[m]){s=d,r=e,i=o;break}return s===m&&(r=o,i=e),r instanceof b&&(r=r[m]),i instanceof b&&(i=i[d]),this.hide().selection=n.selectChildren(r,i),this.insDirOf(s,this.selection.ends[s]),this.selectionChanged(),!0},e.clearSelection=function(){return this.selection&&(this.selection.clear(),delete this.selection,this.selectionChanged()),this},e.deleteSelection=function(){this.selection&&(this[d]=this.selection.ends[d][d],this[m]=this.selection.ends[m][m],this.selection.remove(),this.selectionChanged(),delete this.selection)},e.replaceSelection=function(){var t=this.selection;return t&&(this[d]=t.ends[d][d],this[m]=t.ends[m][m],delete this.selection),t},e.depth=function(){for(var t=this,e=0;t=t.parent;)e+=t instanceof V?1:0;return e},e.isTooDeep=function(e){if(this.options.maxDepth!==t)return this.depth()+(e||0)>this.options.maxDepth}}),C=h(q,function(t,e){t.init=function(){e.init.apply(this,arguments),this.jQ=this.jQ.wrapAll('').parent()},t.adopt=function(){return this.jQ.replaceWith(this.jQ=this.jQ.children()),e.adopt.apply(this,arguments)},t.clear=function(){return this.jQ.replaceWith(this.jQ[0].childNodes),this},t.join=function(t){return this.fold(\"\",function(e,n){return e+n[t]()})}}),O=h(function(t){t.init=function(t,e,n){this.id=t.id,this.data={},this.root=t,this.container=e,this.options=n,t.controller=this,this.cursor=t.cursor=k(t,n)},t.handle=function(t,e){var n=this.options.handlers;if(n&&n.fns[t]){var r=n.APIClasses[this.KIND_OF_MQ](this);e===d||e===m?n.fns[t](e,r):n.fns[t](r)}};var e=[];this.onNotify=function(t){e.push(t)},t.notify=function(){for(var t=0;t').attr(n,r.id).appendTo(i),this.latex(o.text()),this.revert=function(){return i.empty().unbind(\".mathquill\").removeClass(\"mq-editable-field mq-math-mode mq-text-mode\").append(o)}},t.config=function(t){return a(this.__options,t),this},t.el=function(){return this.__controller.container[0]},t.text=function(){return this.__controller.exportText()},t.latex=function(t){return arguments.length>0?(this.__controller.renderLatexMath(t),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()},t.html=function(){return this.__controller.root.jQ.html().replace(/ mathquill-(?:command|block)-id=\"?\\d+\"?/g,\"\").replace(/.?<\\/span>/i,\"\").replace(/ mq-hasCursor|mq-hasCursor ?/,\"\").replace(/ class=(\"\"|(?= |>))/g,\"\")},t.reflow=function(){return this.__controller.root.postOrder(\"reflow\"),this}});for(var c in i.prototype=l.prototype,o.EditableField=h(l,function(t,n){t.__mathquillify=function(){return n.__mathquillify.apply(this,arguments),this.__controller.editable=!0,this.__controller.delegateMouseEvents(),this.__controller.editablesTextareaEvents(),this},t.focus=function(){return this.__controller.textarea.focus(),this},t.blur=function(){return this.__controller.textarea.blur(),this},t.write=function(t){return this.__controller.writeLatex(t),this.__controller.scrollHoriz(),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this},t.empty=function(){var t=this.__controller.root,e=this.__controller.cursor;return t.eachChild(\"postOrder\",\"dispose\"),t.ends[d]=t.ends[m]=0,t.jQ.empty(),delete e.selection,e.insAtRightEnd(t),this},t.cmd=function(t){var e=this.__controller.notify(),n=e.cursor;if(/^\\\\[a-z]+$/i.test(t)&&!n.isTooDeep()){t=t.slice(1);var r=w[t];r&&(t=r(t),n.selection&&t.replaces(n.replaceSelection()),t.createLeftOf(n.show()),this.__controller.scrollHoriz())}else n.parent.write(n,t);return e.blurred&&n.hide().parent.blur(),this},t.select=function(){var t=this.__controller;for(t.notify(\"move\").cursor.insAtRightEnd(t.root);t.cursor[d];)t.selectLeft();return this},t.clearSelection=function(){return this.__controller.cursor.clearSelection(),this},t.moveToDirEnd=function(t){return this.__controller.notify(\"move\").cursor.insAtDirEnd(t,this.__controller.root),this},t.moveToLeftEnd=function(){return this.moveToDirEnd(d)},t.moveToRightEnd=function(){return this.moveToDirEnd(m)},t.keystroke=function(t){t=t.replace(/^\\s+|\\s+$/g,\"\").split(/\\s+/);for(var e=0;e\")[0]},n.createTextarea=function(){var t=this.textareaSpan=v(''),e=this.options.substituteTextarea();if(!e.nodeType)throw\"substituteTextarea() must return a DOM element, got \"+e;e=this.textarea=v(e).appendTo(t);var n=this;n.cursor.selectionChanged=function(){n.selectionChanged()}},n.selectionChanged=function(){var e=this;rt(e.container[0]),e.textareaSelectionTimeout===t&&(e.textareaSelectionTimeout=setTimeout(function(){e.setTextareaSelection()}))},n.setTextareaSelection=function(){this.textareaSelectionTimeout=t;var e=\"\";this.cursor.selection&&(e=this.cursor.selection.join(\"latex\"),this.options.statelessClipboard&&(e=\"$\"+e+\"$\")),this.selectFn(e)},n.staticMathTextareaEvents=function(){var t=this,n=(t.root,t.cursor),r=t.textarea,i=t.textareaSpan;function o(){i.detach(),t.blurred=!0}this.container.prepend(e('').text(\"$\"+t.exportLatex()+\"$\")),t.blurred=!0,r.bind(\"cut paste\",!1).bind(\"copy\",function(){t.setTextareaSelection()}).focus(function(){t.blurred=!1}).blur(function(){n.selection&&n.selection.clear(),setTimeout(o)}),t.selectFn=function(t){r.val(t),t&&r.select()}},S.p.substituteKeyboardEvents=z,n.editablesTextareaEvents=function(){var t=this.textarea,e=this.textareaSpan,n=this.options.substituteKeyboardEvents(t,this);this.selectFn=function(t){n.select(t)},this.container.prepend(e),this.focusBlurEvents()},n.typedText=function(t){if(\"\\n\"===t)return this.handle(\"enter\");var e=this.notify().cursor;e.parent.write(e,t),this.scrollHoriz()},n.cut=function(){var t=this,e=t.cursor;e.selection&&setTimeout(function(){t.notify(\"edit\"),e.parent.bubble(\"reflow\")})},n.copy=function(){this.setTextareaSelection()},n.paste=function(t){this.options.statelessClipboard&&(t=\"$\"===t.slice(0,1)&&\"$\"===t.slice(-1)?t.slice(1,-1):\"\\\\text{\"+t+\"}\"),this.writeLatex(t).cursor.show()}});var H=function(){function t(t){for(var e=t[0]||V(),n=1;n0))return;if(r.left-o0)a=o;else{if(!(i<0))return;if(r.right-i>n.right-20)a=o;else a=i}}else{var s=t.jQ[0].getBoundingClientRect().left;if(s>n.right-20)var a=s-(n.right-20);else{if(!(sn)return!1;this.removeNodesDeeperThan(n-r)}return!0},e.removeNodesDeeperThan=function(t){for(var e,n=0,r=[[this,n]];r.length;)(e=r.shift())[0].children().each(function(i){var o=i instanceof V?1:0;(n=e[1]+o)<=t?r.push([i,n]):(o?i.children():i).remove()})}}),$=h(B,function(t,e){t.init=function(t,n,r){e.init.call(this),this.ctrlSeq||(this.ctrlSeq=t),n&&(this.htmlTemplate=n),r&&(this.textTemplate=r)},t.replaces=function(t){t.disown(),this.replacedFragment=t},t.isEmpty=function(){return this.foldChildren(!0,function(t,e){return t&&e.isEmpty()})},t.parser=function(){var t=H.block,e=this;return t.times(e.numBlocks()).map(function(t){e.blocks=t;for(var n=0;ni[m])return e.insRightOf(r);var o=i[d];r.eachChild(function(s){var a=n(s);return ta[m]?void(s[m]?o=a[m]:i[m]-t]+>|[^<>]+/g);p(\"no unmatched angle brackets\",n.join(\"\")===this.htmlTemplate);for(var r=0,i=n[0];i;i=n[r+=1])if(\"/>\"===i.slice(-2))n[r]=i.slice(0,-2)+e+\"/>\";else if(\"<\"===i.charAt(0)){p(\"not an unmatched top-level close tag\",\"/\"!==i.charAt(1)),n[r]=i.slice(0,-1)+e+\">\";var o=1;do{p(\"no missing close tags\",i=n[r+=1]),\"\"!==i.slice(-2)&&(o+=1)}while(o>0)}return n.join(\"\").replace(/>&(\\d+)/g,function(e,n){return\" mathquill-block-id=\"+t[n].id+\">\"+t[n].join(\"html\")})},t.latex=function(){return this.foldChildren(this.ctrlSeq,function(t,e){return t+\"{\"+(e.latex()||\" \")+\"}\"})},t.textTemplate=[\"\"],t.text=function(){var t=this,e=0;return t.foldChildren(t.textTemplate[e],function(n,r){e+=1;var i=r.text();return n&&\"(\"===t.textTemplate[e]&&\"(\"===i[0]&&\")\"===i.slice(-1)?n+i.slice(1,-1)+t.textTemplate[e]:n+i+(t.textTemplate[e]||\"\")})}}),W=h($,function(t,e){t.init=function(t,n,r){r||(r=t&&t.length>1?t.slice(1):t),e.init.call(this,t,n,[r])},t.parser=function(){return F.succeed(this)},t.numBlocks=function(){return 0},t.replaces=function(t){t.remove()},t.createBlocks=s,t.moveTowards=function(t,e){e.jQ.insDirOf(t,this.jQ),e[-t]=this,e[t]=this[t]},t.deleteTowards=function(t,e){e[t]=this.remove()[t]},t.seek=function(t,e){t-this.jQ.offset().left\"+(n||t)+\"\")}}),U=h(W,function(t,e){t.init=function(t,n,r){e.init.call(this,t,''+n+\"\",r)}}),V=h(B,function(t,e){t.join=function(t){return this.foldChildren(\"\",function(e,n){return e+n[t]()})},t.html=function(){return this.join(\"html\")},t.latex=function(){return this.join(\"latex\")},t.text=function(){return this.ends[d]===this.ends[m]&&0!==this.ends[d]?this.ends[d].text():this.join(\"text\")},t.keystroke=function(t,n,r){return!r.options.spaceBehavesLikeTab||\"Spacebar\"!==t&&\"Shift-Spacebar\"!==t?e.keystroke.apply(this,arguments):(n.preventDefault(),void r.escapeDir(\"Shift-Spacebar\"===t?d:m,t,n))},t.moveOutOf=function(t,e,n){!(n&&this.parent[n+\"Into\"])&&this[t]?e.insAtDirEnd(-t,this[t]):e.insDirOf(t,this.parent)},t.selectOutOf=function(t,e){e.insDirOf(t,this.parent)},t.deleteOutOf=function(t,e){e.unwrapGramp()},t.seek=function(t,e){var n=this.ends[m];if(!n||n.jQ.offset().left+n.jQ.outerWidth()0&&this.__controller.root.postOrder(\"registerInnerField\",this.innerFields=[],t.MathField),e}})};var G=h(V,I);j.MathField=function(t){return h(t.EditableField,function(t,e){this.RootBlock=G,t.__mathquillify=function(t,n){return this.config(t),n>1&&(this.__controller.root.reflow=s),e.__mathquillify.call(this,\"mq-editable-field mq-math-mode\"),delete this.__controller.root.reflow,this}})};var Y=h(y,function(t,e){function n(t){t.jQ[0].normalize();var e=t.jQ[0].firstChild;if(e){p(\"only node in TextBlock span is Text node\",3===e.nodeType);var n=K(e.data);return n.jQadd(e),t.children().disown(),n.adopt(t,0,0)}}t.ctrlSeq=\"\\\\text\",t.replaces=function(t){t instanceof q?this.replacedText=t.remove().jQ.text():\"string\"==typeof t&&(this.replacedText=t)},t.jQadd=function(t){e.jQadd.call(this,t),this.ends[d]&&this.ends[d].jQadd(this.jQ[0].firstChild)},t.createLeftOf=function(t){if(e.createLeftOf.call(this,t),this[m].siblingCreated&&this[m].siblingCreated(t.options,d),this[d].siblingCreated&&this[d].siblingCreated(t.options,m),this.bubble(\"reflow\"),t.insAtRightEnd(this),this.replacedText)for(var n=0;n&0',t.createBlocks=function(){e.createBlocks.call(this),this.ends[d].cursor=this.cursor,this.ends[d].write=function(t,e){\"$\"!==e?V.prototype.write.call(this,t,e):this.isEmpty()?(t.insRightOf(this.parent),this.parent.deleteTowards(dir,t),X(\"\\\\$\",\"$\").createLeftOf(t.show())):t[m]?t[d]?V.prototype.write.call(this,t,e):t.insLeftOf(this.parent):t.insRightOf(this.parent)}},t.latex=function(){return\"$\"+this.ends[d].latex()+\"$\"}}),tt=h(G,function(t,e){t.keystroke=function(t){if(\"Spacebar\"!==t&&\"Shift-Spacebar\"!==t)return e.keystroke.apply(this,arguments)},t.write=function(t,e){var n;(t.show().deleteSelection(),\"$\"===e)?J(t).createLeftOf(t):(\"<\"===e?n=\"<\":\">\"===e&&(n=\">\"),X(e,n).createLeftOf(t))}});j.TextField=function(t){return h(t.EditableField,function(t,e){this.RootBlock=tt,t.__mathquillify=function(){return e.__mathquillify.call(this,\"mq-editable-field mq-text-mode\")},t.latex=function(t){return arguments.length>0?(this.__controller.renderLatexText(t),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()}})};T[\"\\\\\"]=h($,function(t,e){t.ctrlSeq=\"\\\\\",t.replaces=function(t){this._replacedFragment=t.disown(),this.isEmpty=function(){return!1}},t.htmlTemplate='\\\\&0',t.textTemplate=[\"\\\\\"],t.createBlocks=function(){e.createBlocks.call(this),this.ends[d].focus=function(){return this.parent.jQ.addClass(\"mq-hasCursor\"),this.isEmpty()&&this.parent.jQ.removeClass(\"mq-empty\"),this},this.ends[d].blur=function(){return this.parent.jQ.removeClass(\"mq-hasCursor\"),this.isEmpty()&&this.parent.jQ.addClass(\"mq-empty\"),this},this.ends[d].write=function(t,e){t.show().deleteSelection(),e.match(/[a-z]/i)?X(e).createLeftOf(t):(this.parent.renderCommand(t),\"\\\\\"===e&&this.isEmpty()||t.parent.write(t,e))},this.ends[d].keystroke=function(t,n,r){return\"Tab\"===t||\"Enter\"===t||\"Spacebar\"===t?(this.parent.renderCommand(r.cursor),void n.preventDefault()):e.keystroke.apply(this,arguments)}},t.createLeftOf=function(t){if(e.createLeftOf.call(this,t),this._replacedFragment){var n=this.jQ[0];this.jQ=this._replacedFragment.jQ.addClass(\"mq-blur\").bind(\"mousedown mousemove\",function(t){return v(t.target=n).trigger(t),!1}).insertBefore(this.jQ).add(this.jQ)}},t.latex=function(){return\"\\\\\"+this.ends[d].latex()+\" \"},t.renderCommand=function(t){this.jQ=this.jQ.last(),this.remove(),this[m]?t.insLeftOf(this[m]):t.insAtRightEnd(this.parent);var e=this.ends[d].latex();e||(e=\" \");var n=w[e];n?(n=n(e),this._replacedFragment&&n.replaces(this._replacedFragment),n.createLeftOf(t)):((n=Y()).replaces(e),n.createLeftOf(t),t.insRightOf(n),this._replacedFragment&&this._replacedFragment.remove())}});var et,nt,rt=s,it=document.createElement(\"div\").style;for(var ot in{transform:1,WebkitTransform:1,MozTransform:1,OTransform:1,msTransform:1})if(ot in it){nt=ot;break}nt?et=function(t,e,n){t.css(nt,\"scale(\"+e+\",\"+n+\")\")}:\"filter\"in it?(rt=function(t){t.className=t.className},et=function(t,e,n){e/=1+(n-1)/2,t.css(\"fontSize\",n+\"em\"),t.hasClass(\"mq-matrixed-container\")||t.addClass(\"mq-matrixed-container\").wrapInner('');var i=t.children().css(\"filter\",\"progid:DXImageTransform.Microsoft.Matrix(M11=\"+e+\",SizingMethod='auto expand')\");function o(){t.css(\"marginRight\",(i.width()-1)*(e-1)/e+\"px\")}o();var s=setInterval(o);v(r).load(function(){clearTimeout(s),o()})}):et=function(t,e,n){t.css(\"fontSize\",n+\"em\")};var st=h($,function(t,e){t.init=function(t,n,r){e.init.call(this,t,\"<\"+n+\" \"+r+\">&0\")}});w.mathrm=f(st,\"\\\\mathrm\",\"span\",'class=\"mq-roman mq-font\"'),w.mathit=f(st,\"\\\\mathit\",\"i\",'class=\"mq-font\"'),w.mathbf=f(st,\"\\\\mathbf\",\"b\",'class=\"mq-font\"'),w.mathsf=f(st,\"\\\\mathsf\",\"span\",'class=\"mq-sans-serif mq-font\"'),w.mathtt=f(st,\"\\\\mathtt\",\"span\",'class=\"mq-monospace mq-font\"'),w.underline=f(st,\"\\\\underline\",\"span\",'class=\"mq-non-leaf mq-underline\"'),w.overline=w.bar=f(st,\"\\\\overline\",\"span\",'class=\"mq-non-leaf mq-overline\"'),w.overrightarrow=f(st,\"\\\\overrightarrow\",\"span\",'class=\"mq-non-leaf mq-overarrow mq-arrow-right\"'),w.overleftarrow=f(st,\"\\\\overleftarrow\",\"span\",'class=\"mq-non-leaf mq-overarrow mq-arrow-left\"'),w.overleftrightarrow=f(st,\"\\\\overleftrightarrow\",\"span\",'class=\"mq-non-leaf mq-overarrow mq-arrow-both\"'),w.overarc=f(st,\"\\\\overarc\",\"span\",'class=\"mq-non-leaf mq-overarc\"'),w.dot=h($,function(t,e){t.init=function(){e.init.call(this,\"\\\\dot\",'˙&0')}});w.textcolor=h($,function(t,e){t.setColor=function(t){this.color=t,this.htmlTemplate='&0'},t.latex=function(){return\"\\\\textcolor{\"+this.color+\"}{\"+this.blocks[0].latex()+\"}\"},t.parser=function(){var t=this,n=F.optWhitespace,r=F.string,i=F.regex;return n.then(r(\"{\")).then(i(/^[#\\w\\s.,()%-]*/)).skip(r(\"}\")).then(function(n){return t.setColor(n),e.parser.call(t)})},t.isStyleBlock=function(){return!0}}),w.class=h($,function(t,e){t.parser=function(){var t=this,n=F.string,r=F.regex;return F.optWhitespace.then(n(\"{\")).then(r(/^[-\\w\\s\\\\\\xA0-\\xFF]*/)).skip(n(\"}\")).then(function(n){return t.cls=n||\"\",t.htmlTemplate='&0',e.parser.call(t)})},t.latex=function(){return\"\\\\class{\"+this.cls+\"}{\"+this.blocks[0].latex()+\"}\"},t.isStyleBlock=function(){return!0}});var at=h($,function(t,e){t.ctrlSeq=\"_{...}^{...}\",t.createLeftOf=function(t){if(this.replacedFragment||t[d]||!t.options.supSubsRequireOperand)return e.createLeftOf.apply(this,arguments)},t.contactWeld=function(t){for(var e=d;e;e=e===d&&m)if(this[e]instanceof at){for(var n=\"sub\";n;n=\"sub\"===n&&\"sup\"){var r=this[n],i=this[e][n];if(r){if(i)if(r.isEmpty())s=b(i,0,i.ends[d]);else{r.jQ.children().insAtDirEnd(-e,i.jQ);var o=r.children().disown(),s=b(i,o.ends[m],i.ends[d]);e===d?o.adopt(i,i.ends[m],0):o.adopt(i,0,i.ends[d])}else this[e].addBlock(r.disown());this.placeCursor=function(t,n){return function(r){r.insAtDirEnd(-e,t||n)}}(i,r)}}this.remove(),t&&t[d]===this&&(e===m&&s?s[d]?t.insRightOf(s[d]):t.insAtLeftEnd(s.parent):t.insRightOf(this[e]));break}},S.p.charsThatBreakOutOfSupSub=\"\",t.finalizeTree=function(){this.ends[d].write=function(t,e){if(t.options.autoSubscriptNumerals&&this===this.parent.sub){if(\"_\"===e)return;var n=this.chToCmd(e,t.options);return n instanceof W?t.deleteSelection():t.clearSelection().insRightOf(this.parent),n.createLeftOf(t.show())}t[d]&&!t[m]&&!t.selection&&t.options.charsThatBreakOutOfSupSub.indexOf(e)>-1&&t.insRightOf(this.parent),V.p.write.apply(this,arguments)}},t.moveTowards=function(t,n,r){n.options.autoSubscriptNumerals&&!this.sup?n.insDirOf(t,this):e.moveTowards.apply(this,arguments)},t.deleteTowards=function(t,n){if(n.options.autoSubscriptNumerals&&this.sub){var r=this.sub.ends[-t];r instanceof W?r.remove():r&&r.deleteTowards(t,n.insAtDirEnd(-t,this.sub)),this.sub.isEmpty()&&(this.sub.deleteOutOf(d,n.insAtLeftEnd(this.sub)),this.sup&&n.insDirOf(-t,this))}else e.deleteTowards.apply(this,arguments)},t.latex=function(){function t(t,e){var n=e&&e.latex();return e?t+(1===n.length?n:\"{\"+(n||\" \")+\"}\"):\"\"}return t(\"_\",this.sub)+t(\"^\",this.sup)},t.addBlock=function(t){\"sub\"===this.supsub?(this.sup=this.upInto=this.sub.upOutOf=t,t.adopt(this,this.sub,0).downOutOf=this.sub,t.jQ=v('').append(t.jQ.children()).attr(n,t.id).prependTo(this.jQ)):(this.sub=this.downInto=this.sup.downOutOf=t,t.adopt(this,0,this.sup).upOutOf=this.sup,t.jQ=v('').append(t.jQ.children()).attr(n,t.id).appendTo(this.jQ.removeClass(\"mq-sup-only\")),this.jQ.append(''));for(var e=0;e<2;e+=1)!function(t,e,n,r){t[e].deleteOutOf=function(i,o){if(o.insDirOf(this[i]?-i:i,this.parent),!this.isEmpty()){var s=this.ends[i];this.children().disown().withDirAdopt(i,o.parent,o[i],o[-i]).jQ.insDirOf(-i,o.jQ),o[-i]=s}t.supsub=n,delete t[e],delete t[r+\"Into\"],t[n][r+\"OutOf\"]=lt,delete t[n].deleteOutOf,\"sub\"===e&&v(t.jQ.addClass(\"mq-sup-only\")[0].lastChild).remove(),this.remove()}}(this,\"sub sup\".split(\" \")[e],\"sup sub\".split(\" \")[e],\"down up\".split(\" \")[e])},t.reflow=function(){var t=this.jQ,e=t.prev();if(e.length){var n=t.children(\".mq-sup\");if(n.length){var r=parseInt(n.css(\"font-size\")),i=n.offset().top+n.height()-e.offset().top-.7*r,o=parseInt(n.css(\"margin-bottom\"));n.css(\"margin-bottom\",o+i)}}}});function lt(t){var e=this.parent,n=t;do{if(n[m])return t.insLeftOf(e);n=n.parent.parent}while(n!==e);t.insRightOf(e)}w.subscript=w._=h(at,function(t,e){t.supsub=\"sub\",t.htmlTemplate='&0',t.textTemplate=[\"_\"],t.finalizeTree=function(){this.downInto=this.sub=this.ends[d],this.sub.upOutOf=lt,e.finalizeTree.call(this)}}),w.superscript=w.supscript=w[\"^\"]=h(at,function(t,e){t.supsub=\"sup\",t.htmlTemplate='&0',t.textTemplate=[\"^\"],t.finalizeTree=function(){this.upInto=this.sup=this.ends[m],this.sup.downOutOf=lt,e.finalizeTree.call(this)}});var ct=h($,function(t,e){t.init=function(t,e){var n='&1'+e+'&0';W.prototype.init.call(this,t,n)},t.createLeftOf=function(t){e.createLeftOf.apply(this,arguments),t.options.sumStartsWithNEquals&&(Tt(\"n\").createLeftOf(t),Qt().createLeftOf(t))},t.latex=function(){function t(t){return 1===t.length?t:\"{\"+(t||\" \")+\"}\"}return this.ctrlSeq+\"_\"+t(this.ends[d].latex())+\"^\"+t(this.ends[m].latex())},t.parser=function(){for(var t=F.string,e=F.optWhitespace,n=F.succeed,r=H.block,i=this,o=i.blocks=[V(),V()],s=0;s&1&0')},t.createLeftOf=$.p.createLeftOf});var ut=w.frac=w.dfrac=w.cfrac=w.fraction=h($,function(t,e){t.ctrlSeq=\"\\\\frac\",t.htmlTemplate='&0&1',t.textTemplate=[\"(\",\")/(\",\")\"],t.finalizeTree=function(){this.upInto=this.ends[m].upOutOf=this.ends[d],this.downInto=this.ends[d].downOutOf=this.ends[m]}}),ft=w.over=T[\"/\"]=h(ut,function(t,e){t.createLeftOf=function(t){if(!this.replacedFragment){for(var n=t[d];n&&!(n instanceof U||n instanceof(w.text||s)||n instanceof ct||\"\\\\ \"===n.ctrlSeq||/^[,;:]$/.test(n.ctrlSeq));)n=n[d];n instanceof ct&&n[m]instanceof at&&(n=n[m])[m]instanceof at&&n[m].ctrlSeq!=n.ctrlSeq&&(n=n[m]),n===t[d]||t.isTooDeep(1)||(this.replaces(q(n[m]||t.parent.ends[d],t[d])),t[d]=n)}e.createLeftOf.call(this,t)}}),pt=w.sqrt=w[\"√\"]=h($,function(t,e){t.ctrlSeq=\"\\\\sqrt\",t.htmlTemplate='&0',t.textTemplate=[\"sqrt(\",\")\"],t.parser=function(){return H.optBlock.then(function(t){return H.block.map(function(e){var n=ht();return n.blocks=[t,e],t.adopt(n,0,0),e.adopt(n,t,0),n})}).or(e.parser.call(this))},t.reflow=function(){var t=this.ends[m].jQ;et(t.prev(),1,t.innerHeight()/+t.css(\"fontSize\").slice(0,-2)-.1)}}),ht=(w.hat=h($,function(t,e){t.ctrlSeq=\"\\\\hat\",t.htmlTemplate='^&0',t.textTemplate=[\"hat(\",\")\"]}),w.nthroot=h(pt,function(t,e){t.htmlTemplate='&0&1',t.textTemplate=[\"sqrt[\",\"](\",\")\"],t.latex=function(){return\"\\\\sqrt[\"+this.ends[d].latex()+\"]{\"+this.ends[m].latex()+\"}\"}})),dt=h($,function(t,e){t.init=function(t,n,r){var i=''+n+'&0';e.init.call(this,t,i,r)}});function mt(t,e){t.jQadd=function(){e.jQadd.apply(this,arguments),this.delimjQs=this.jQ.children(\":first\").add(this.jQ.children(\":last\")),this.contentjQ=this.jQ.children(\":eq(1)\")},t.reflow=function(){var t=this.contentjQ.outerHeight()/parseFloat(this.contentjQ.css(\"fontSize\"));et(this.delimjQs,i(1+.2*(t-1),1.2),1.2*t)}}w.vec=f(dt,\"\\\\vec\",\"→\",[\"vec(\",\")\"]),w.tilde=f(dt,\"\\\\tilde\",\"~\",[\"tilde(\",\")\"]);var gt=h(h($,mt),function(e,n){e.init=function(e,r,i,o,s){n.init.call(this,\"\\\\left\"+o,t,[r,i]),this.side=e,this.sides={},this.sides[d]={ch:r,ctrlSeq:o},this.sides[m]={ch:i,ctrlSeq:s}},e.numBlocks=function(){return 1},e.html=function(){return this.htmlTemplate=''+this.sides[d].ch+'&0'+this.sides[m].ch+\"\",n.html.call(this)},e.latex=function(){return\"\\\\left\"+this.sides[d].ctrlSeq+this.ends[d].latex()+\"\\\\right\"+this.sides[m].ctrlSeq},e.matchBrack=function(t,e,n){return n instanceof gt&&n.side&&n.side!==-e&&(!t.restrictMismatchedBrackets||vt[this.sides[this.side].ch]===n.sides[n.side].ch||{\"(\":\"]\",\"[\":\")\"}[this.sides[d].ch]===n.sides[m].ch)&&n},e.closeOpposing=function(t){t.side=0,t.sides[this.side]=this.sides[this.side],t.delimjQs.eq(this.side===d?0:1).removeClass(\"mq-ghost\").html(this.sides[this.side].ch)},e.createLeftOf=function(t){if(!this.replacedFragment){var e=t.options;if(\"|\"===this.sides[d].ch)var r=this.matchBrack(e,m,t[m])||this.matchBrack(e,d,t[d])||this.matchBrack(e,0,t.parent.parent);else r=this.matchBrack(e,-this.side,t[-this.side])||this.matchBrack(e,-this.side,t.parent.parent)}if(r){var i=this.side=-r.side;this.closeOpposing(r),r===t.parent.parent&&t[i]&&q(t[i],t.parent.ends[i],-i).disown().withDirAdopt(-i,r.parent,r,r[i]).jQ.insDirOf(i,r.jQ),r.bubble(\"reflow\")}else i=(r=this).side,r.replacedFragment?r.side=0:t[-i]&&(r.replaces(q(t[-i],t.parent.ends[-i],i)),t[-i]=0),n.createLeftOf.call(r,t);i===d?t.insAtLeftEnd(r.ends[d]):t.insRightOf(r)},e.placeCursor=s,e.unwrap=function(){this.ends[d].children().disown().adopt(this.parent,this,this[m]).jQ.insertAfter(this.jQ),this.remove()},e.deleteSide=function(t,e,n){var r=this.parent,i=this[t],o=r.ends[t];if(t===this.side)return this.unwrap(),void(i?n.insDirOf(-t,i):n.insAtDirEnd(t,r));var s=n.options,a=!this.side;if(this.side=-t,this.matchBrack(s,t,this.ends[d].ends[this.side])){this.closeOpposing(this.ends[d].ends[this.side]);var l=this.ends[d].ends[t];this.unwrap(),l.siblingCreated&&l.siblingCreated(n.options,t),i?n.insDirOf(-t,i):n.insAtDirEnd(t,r)}else{if(this.matchBrack(s,t,this.parent.parent))this.parent.parent.closeOpposing(this),this.parent.parent.unwrap();else{if(e&&a)return this.unwrap(),void(i?n.insDirOf(-t,i):n.insAtDirEnd(t,r));this.sides[t]={ch:vt[this.sides[this.side].ch],ctrlSeq:vt[this.sides[this.side].ctrlSeq]},this.delimjQs.removeClass(\"mq-ghost\").eq(t===d?0:1).addClass(\"mq-ghost\").html(this.sides[t].ch)}if(i){l=this.ends[d].ends[t];q(i,o,-t).disown().withDirAdopt(-t,this.ends[d],l,0).jQ.insAtDirEnd(t,this.ends[d].jQ.removeClass(\"mq-empty\")),l.siblingCreated&&l.siblingCreated(n.options,t),n.insDirOf(-t,i)}else e?n.insDirOf(t,this):n.insAtDirEnd(t,this.ends[d])}},e.deleteTowards=function(t,e){this.deleteSide(-t,!1,e)},e.finalizeTree=function(){this.ends[d].deleteOutOf=function(t,e){this.parent.deleteSide(t,!0,e)},this.finalizeTree=this.intentionalBlur=function(){this.delimjQs.eq(this.side===d?1:0).removeClass(\"mq-ghost\"),this.side=0}},e.siblingCreated=function(t,e){e===-this.side&&this.finalizeTree()}}),vt={\"(\":\")\",\")\":\"(\",\"[\":\"]\",\"]\":\"[\",\"{\":\"}\",\"}\":\"{\",\"\\\\{\":\"\\\\}\",\"\\\\}\":\"\\\\{\",\"⟨\":\"⟩\",\"⟩\":\"⟨\",\"\\\\langle \":\"\\\\rangle \",\"\\\\rangle \":\"\\\\langle \",\"|\":\"|\",\"\\\\lVert \":\"\\\\rVert \",\"\\\\rVert \":\"\\\\lVert \"};function bt(t,e){e=e||t;var n=vt[t],r=vt[e];T[t]=f(gt,d,t,n,e,r),T[n]=f(gt,m,t,n,e,r)}bt(\"(\"),bt(\"[\"),bt(\"{\",\"\\\\{\"),w.langle=f(gt,d,\"⟨\",\"⟩\",\"\\\\langle \",\"\\\\rangle \"),w.rangle=f(gt,m,\"⟨\",\"⟩\",\"\\\\langle \",\"\\\\rangle \"),T[\"|\"]=f(gt,d,\"|\",\"|\",\"|\",\"|\"),w.lVert=f(gt,d,\"∥\",\"∥\",\"\\\\lVert \",\"\\\\rVert \"),w.rVert=f(gt,m,\"∥\",\"∥\",\"\\\\lVert \",\"\\\\rVert \"),w.left=h($,function(t){t.parser=function(){var t=F.regex,e=F.string,n=(F.succeed,F.optWhitespace);return n.then(t(/^(?:[([|]|\\\\\\{|\\\\langle(?![a-zA-Z])|\\\\lVert(?![a-zA-Z]))/)).then(function(r){var i=\"\\\\\"===r.charAt(0)?r.slice(1):r;return\"\\\\langle\"==r&&(i=\"⟨\",r+=\" \"),\"\\\\lVert\"==r&&(i=\"∥\",r+=\" \"),H.then(function(o){return e(\"\\\\right\").skip(n).then(t(/^(?:[\\])|]|\\\\\\}|\\\\rangle(?![a-zA-Z])|\\\\rVert(?![a-zA-Z]))/)).map(function(t){var e=\"\\\\\"===t.charAt(0)?t.slice(1):t;\"\\\\rangle\"==t&&(e=\"⟩\",t+=\" \"),\"\\\\rVert\"==t&&(e=\"∥\",t+=\" \");var n=gt(0,i,e,r,t);return n.blocks=[o],o.adopt(n,0,0),n})})})}}),w.right=h($,function(t){t.parser=function(){return F.fail(\"unmatched \\\\right\")}});var yt=w.binom=w.binomial=h(h($,mt),function(t,e){t.ctrlSeq=\"\\\\binom\",t.htmlTemplate='(&0&1)',t.textTemplate=[\"choose(\",\",\",\")\"]});w.choose=h(yt,function(t){t.createLeftOf=ft.prototype.createLeftOf});w.editable=w.MathQuillMathField=h($,function(t,e){t.ctrlSeq=\"\\\\MathQuillMathField\",t.htmlTemplate='&0',t.parser=function(){var t=this,n=F.string,r=F.regex,i=F.succeed;return n(\"[\").then(r(/^[a-z][a-z0-9]*/i)).skip(n(\"]\")).map(function(e){t.name=e}).or(i()).then(e.parser.call(t))},t.finalizeTree=function(t){var e=O(this.ends[d],this.jQ,t);e.KIND_OF_MQ=\"MathField\",e.editable=!0,e.createTextarea(),e.editablesTextareaEvents(),e.cursor.insAtRightEnd(e.root),I(e.root)},t.registerInnerField=function(t,e){t.push(t[this.name]=e(this.ends[d].controller))},t.latex=function(){return this.ends[d].latex()},t.text=function(){return this.ends[d].text()}});var xt=w.embed=h(W,function(t,e){t.setOptions=function(t){function e(){return\"\"}return this.text=t.text||e,this.htmlTemplate=t.htmlString||\"\",this.latex=t.latex||e,this},t.parser=function(){var t=this,e=F.string,n=F.regex,r=F.succeed;return e(\"{\").then(n(/^[a-z][a-z0-9]*/i)).skip(e(\"}\")).then(function(i){return e(\"[\").then(n(/^[-\\w\\s]*/)).skip(e(\"]\")).or(r()).map(function(e){return t.setOptions(A[i](e))})})}});w.notin=w.cong=w.equiv=w.oplus=w.otimes=h(U,function(t,e){t.init=function(t){e.init.call(this,\"\\\\\"+t+\" \",\"&\"+t+\";\")}}),w[\"≠\"]=w.ne=w.neq=f(U,\"\\\\ne \",\"≠\"),w[\"∗\"]=w.ast=w.star=w.loast=w.lowast=f(U,\"\\\\ast \",\"∗\"),w.therefor=w.therefore=f(U,\"\\\\therefore \",\"∴\"),w.cuz=w.because=f(U,\"\\\\because \",\"∵\"),w.prop=w.propto=f(U,\"\\\\propto \",\"∝\"),w[\"≈\"]=w.asymp=w.approx=f(U,\"\\\\approx \",\"≈\"),w.isin=w.in=f(U,\"\\\\in \",\"∈\"),w.ni=w.contains=f(U,\"\\\\ni \",\"∋\"),w.notni=w.niton=w.notcontains=w.doesnotcontain=f(U,\"\\\\not\\\\ni \",\"∌\"),w.sub=w.subset=f(U,\"\\\\subset \",\"⊂\"),w.sup=w.supset=w.superset=f(U,\"\\\\supset \",\"⊃\"),w.nsub=w.notsub=w.nsubset=w.notsubset=f(U,\"\\\\not\\\\subset \",\"⊄\"),w.nsup=w.notsup=w.nsupset=w.notsupset=w.nsuperset=w.notsuperset=f(U,\"\\\\not\\\\supset \",\"⊅\"),w.sube=w.subeq=w.subsete=w.subseteq=f(U,\"\\\\subseteq \",\"⊆\"),w.supe=w.supeq=w.supsete=w.supseteq=w.supersete=w.superseteq=f(U,\"\\\\supseteq \",\"⊇\"),w.nsube=w.nsubeq=w.notsube=w.notsubeq=w.nsubsete=w.nsubseteq=w.notsubsete=w.notsubseteq=f(U,\"\\\\not\\\\subseteq \",\"⊈\"),w.nsupe=w.nsupeq=w.notsupe=w.notsupeq=w.nsupsete=w.nsupseteq=w.notsupsete=w.notsupseteq=w.nsupersete=w.nsuperseteq=w.notsupersete=w.notsuperseteq=f(U,\"\\\\not\\\\supseteq \",\"⊉\"),w.N=w.naturals=w.Naturals=f(X,\"\\\\mathbb{N}\",\"ℕ\"),w.P=w.primes=w.Primes=w.projective=w.Projective=w.probability=w.Probability=f(X,\"\\\\mathbb{P}\",\"ℙ\"),w.Z=w.integers=w.Integers=f(X,\"\\\\mathbb{Z}\",\"ℤ\"),w.Q=w.rationals=w.Rationals=f(X,\"\\\\mathbb{Q}\",\"ℚ\"),w.R=w.reals=w.Reals=f(X,\"\\\\mathbb{R}\",\"ℝ\"),w.C=w.complex=w.Complex=w.complexes=w.Complexes=w.complexplane=w.Complexplane=w.ComplexPlane=f(X,\"\\\\mathbb{C}\",\"ℂ\"),w.H=w.Hamiltonian=w.quaternions=w.Quaternions=f(X,\"\\\\mathbb{H}\",\"ℍ\"),w.quad=w.emsp=f(X,\"\\\\quad \",\" \"),w.qquad=f(X,\"\\\\qquad \",\" \"),w.diamond=f(X,\"\\\\diamond \",\"◇\"),w.bigtriangleup=f(X,\"\\\\bigtriangleup \",\"△\"),w.ominus=f(X,\"\\\\ominus \",\"⊖\"),w.uplus=f(X,\"\\\\uplus \",\"⊎\"),w.bigtriangledown=f(X,\"\\\\bigtriangledown \",\"▽\"),w.sqcap=f(X,\"\\\\sqcap \",\"⊓\"),w.triangleleft=f(X,\"\\\\triangleleft \",\"⊲\"),w.sqcup=f(X,\"\\\\sqcup \",\"⊔\"),w.triangleright=f(X,\"\\\\triangleright \",\"⊳\"),w.odot=w.circledot=f(X,\"\\\\odot \",\"⊙\"),w.bigcirc=f(X,\"\\\\bigcirc \",\"◯\"),w.dagger=f(X,\"\\\\dagger \",\"†\"),w.ddagger=f(X,\"\\\\ddagger \",\"‡\"),w.wr=f(X,\"\\\\wr \",\"≀\"),w.amalg=f(X,\"\\\\amalg \",\"∐\"),w.models=f(X,\"\\\\models \",\"⊨\"),w.prec=f(X,\"\\\\prec \",\"≺\"),w.succ=f(X,\"\\\\succ \",\"≻\"),w.preceq=f(X,\"\\\\preceq \",\"≼\"),w.succeq=f(X,\"\\\\succeq \",\"≽\"),w.simeq=f(X,\"\\\\simeq \",\"≃\"),w.mid=f(X,\"\\\\mid \",\"∣\"),w.ll=f(X,\"\\\\ll \",\"≪\"),w.gg=f(X,\"\\\\gg \",\"≫\"),w.parallel=f(X,\"\\\\parallel \",\"∥\"),w.nparallel=f(X,\"\\\\nparallel \",\"∦\"),w.bowtie=f(X,\"\\\\bowtie \",\"⋈\"),w.sqsubset=f(X,\"\\\\sqsubset \",\"⊏\"),w.sqsupset=f(X,\"\\\\sqsupset \",\"⊐\"),w.smile=f(X,\"\\\\smile \",\"⌣\"),w.sqsubseteq=f(X,\"\\\\sqsubseteq \",\"⊑\"),w.sqsupseteq=f(X,\"\\\\sqsupseteq \",\"⊒\"),w.doteq=f(X,\"\\\\doteq \",\"≐\"),w.frown=f(X,\"\\\\frown \",\"⌢\"),w.vdash=f(X,\"\\\\vdash \",\"⊦\"),w.dashv=f(X,\"\\\\dashv \",\"⊣\"),w.nless=f(X,\"\\\\nless \",\"≮\"),w.ngtr=f(X,\"\\\\ngtr \",\"≯\"),w.longleftarrow=f(X,\"\\\\longleftarrow \",\"←\"),w.longrightarrow=f(X,\"\\\\longrightarrow \",\"→\"),w.Longleftarrow=f(X,\"\\\\Longleftarrow \",\"⇐\"),w.Longrightarrow=f(X,\"\\\\Longrightarrow \",\"⇒\"),w.longleftrightarrow=f(X,\"\\\\longleftrightarrow \",\"↔\"),w.updownarrow=f(X,\"\\\\updownarrow \",\"↕\"),w.Longleftrightarrow=f(X,\"\\\\Longleftrightarrow \",\"⇔\"),w.Updownarrow=f(X,\"\\\\Updownarrow \",\"⇕\"),w.mapsto=f(X,\"\\\\mapsto \",\"↦\"),w.nearrow=f(X,\"\\\\nearrow \",\"↗\"),w.hookleftarrow=f(X,\"\\\\hookleftarrow \",\"↩\"),w.hookrightarrow=f(X,\"\\\\hookrightarrow \",\"↪\"),w.searrow=f(X,\"\\\\searrow \",\"↘\"),w.leftharpoonup=f(X,\"\\\\leftharpoonup \",\"↼\"),w.rightharpoonup=f(X,\"\\\\rightharpoonup \",\"⇀\"),w.swarrow=f(X,\"\\\\swarrow \",\"↙\"),w.leftharpoondown=f(X,\"\\\\leftharpoondown \",\"↽\"),w.rightharpoondown=f(X,\"\\\\rightharpoondown \",\"⇁\"),w.nwarrow=f(X,\"\\\\nwarrow \",\"↖\"),w.ldots=f(X,\"\\\\ldots \",\"…\"),w.cdots=f(X,\"\\\\cdots \",\"⋯\"),w.vdots=f(X,\"\\\\vdots \",\"⋮\"),w.ddots=f(X,\"\\\\ddots \",\"⋱\"),w.surd=f(X,\"\\\\surd \",\"√\"),w.triangle=f(X,\"\\\\triangle \",\"△\"),w.ell=f(X,\"\\\\ell \",\"ℓ\"),w.top=f(X,\"\\\\top \",\"⊤\"),w.flat=f(X,\"\\\\flat \",\"♭\"),w.natural=f(X,\"\\\\natural \",\"♮\"),w.sharp=f(X,\"\\\\sharp \",\"♯\"),w.wp=f(X,\"\\\\wp \",\"℘\"),w.bot=f(X,\"\\\\bot \",\"⊥\"),w.clubsuit=f(X,\"\\\\clubsuit \",\"♣\"),w.diamondsuit=f(X,\"\\\\diamondsuit \",\"♢\"),w.heartsuit=f(X,\"\\\\heartsuit \",\"♡\"),w.spadesuit=f(X,\"\\\\spadesuit \",\"♠\"),w.parallelogram=f(X,\"\\\\parallelogram \",\"▱\"),w.square=f(X,\"\\\\square \",\"⬜\"),w.oint=f(X,\"\\\\oint \",\"∮\"),w.bigcap=f(X,\"\\\\bigcap \",\"∩\"),w.bigcup=f(X,\"\\\\bigcup \",\"∪\"),w.bigsqcup=f(X,\"\\\\bigsqcup \",\"⊔\"),w.bigvee=f(X,\"\\\\bigvee \",\"∨\"),w.bigwedge=f(X,\"\\\\bigwedge \",\"∧\"),w.bigodot=f(X,\"\\\\bigodot \",\"⊙\"),w.bigotimes=f(X,\"\\\\bigotimes \",\"⊗\"),w.bigoplus=f(X,\"\\\\bigoplus \",\"⊕\"),w.biguplus=f(X,\"\\\\biguplus \",\"⊎\"),w.lfloor=f(X,\"\\\\lfloor \",\"⌊\"),w.rfloor=f(X,\"\\\\rfloor \",\"⌋\"),w.lceil=f(X,\"\\\\lceil \",\"⌈\"),w.rceil=f(X,\"\\\\rceil \",\"⌉\"),w.opencurlybrace=w.lbrace=f(X,\"\\\\lbrace \",\"{\"),w.closecurlybrace=w.rbrace=f(X,\"\\\\rbrace \",\"}\"),w.lbrack=f(X,\"[\"),w.rbrack=f(X,\"]\"),w.slash=f(X,\"/\"),w.vert=f(X,\"|\"),w.perp=w.perpendicular=f(X,\"\\\\perp \",\"⊥\"),w.nabla=w.del=f(X,\"\\\\nabla \",\"∇\"),w.hbar=f(X,\"\\\\hbar \",\"ℏ\"),w.AA=w.Angstrom=w.angstrom=f(X,\"\\\\text\\\\AA \",\"Å\"),w.ring=w.circ=w.circle=f(X,\"\\\\circ \",\"∘\"),w.bull=w.bullet=f(X,\"\\\\bullet \",\"•\"),w.setminus=w.smallsetminus=f(X,\"\\\\setminus \",\"∖\"),w.not=w[\"¬\"]=w.neg=f(X,\"\\\\neg \",\"¬\"),w[\"…\"]=w.dots=w.ellip=w.hellip=w.ellipsis=w.hellipsis=f(X,\"\\\\dots \",\"…\"),w.converges=w.darr=w.dnarr=w.dnarrow=w.downarrow=f(X,\"\\\\downarrow \",\"↓\"),w.dArr=w.dnArr=w.dnArrow=w.Downarrow=f(X,\"\\\\Downarrow \",\"⇓\"),w.diverges=w.uarr=w.uparrow=f(X,\"\\\\uparrow \",\"↑\"),w.uArr=w.Uparrow=f(X,\"\\\\Uparrow \",\"⇑\"),w.to=f(U,\"\\\\to \",\"→\"),w.rarr=w.rightarrow=f(X,\"\\\\rightarrow \",\"→\"),w.implies=f(U,\"\\\\Rightarrow \",\"⇒\"),w.rArr=w.Rightarrow=f(X,\"\\\\Rightarrow \",\"⇒\"),w.gets=f(U,\"\\\\gets \",\"←\"),w.larr=w.leftarrow=f(X,\"\\\\leftarrow \",\"←\"),w.impliedby=f(U,\"\\\\Leftarrow \",\"⇐\"),w.lArr=w.Leftarrow=f(X,\"\\\\Leftarrow \",\"⇐\"),w.harr=w.lrarr=w.leftrightarrow=f(X,\"\\\\leftrightarrow \",\"↔\"),w.iff=f(U,\"\\\\Leftrightarrow \",\"⇔\"),w.hArr=w.lrArr=w.Leftrightarrow=f(X,\"\\\\Leftrightarrow \",\"⇔\"),w.Re=w.Real=w.real=f(X,\"\\\\Re \",\"ℜ\"),w.Im=w.imag=w.image=w.imagin=w.imaginary=w.Imaginary=f(X,\"\\\\Im \",\"ℑ\"),w.part=w.partial=f(X,\"\\\\partial \",\"∂\"),w.infty=w.infin=w.infinity=f(X,\"\\\\infty \",\"∞\"),w.pounds=f(X,\"\\\\pounds \",\"£\"),w.alef=w.alefsym=w.aleph=w.alephsym=f(X,\"\\\\aleph \",\"ℵ\"),w.xist=w.xists=w.exist=w.exists=f(X,\"\\\\exists \",\"∃\"),w.nexists=w.nexist=f(X,\"\\\\nexists \",\"∄\"),w.and=w.land=w.wedge=f(U,\"\\\\wedge \",\"∧\"),w.or=w.lor=w.vee=f(U,\"\\\\vee \",\"∨\"),w.o=w.O=w.empty=w.emptyset=w.oslash=w.Oslash=w.nothing=w.varnothing=f(U,\"\\\\varnothing \",\"∅\"),w.cup=w.union=f(U,\"\\\\cup \",\"∪\"),w.cap=w.intersect=w.intersection=f(U,\"\\\\cap \",\"∩\"),w.deg=w.degree=f(X,\"\\\\degree \",\"°\"),w.ang=w.angle=f(X,\"\\\\angle \",\"∠\"),w.measuredangle=f(X,\"\\\\measuredangle \",\"∡\");var qt=h(X,function(t,e){t.createLeftOf=function(t){t.options.autoSubscriptNumerals&&t.parent!==t.parent.parent.sub&&(t[d]instanceof wt&&!1!==t[d].isItalic||t[d]instanceof at&&t[d][d]instanceof wt&&!1!==t[d][d].isItalic)?(w._().createLeftOf(t),e.createLeftOf.call(this,t),t.insRightOf(t.parent.parent)):e.createLeftOf.call(this,t)}}),wt=h(W,function(t,e){t.init=function(t,n){e.init.call(this,t,\"\"+(n||t)+\"\")},t.text=function(){var t=this.ctrlSeq;return this.isPartOfOperator?\"\\\\\"==t[0]?t=t.slice(1,t.length):\" \"==t[t.length-1]&&(t=t.slice(0,-1)):(!this[d]||this[d]instanceof wt||this[d]instanceof U||\"\\\\ \"===this[d].ctrlSeq||(t=\"*\"+t),!this[m]||this[m]instanceof U||this[m]instanceof at||(t+=\"*\")),t}});S.p.autoCommands={_maxLength:0},D.autoCommands=function(t){if(!/^[a-z]+(?: [a-z]+)*$/i.test(t))throw'\"'+t+'\" not a space-delimited list of only letters';for(var e=t.split(\" \"),n={},r=0,i=0;i0){for(var i=\"\",o=this,s=0;o instanceof Tt&&o.ctrlSeq===o.letter&&s0;c-=1){var u=r.slice(a,a+c);if(e.hasOwnProperty(u)){for(var f=0,p=l;ff')},t.italicize=function(t){return this.jQ.html(\"f\").toggleClass(\"mq-f\",t),e.italicize.apply(this,arguments)}}),w[\" \"]=w.space=f(X,\"\\\\ \",\" \"),w[\"'\"]=w.prime=f(X,\"'\",\"′\"),w[\"″\"]=w.dprime=f(X,\"″\",\"″\"),w.backslash=f(X,\"\\\\backslash \",\"\\\\\"),T[\"\\\\\"]||(T[\"\\\\\"]=w.backslash),w.$=f(X,\"\\\\$\",\"$\");var Dt=h(W,function(t,e){t.init=function(t,n){e.init.call(this,t,''+(n||t)+\"\")}});w[\"@\"]=Dt,w[\"&\"]=f(Dt,\"\\\\&\",\"&\"),w[\"%\"]=f(Dt,\"\\\\%\",\"%\"),w.alpha=w.beta=w.gamma=w.delta=w.zeta=w.eta=w.theta=w.iota=w.kappa=w.mu=w.nu=w.xi=w.rho=w.sigma=w.tau=w.chi=w.psi=w.omega=h(wt,function(t,e){t.init=function(t){e.init.call(this,\"\\\\\"+t+\" \",\"&\"+t+\";\")}}),w.phi=f(wt,\"\\\\phi \",\"ϕ\"),w.phiv=w.varphi=f(wt,\"\\\\varphi \",\"φ\"),w.epsilon=f(wt,\"\\\\epsilon \",\"ϵ\"),w.epsiv=w.varepsilon=f(wt,\"\\\\varepsilon \",\"ε\"),w.piv=w.varpi=f(wt,\"\\\\varpi \",\"ϖ\"),w.sigmaf=w.sigmav=w.varsigma=f(wt,\"\\\\varsigma \",\"ς\"),w.thetav=w.vartheta=w.thetasym=f(wt,\"\\\\vartheta \",\"ϑ\"),w.upsilon=w.upsi=f(wt,\"\\\\upsilon \",\"υ\"),w.gammad=w.Gammad=w.digamma=f(wt,\"\\\\digamma \",\"ϝ\"),w.kappav=w.varkappa=f(wt,\"\\\\varkappa \",\"ϰ\"),w.rhov=w.varrho=f(wt,\"\\\\varrho \",\"ϱ\"),w.pi=w[\"π\"]=f(Dt,\"\\\\pi \",\"π\"),w.lambda=f(Dt,\"\\\\lambda \",\"λ\"),w.Upsilon=w.Upsi=w.upsih=w.Upsih=f(W,\"\\\\Upsilon \",'ϒ'),w.Gamma=w.Delta=w.Theta=w.Lambda=w.Xi=w.Pi=w.Sigma=w.Phi=w.Psi=w.Omega=w.forall=h(X,function(t,e){t.init=function(t){e.init.call(this,\"\\\\\"+t+\" \",\"&\"+t+\";\")}});var Et=h($,function(t){t.init=function(t){this.latex=t},t.createLeftOf=function(t){var e=H.parse(this.latex);e.children().adopt(t.parent,t[d],t[m]),t[d]=e.ends[m],e.jQize().insertBefore(t.jQ),e.finalizeInsert(t.options,t),e.ends[m][m].siblingCreated&&e.ends[m][m].siblingCreated(t.options,d),e.ends[d][d].siblingCreated&&e.ends[d][d].siblingCreated(t.options,m),t.parent.bubble(\"reflow\")},t.parser=function(){var t=H.parse(this.latex).children();return F.succeed(t)}});w[\"¹\"]=f(Et,\"^1\"),w[\"²\"]=f(Et,\"^2\"),w[\"³\"]=f(Et,\"^3\"),w[\"¼\"]=f(Et,\"\\\\frac14\"),w[\"½\"]=f(Et,\"\\\\frac12\"),w[\"¾\"]=f(Et,\"\\\\frac34\");var At=h(U,function(t){t.init=X.prototype.init,t.contactWeld=t.siblingCreated=t.siblingDeleted=function(t,e){if(e!==m)return this.jQ[0].className=function t(e){return e[d]?e[d]instanceof U||/^[,;:\\(\\[]$/.test(e[d].ctrlSeq)?\"\":\"mq-binary-operator\":e.parent&&e.parent.parent&&e.parent.parent.isStyleBlock()?t(e.parent.parent):\"\"}(this),this}});w[\"+\"]=f(At,\"+\",\"+\"),w[\"–\"]=w[\"-\"]=f(At,\"-\",\"−\"),w[\"±\"]=w.pm=w.plusmn=w.plusminus=f(At,\"\\\\pm \",\"±\"),w.mp=w.mnplus=w.minusplus=f(At,\"\\\\mp \",\"∓\"),T[\"*\"]=w.sdot=w.cdot=f(U,\"\\\\cdot \",\"·\",\"*\");var Lt=h(U,function(t,e){t.init=function(t,n){this.data=t,this.strict=n;var r=n?\"Strict\":\"\";e.init.call(this,t[\"ctrlSeq\"+r],t[\"html\"+r],t[\"text\"+r])},t.swap=function(t){this.strict=t;var e=t?\"Strict\":\"\";this.ctrlSeq=this.data[\"ctrlSeq\"+e],this.jQ.html(this.data[\"html\"+e]),this.textTemplate=[this.data[\"text\"+e]]},t.deleteTowards=function(t,n){if(t===d&&!this.strict)return this.swap(!0),void this.bubble(\"reflow\");e.deleteTowards.apply(this,arguments)}}),_t={ctrlSeq:\"\\\\le \",html:\"≤\",text:\"≤\",ctrlSeqStrict:\"<\",htmlStrict:\"<\",textStrict:\"<\"},Nt={ctrlSeq:\"\\\\ge \",html:\"≥\",text:\"≥\",ctrlSeqStrict:\">\",htmlStrict:\">\",textStrict:\">\"};w[\"<\"]=w.lt=f(Lt,_t,!0),w[\">\"]=w.gt=f(Lt,Nt,!0),w[\"≤\"]=w.le=w.leq=f(Lt,_t,!1),w[\"≥\"]=w.ge=w.geq=f(Lt,Nt,!1);var Qt=h(U,function(t,e){t.init=function(){e.init.call(this,\"=\",\"=\")},t.createLeftOf=function(t){if(t[d]instanceof Lt&&t[d].strict)return t[d].swap(!1),void t[d].bubble(\"reflow\");e.createLeftOf.apply(this,arguments)}});w[\"=\"]=Qt,w[\"×\"]=w.times=f(U,\"\\\\times \",\"×\",\"[x]\"),w[\"÷\"]=w.div=w.divide=w.divides=f(U,\"\\\\div \",\"÷\",\"[/]\"),T[\"~\"]=w.sim=f(U,\"\\\\sim \",\"~\",\"~\");var Rt=R(1);for(var Mt in Rt)!function(t,e){\"function\"==typeof e?(_[t]=function(){return L(),e.apply(this,arguments)},_[t].prototype=e.prototype):_[t]=e}(Mt,Rt[Mt])}(),t.exports=r.MathQuill},function(t,e,n){var r;\n/*!\n * jQuery JavaScript Library v3.4.1\n * https://jquery.com/\n *\n * Includes Sizzle.js\n * https://sizzlejs.com/\n *\n * Copyright JS Foundation and other contributors\n * Released under the MIT license\n * https://jquery.org/license\n *\n * Date: 2019-05-01T21:04Z\n */\n/*!\n * jQuery JavaScript Library v3.4.1\n * https://jquery.com/\n *\n * Includes Sizzle.js\n * https://sizzlejs.com/\n *\n * Copyright JS Foundation and other contributors\n * Released under the MIT license\n * https://jquery.org/license\n *\n * Date: 2019-05-01T21:04Z\n */\n!function(e,n){\"use strict\";\"object\"==typeof t.exports?t.exports=e.document?n(e,!0):function(t){if(!t.document)throw new Error(\"jQuery requires a window with a document\");return n(t)}:n(e)}(\"undefined\"!=typeof window?window:this,function(n,i){\"use strict\";var o=[],s=n.document,a=Object.getPrototypeOf,l=o.slice,c=o.concat,u=o.push,f=o.indexOf,p={},h=p.toString,d=p.hasOwnProperty,m=d.toString,g=m.call(Object),v={},b=function(t){return\"function\"==typeof t&&\"number\"!=typeof t.nodeType},y=function(t){return null!=t&&t===t.window},x={type:!0,src:!0,nonce:!0,noModule:!0};function q(t,e,n){var r,i,o=(n=n||s).createElement(\"script\");if(o.text=t,e)for(r in x)(i=e[r]||e.getAttribute&&e.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(t){return null==t?t+\"\":\"object\"==typeof t||\"function\"==typeof t?p[h.call(t)]||\"object\":typeof t}var T=function(t,e){return new T.fn.init(t,e)},k=/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g;function C(t){var e=!!t&&\"length\"in t&&t.length,n=w(t);return!b(t)&&!y(t)&&(\"array\"===n||0===e||\"number\"==typeof e&&e>0&&e-1 in t)}T.fn=T.prototype={jquery:\"3.4.1\",constructor:T,length:0,toArray:function(){return l.call(this)},get:function(t){return null==t?l.call(this):t<0?this[t+this.length]:this[t]},pushStack:function(t){var e=T.merge(this.constructor(),t);return e.prevObject=this,e},each:function(t){return T.each(this,t)},map:function(t){return this.pushStack(T.map(this,function(e,n){return t.call(e,n,e)}))},slice:function(){return this.pushStack(l.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(t){var e=this.length,n=+t+(t<0?e:0);return this.pushStack(n>=0&&n+~]|\"+M+\")\"+M+\"*\"),W=new RegExp(M+\"|>\"),X=new RegExp(z),U=new RegExp(\"^\"+I+\"$\"),V={ID:new RegExp(\"^#(\"+I+\")\"),CLASS:new RegExp(\"^\\\\.(\"+I+\")\"),TAG:new RegExp(\"^(\"+I+\"|[*])\"),ATTR:new RegExp(\"^\"+P),PSEUDO:new RegExp(\"^\"+z),CHILD:new RegExp(\"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(\"+M+\"*(even|odd|(([+-]|)(\\\\d*)n|)\"+M+\"*(?:([+-]|)\"+M+\"*(\\\\d+)|))\"+M+\"*\\\\)|)\",\"i\"),bool:new RegExp(\"^(?:\"+R+\")$\",\"i\"),needsContext:new RegExp(\"^\"+M+\"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\"+M+\"*((?:-\\\\d)?\\\\d*)\"+M+\"*\\\\)|)(?=[^-]|$)\",\"i\")},G=/HTML$/i,Y=/^(?:input|select|textarea|button)$/i,K=/^h\\d$/i,Z=/^[^{]+\\{\\s*\\[native \\w/,J=/^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/,tt=/[+~]/,et=new RegExp(\"\\\\\\\\([\\\\da-f]{1,6}\"+M+\"?|(\"+M+\")|.)\",\"ig\"),nt=function(t,e,n){var r=\"0x\"+e-65536;return r!=r||n?e:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},rt=/([\\0-\\x1f\\x7f]|^-?\\d)|^-$|[^\\0-\\x1f\\x7f-\\uFFFF\\w-]/g,it=function(t,e){return e?\"\\0\"===t?\"�\":t.slice(0,-1)+\"\\\\\"+t.charCodeAt(t.length-1).toString(16)+\" \":\"\\\\\"+t},ot=function(){p()},st=xt(function(t){return!0===t.disabled&&\"fieldset\"===t.nodeName.toLowerCase()},{dir:\"parentNode\",next:\"legend\"});try{_.apply(E=N.call(q.childNodes),q.childNodes),E[q.childNodes.length].nodeType}catch(t){_={apply:E.length?function(t,e){L.apply(t,N.call(e))}:function(t,e){for(var n=t.length,r=0;t[n++]=e[r++];);t.length=n-1}}}function at(t,e,r,i){var o,a,c,u,f,d,v,b=e&&e.ownerDocument,w=e?e.nodeType:9;if(r=r||[],\"string\"!=typeof t||!t||1!==w&&9!==w&&11!==w)return r;if(!i&&((e?e.ownerDocument||e:q)!==h&&p(e),e=e||h,m)){if(11!==w&&(f=J.exec(t)))if(o=f[1]){if(9===w){if(!(c=e.getElementById(o)))return r;if(c.id===o)return r.push(c),r}else if(b&&(c=b.getElementById(o))&&y(e,c)&&c.id===o)return r.push(c),r}else{if(f[2])return _.apply(r,e.getElementsByTagName(t)),r;if((o=f[3])&&n.getElementsByClassName&&e.getElementsByClassName)return _.apply(r,e.getElementsByClassName(o)),r}if(n.qsa&&!j[t+\" \"]&&(!g||!g.test(t))&&(1!==w||\"object\"!==e.nodeName.toLowerCase())){if(v=t,b=e,1===w&&W.test(t)){for((u=e.getAttribute(\"id\"))?u=u.replace(rt,it):e.setAttribute(\"id\",u=x),a=(d=s(t)).length;a--;)d[a]=\"#\"+u+\" \"+yt(d[a]);v=d.join(\",\"),b=tt.test(t)&&vt(e.parentNode)||e}try{return _.apply(r,b.querySelectorAll(v)),r}catch(e){j(t,!0)}finally{u===x&&e.removeAttribute(\"id\")}}}return l(t.replace(H,\"$1\"),e,r,i)}function lt(){var t=[];return function e(n,i){return t.push(n+\" \")>r.cacheLength&&delete e[t.shift()],e[n+\" \"]=i}}function ct(t){return t[x]=!0,t}function ut(t){var e=h.createElement(\"fieldset\");try{return!!t(e)}catch(t){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function ft(t,e){for(var n=t.split(\"|\"),i=n.length;i--;)r.attrHandle[n[i]]=e}function pt(t,e){var n=e&&t,r=n&&1===t.nodeType&&1===e.nodeType&&t.sourceIndex-e.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===e)return-1;return t?1:-1}function ht(t){return function(e){return\"input\"===e.nodeName.toLowerCase()&&e.type===t}}function dt(t){return function(e){var n=e.nodeName.toLowerCase();return(\"input\"===n||\"button\"===n)&&e.type===t}}function mt(t){return function(e){return\"form\"in e?e.parentNode&&!1===e.disabled?\"label\"in e?\"label\"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&st(e)===t:e.disabled===t:\"label\"in e&&e.disabled===t}}function gt(t){return ct(function(e){return e=+e,ct(function(n,r){for(var i,o=t([],n.length,e),s=o.length;s--;)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))})})}function vt(t){return t&&void 0!==t.getElementsByTagName&&t}for(e in n=at.support={},o=at.isXML=function(t){var e=t.namespaceURI,n=(t.ownerDocument||t).documentElement;return!G.test(e||n&&n.nodeName||\"HTML\")},p=at.setDocument=function(t){var e,i,s=t?t.ownerDocument||t:q;return s!==h&&9===s.nodeType&&s.documentElement?(d=(h=s).documentElement,m=!o(h),q!==h&&(i=h.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener(\"unload\",ot,!1):i.attachEvent&&i.attachEvent(\"onunload\",ot)),n.attributes=ut(function(t){return t.className=\"i\",!t.getAttribute(\"className\")}),n.getElementsByTagName=ut(function(t){return t.appendChild(h.createComment(\"\")),!t.getElementsByTagName(\"*\").length}),n.getElementsByClassName=Z.test(h.getElementsByClassName),n.getById=ut(function(t){return d.appendChild(t).id=x,!h.getElementsByName||!h.getElementsByName(x).length}),n.getById?(r.filter.ID=function(t){var e=t.replace(et,nt);return function(t){return t.getAttribute(\"id\")===e}},r.find.ID=function(t,e){if(void 0!==e.getElementById&&m){var n=e.getElementById(t);return n?[n]:[]}}):(r.filter.ID=function(t){var e=t.replace(et,nt);return function(t){var n=void 0!==t.getAttributeNode&&t.getAttributeNode(\"id\");return n&&n.value===e}},r.find.ID=function(t,e){if(void 0!==e.getElementById&&m){var n,r,i,o=e.getElementById(t);if(o){if((n=o.getAttributeNode(\"id\"))&&n.value===t)return[o];for(i=e.getElementsByName(t),r=0;o=i[r++];)if((n=o.getAttributeNode(\"id\"))&&n.value===t)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(t,e){return void 0!==e.getElementsByTagName?e.getElementsByTagName(t):n.qsa?e.querySelectorAll(t):void 0}:function(t,e){var n,r=[],i=0,o=e.getElementsByTagName(t);if(\"*\"===t){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(t,e){if(void 0!==e.getElementsByClassName&&m)return e.getElementsByClassName(t)},v=[],g=[],(n.qsa=Z.test(h.querySelectorAll))&&(ut(function(t){d.appendChild(t).innerHTML=\"\",t.querySelectorAll(\"[msallowcapture^='']\").length&&g.push(\"[*^$]=\"+M+\"*(?:''|\\\"\\\")\"),t.querySelectorAll(\"[selected]\").length||g.push(\"\\\\[\"+M+\"*(?:value|\"+R+\")\"),t.querySelectorAll(\"[id~=\"+x+\"-]\").length||g.push(\"~=\"),t.querySelectorAll(\":checked\").length||g.push(\":checked\"),t.querySelectorAll(\"a#\"+x+\"+*\").length||g.push(\".#.+[+~]\")}),ut(function(t){t.innerHTML=\"\";var e=h.createElement(\"input\");e.setAttribute(\"type\",\"hidden\"),t.appendChild(e).setAttribute(\"name\",\"D\"),t.querySelectorAll(\"[name=d]\").length&&g.push(\"name\"+M+\"*[*^$|!~]?=\"),2!==t.querySelectorAll(\":enabled\").length&&g.push(\":enabled\",\":disabled\"),d.appendChild(t).disabled=!0,2!==t.querySelectorAll(\":disabled\").length&&g.push(\":enabled\",\":disabled\"),t.querySelectorAll(\"*,:x\"),g.push(\",.*:\")})),(n.matchesSelector=Z.test(b=d.matches||d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(t){n.disconnectedMatch=b.call(t,\"*\"),b.call(t,\"[s!='']:x\"),v.push(\"!=\",z)}),g=g.length&&new RegExp(g.join(\"|\")),v=v.length&&new RegExp(v.join(\"|\")),e=Z.test(d.compareDocumentPosition),y=e||Z.test(d.contains)?function(t,e){var n=9===t.nodeType?t.documentElement:t,r=e&&e.parentNode;return t===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):t.compareDocumentPosition&&16&t.compareDocumentPosition(r)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1},S=e?function(t,e){if(t===e)return f=!0,0;var r=!t.compareDocumentPosition-!e.compareDocumentPosition;return r||(1&(r=(t.ownerDocument||t)===(e.ownerDocument||e)?t.compareDocumentPosition(e):1)||!n.sortDetached&&e.compareDocumentPosition(t)===r?t===h||t.ownerDocument===q&&y(q,t)?-1:e===h||e.ownerDocument===q&&y(q,e)?1:u?Q(u,t)-Q(u,e):0:4&r?-1:1)}:function(t,e){if(t===e)return f=!0,0;var n,r=0,i=t.parentNode,o=e.parentNode,s=[t],a=[e];if(!i||!o)return t===h?-1:e===h?1:i?-1:o?1:u?Q(u,t)-Q(u,e):0;if(i===o)return pt(t,e);for(n=t;n=n.parentNode;)s.unshift(n);for(n=e;n=n.parentNode;)a.unshift(n);for(;s[r]===a[r];)r++;return r?pt(s[r],a[r]):s[r]===q?-1:a[r]===q?1:0},h):h},at.matches=function(t,e){return at(t,null,null,e)},at.matchesSelector=function(t,e){if((t.ownerDocument||t)!==h&&p(t),n.matchesSelector&&m&&!j[e+\" \"]&&(!v||!v.test(e))&&(!g||!g.test(e)))try{var r=b.call(t,e);if(r||n.disconnectedMatch||t.document&&11!==t.document.nodeType)return r}catch(t){j(e,!0)}return at(e,h,null,[t]).length>0},at.contains=function(t,e){return(t.ownerDocument||t)!==h&&p(t),y(t,e)},at.attr=function(t,e){(t.ownerDocument||t)!==h&&p(t);var i=r.attrHandle[e.toLowerCase()],o=i&&D.call(r.attrHandle,e.toLowerCase())?i(t,e,!m):void 0;return void 0!==o?o:n.attributes||!m?t.getAttribute(e):(o=t.getAttributeNode(e))&&o.specified?o.value:null},at.escape=function(t){return(t+\"\").replace(rt,it)},at.error=function(t){throw new Error(\"Syntax error, unrecognized expression: \"+t)},at.uniqueSort=function(t){var e,r=[],i=0,o=0;if(f=!n.detectDuplicates,u=!n.sortStable&&t.slice(0),t.sort(S),f){for(;e=t[o++];)e===t[o]&&(i=r.push(o));for(;i--;)t.splice(r[i],1)}return u=null,t},i=at.getText=function(t){var e,n=\"\",r=0,o=t.nodeType;if(o){if(1===o||9===o||11===o){if(\"string\"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)n+=i(t)}else if(3===o||4===o)return t.nodeValue}else for(;e=t[r++];)n+=i(e);return n},(r=at.selectors={cacheLength:50,createPseudo:ct,match:V,attrHandle:{},find:{},relative:{\">\":{dir:\"parentNode\",first:!0},\" \":{dir:\"parentNode\"},\"+\":{dir:\"previousSibling\",first:!0},\"~\":{dir:\"previousSibling\"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(et,nt),t[3]=(t[3]||t[4]||t[5]||\"\").replace(et,nt),\"~=\"===t[2]&&(t[3]=\" \"+t[3]+\" \"),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),\"nth\"===t[1].slice(0,3)?(t[3]||at.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*(\"even\"===t[3]||\"odd\"===t[3])),t[5]=+(t[7]+t[8]||\"odd\"===t[3])):t[3]&&at.error(t[0]),t},PSEUDO:function(t){var e,n=!t[6]&&t[2];return V.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||\"\":n&&X.test(n)&&(e=s(n,!0))&&(e=n.indexOf(\")\",n.length-e)-n.length)&&(t[0]=t[0].slice(0,e),t[2]=n.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(et,nt).toLowerCase();return\"*\"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=k[t+\" \"];return e||(e=new RegExp(\"(^|\"+M+\")\"+t+\"(\"+M+\"|$)\"))&&k(t,function(t){return e.test(\"string\"==typeof t.className&&t.className||void 0!==t.getAttribute&&t.getAttribute(\"class\")||\"\")})},ATTR:function(t,e,n){return function(r){var i=at.attr(r,t);return null==i?\"!=\"===e:!e||(i+=\"\",\"=\"===e?i===n:\"!=\"===e?i!==n:\"^=\"===e?n&&0===i.indexOf(n):\"*=\"===e?n&&i.indexOf(n)>-1:\"$=\"===e?n&&i.slice(-n.length)===n:\"~=\"===e?(\" \"+i.replace(F,\" \")+\" \").indexOf(n)>-1:\"|=\"===e&&(i===n||i.slice(0,n.length+1)===n+\"-\"))}},CHILD:function(t,e,n,r,i){var o=\"nth\"!==t.slice(0,3),s=\"last\"!==t.slice(-4),a=\"of-type\"===e;return 1===r&&0===i?function(t){return!!t.parentNode}:function(e,n,l){var c,u,f,p,h,d,m=o!==s?\"nextSibling\":\"previousSibling\",g=e.parentNode,v=a&&e.nodeName.toLowerCase(),b=!l&&!a,y=!1;if(g){if(o){for(;m;){for(p=e;p=p[m];)if(a?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;d=m=\"only\"===t&&!d&&\"nextSibling\"}return!0}if(d=[s?g.firstChild:g.lastChild],s&&b){for(y=(h=(c=(u=(f=(p=g)[x]||(p[x]={}))[p.uniqueID]||(f[p.uniqueID]={}))[t]||[])[0]===w&&c[1])&&c[2],p=h&&g.childNodes[h];p=++h&&p&&p[m]||(y=h=0)||d.pop();)if(1===p.nodeType&&++y&&p===e){u[t]=[w,h,y];break}}else if(b&&(y=h=(c=(u=(f=(p=e)[x]||(p[x]={}))[p.uniqueID]||(f[p.uniqueID]={}))[t]||[])[0]===w&&c[1]),!1===y)for(;(p=++h&&p&&p[m]||(y=h=0)||d.pop())&&((a?p.nodeName.toLowerCase()!==v:1!==p.nodeType)||!++y||(b&&((u=(f=p[x]||(p[x]={}))[p.uniqueID]||(f[p.uniqueID]={}))[t]=[w,y]),p!==e)););return(y-=i)===r||y%r==0&&y/r>=0}}},PSEUDO:function(t,e){var n,i=r.pseudos[t]||r.setFilters[t.toLowerCase()]||at.error(\"unsupported pseudo: \"+t);return i[x]?i(e):i.length>1?(n=[t,t,\"\",e],r.setFilters.hasOwnProperty(t.toLowerCase())?ct(function(t,n){for(var r,o=i(t,e),s=o.length;s--;)t[r=Q(t,o[s])]=!(n[r]=o[s])}):function(t){return i(t,0,n)}):i}},pseudos:{not:ct(function(t){var e=[],n=[],r=a(t.replace(H,\"$1\"));return r[x]?ct(function(t,e,n,i){for(var o,s=r(t,null,i,[]),a=t.length;a--;)(o=s[a])&&(t[a]=!(e[a]=o))}):function(t,i,o){return e[0]=t,r(e,null,o,n),e[0]=null,!n.pop()}}),has:ct(function(t){return function(e){return at(t,e).length>0}}),contains:ct(function(t){return t=t.replace(et,nt),function(e){return(e.textContent||i(e)).indexOf(t)>-1}}),lang:ct(function(t){return U.test(t||\"\")||at.error(\"unsupported lang: \"+t),t=t.replace(et,nt).toLowerCase(),function(e){var n;do{if(n=m?e.lang:e.getAttribute(\"xml:lang\")||e.getAttribute(\"lang\"))return(n=n.toLowerCase())===t||0===n.indexOf(t+\"-\")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var n=t.location&&t.location.hash;return n&&n.slice(1)===e.id},root:function(t){return t===d},focus:function(t){return t===h.activeElement&&(!h.hasFocus||h.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:mt(!1),disabled:mt(!0),checked:function(t){var e=t.nodeName.toLowerCase();return\"input\"===e&&!!t.checked||\"option\"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,!0===t.selected},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:function(t){return!r.pseudos.empty(t)},header:function(t){return K.test(t.nodeName)},input:function(t){return Y.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return\"input\"===e&&\"button\"===t.type||\"button\"===e},text:function(t){var e;return\"input\"===t.nodeName.toLowerCase()&&\"text\"===t.type&&(null==(e=t.getAttribute(\"type\"))||\"text\"===e.toLowerCase())},first:gt(function(){return[0]}),last:gt(function(t,e){return[e-1]}),eq:gt(function(t,e,n){return[n<0?n+e:n]}),even:gt(function(t,e){for(var n=0;ne?e:n;--r>=0;)t.push(r);return t}),gt:gt(function(t,e,n){for(var r=n<0?n+e:n;++r1?function(e,n,r){for(var i=t.length;i--;)if(!t[i](e,n,r))return!1;return!0}:t[0]}function wt(t,e,n,r,i){for(var o,s=[],a=0,l=t.length,c=null!=e;a-1&&(o[c]=!(s[c]=f))}}else v=wt(v===s?v.splice(d,v.length):v),i?i(null,s,v,l):_.apply(s,v)})}function kt(t){for(var e,n,i,o=t.length,s=r.relative[t[0].type],a=s||r.relative[\" \"],l=s?1:0,u=xt(function(t){return t===e},a,!0),f=xt(function(t){return Q(e,t)>-1},a,!0),p=[function(t,n,r){var i=!s&&(r||n!==c)||((e=n).nodeType?u(t,n,r):f(t,n,r));return e=null,i}];l1&&qt(p),l>1&&yt(t.slice(0,l-1).concat({value:\" \"===t[l-2].type?\"*\":\"\"})).replace(H,\"$1\"),n,l0,i=t.length>0,o=function(o,s,a,l,u){var f,d,g,v=0,b=\"0\",y=o&&[],x=[],q=c,T=o||i&&r.find.TAG(\"*\",u),k=w+=null==q?1:Math.random()||.1,C=T.length;for(u&&(c=s===h||s||u);b!==C&&null!=(f=T[b]);b++){if(i&&f){for(d=0,s||f.ownerDocument===h||(p(f),a=!m);g=t[d++];)if(g(f,s||h,a)){l.push(f);break}u&&(w=k)}n&&((f=!g&&f)&&v--,o&&y.push(f))}if(v+=b,n&&b!==v){for(d=0;g=e[d++];)g(y,x,s,a);if(o){if(v>0)for(;b--;)y[b]||x[b]||(x[b]=A.call(l));x=wt(x)}_.apply(l,x),u&&!o&&x.length>0&&v+e.length>1&&at.uniqueSort(l)}return u&&(w=k,c=q),y};return n?ct(o):o}(o,i))).selector=t}return a},l=at.select=function(t,e,n,i){var o,l,c,u,f,p=\"function\"==typeof t&&t,h=!i&&s(t=p.selector||t);if(n=n||[],1===h.length){if((l=h[0]=h[0].slice(0)).length>2&&\"ID\"===(c=l[0]).type&&9===e.nodeType&&m&&r.relative[l[1].type]){if(!(e=(r.find.ID(c.matches[0].replace(et,nt),e)||[])[0]))return n;p&&(e=e.parentNode),t=t.slice(l.shift().value.length)}for(o=V.needsContext.test(t)?0:l.length;o--&&(c=l[o],!r.relative[u=c.type]);)if((f=r.find[u])&&(i=f(c.matches[0].replace(et,nt),tt.test(l[0].type)&&vt(e.parentNode)||e))){if(l.splice(o,1),!(t=i.length&&yt(l)))return _.apply(n,i),n;break}}return(p||a(t,h))(i,e,!m,n,!e||tt.test(t)&&vt(e.parentNode)||e),n},n.sortStable=x.split(\"\").sort(S).join(\"\")===x,n.detectDuplicates=!!f,p(),n.sortDetached=ut(function(t){return 1&t.compareDocumentPosition(h.createElement(\"fieldset\"))}),ut(function(t){return t.innerHTML=\"\",\"#\"===t.firstChild.getAttribute(\"href\")})||ft(\"type|href|height|width\",function(t,e,n){if(!n)return t.getAttribute(e,\"type\"===e.toLowerCase()?1:2)}),n.attributes&&ut(function(t){return t.innerHTML=\"\",t.firstChild.setAttribute(\"value\",\"\"),\"\"===t.firstChild.getAttribute(\"value\")})||ft(\"value\",function(t,e,n){if(!n&&\"input\"===t.nodeName.toLowerCase())return t.defaultValue}),ut(function(t){return null==t.getAttribute(\"disabled\")})||ft(R,function(t,e,n){var r;if(!n)return!0===t[e]?e.toLowerCase():(r=t.getAttributeNode(e))&&r.specified?r.value:null}),at}(n);T.find=O,T.expr=O.selectors,T.expr[\":\"]=T.expr.pseudos,T.uniqueSort=T.unique=O.uniqueSort,T.text=O.getText,T.isXMLDoc=O.isXML,T.contains=O.contains,T.escapeSelector=O.escape;var j=function(t,e,n){for(var r=[],i=void 0!==n;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(i&&T(t).is(n))break;r.push(t)}return r},S=function(t,e){for(var n=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&n.push(t);return n},D=T.expr.match.needsContext;function E(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()}var A=/^<([a-z][^\\/\\0>:\\x20\\t\\r\\n\\f]*)[\\x20\\t\\r\\n\\f]*\\/?>(?:<\\/\\1>|)$/i;function L(t,e,n){return b(e)?T.grep(t,function(t,r){return!!e.call(t,r,t)!==n}):e.nodeType?T.grep(t,function(t){return t===e!==n}):\"string\"!=typeof e?T.grep(t,function(t){return f.call(e,t)>-1!==n}):T.filter(e,t,n)}T.filter=function(t,e,n){var r=e[0];return n&&(t=\":not(\"+t+\")\"),1===e.length&&1===r.nodeType?T.find.matchesSelector(r,t)?[r]:[]:T.find.matches(t,T.grep(e,function(t){return 1===t.nodeType}))},T.fn.extend({find:function(t){var e,n,r=this.length,i=this;if(\"string\"!=typeof t)return this.pushStack(T(t).filter(function(){for(e=0;e1?T.uniqueSort(n):n},filter:function(t){return this.pushStack(L(this,t||[],!1))},not:function(t){return this.pushStack(L(this,t||[],!0))},is:function(t){return!!L(this,\"string\"==typeof t&&D.test(t)?T(t):t||[],!1).length}});var _,N=/^(?:\\s*(<[\\w\\W]+>)[^>]*|#([\\w-]+))$/;(T.fn.init=function(t,e,n){var r,i;if(!t)return this;if(n=n||_,\"string\"==typeof t){if(!(r=\"<\"===t[0]&&\">\"===t[t.length-1]&&t.length>=3?[null,t,null]:N.exec(t))||!r[1]&&e)return!e||e.jquery?(e||n).find(t):this.constructor(e).find(t);if(r[1]){if(e=e instanceof T?e[0]:e,T.merge(this,T.parseHTML(r[1],e&&e.nodeType?e.ownerDocument||e:s,!0)),A.test(r[1])&&T.isPlainObject(e))for(r in e)b(this[r])?this[r](e[r]):this.attr(r,e[r]);return this}return(i=s.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return t.nodeType?(this[0]=t,this.length=1,this):b(t)?void 0!==n.ready?n.ready(t):t(T):T.makeArray(t,this)}).prototype=T.fn,_=T(s);var Q=/^(?:parents|prev(?:Until|All))/,R={children:!0,contents:!0,next:!0,prev:!0};function M(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}T.fn.extend({has:function(t){var e=T(t,this),n=e.length;return this.filter(function(){for(var t=0;t-1:1===n.nodeType&&T.find.matchesSelector(n,t))){o.push(n);break}return this.pushStack(o.length>1?T.uniqueSort(o):o)},index:function(t){return t?\"string\"==typeof t?f.call(T(t),this[0]):f.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(T.uniqueSort(T.merge(this.get(),T(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),T.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return j(t,\"parentNode\")},parentsUntil:function(t,e,n){return j(t,\"parentNode\",n)},next:function(t){return M(t,\"nextSibling\")},prev:function(t){return M(t,\"previousSibling\")},nextAll:function(t){return j(t,\"nextSibling\")},prevAll:function(t){return j(t,\"previousSibling\")},nextUntil:function(t,e,n){return j(t,\"nextSibling\",n)},prevUntil:function(t,e,n){return j(t,\"previousSibling\",n)},siblings:function(t){return S((t.parentNode||{}).firstChild,t)},children:function(t){return S(t.firstChild)},contents:function(t){return void 0!==t.contentDocument?t.contentDocument:(E(t,\"template\")&&(t=t.content||t),T.merge([],t.childNodes))}},function(t,e){T.fn[t]=function(n,r){var i=T.map(this,e,n);return\"Until\"!==t.slice(-5)&&(r=n),r&&\"string\"==typeof r&&(i=T.filter(r,i)),this.length>1&&(R[t]||T.uniqueSort(i),Q.test(t)&&i.reverse()),this.pushStack(i)}});var I=/[^\\x20\\t\\r\\n\\f]+/g;function P(t){return t}function z(t){throw t}function F(t,e,n,r){var i;try{t&&b(i=t.promise)?i.call(t).done(e).fail(n):t&&b(i=t.then)?i.call(t,e,n):e.apply(void 0,[t].slice(r))}catch(t){n.apply(void 0,[t])}}T.Callbacks=function(t){t=\"string\"==typeof t?function(t){var e={};return T.each(t.match(I)||[],function(t,n){e[n]=!0}),e}(t):T.extend({},t);var e,n,r,i,o=[],s=[],a=-1,l=function(){for(i=i||t.once,r=e=!0;s.length;a=-1)for(n=s.shift();++a-1;)o.splice(n,1),n<=a&&a--}),this},has:function(t){return t?T.inArray(t,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=s=[],o=n=\"\",this},disabled:function(){return!o},lock:function(){return i=s=[],n||e||(o=n=\"\"),this},locked:function(){return!!i},fireWith:function(t,n){return i||(n=[t,(n=n||[]).slice?n.slice():n],s.push(n),e||l()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},T.extend({Deferred:function(t){var e=[[\"notify\",\"progress\",T.Callbacks(\"memory\"),T.Callbacks(\"memory\"),2],[\"resolve\",\"done\",T.Callbacks(\"once memory\"),T.Callbacks(\"once memory\"),0,\"resolved\"],[\"reject\",\"fail\",T.Callbacks(\"once memory\"),T.Callbacks(\"once memory\"),1,\"rejected\"]],r=\"pending\",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},catch:function(t){return i.then(null,t)},pipe:function(){var t=arguments;return T.Deferred(function(n){T.each(e,function(e,r){var i=b(t[r[4]])&&t[r[4]];o[r[1]](function(){var t=i&&i.apply(this,arguments);t&&b(t.promise)?t.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[r[0]+\"With\"](this,i?[t]:arguments)})}),t=null}).promise()},then:function(t,r,i){var o=0;function s(t,e,r,i){return function(){var a=this,l=arguments,c=function(){var n,c;if(!(t=o&&(r!==z&&(a=void 0,l=[n]),e.rejectWith(a,l))}};t?u():(T.Deferred.getStackHook&&(u.stackTrace=T.Deferred.getStackHook()),n.setTimeout(u))}}return T.Deferred(function(n){e[0][3].add(s(0,n,b(i)?i:P,n.notifyWith)),e[1][3].add(s(0,n,b(t)?t:P)),e[2][3].add(s(0,n,b(r)?r:z))}).promise()},promise:function(t){return null!=t?T.extend(t,i):i}},o={};return T.each(e,function(t,n){var s=n[2],a=n[5];i[n[1]]=s.add,a&&s.add(function(){r=a},e[3-t][2].disable,e[3-t][3].disable,e[0][2].lock,e[0][3].lock),s.add(n[3].fire),o[n[0]]=function(){return o[n[0]+\"With\"](this===o?void 0:this,arguments),this},o[n[0]+\"With\"]=s.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(t){var e=arguments.length,n=e,r=Array(n),i=l.call(arguments),o=T.Deferred(),s=function(t){return function(n){r[t]=this,i[t]=arguments.length>1?l.call(arguments):n,--e||o.resolveWith(r,i)}};if(e<=1&&(F(t,o.done(s(n)).resolve,o.reject,!e),\"pending\"===o.state()||b(i[n]&&i[n].then)))return o.then();for(;n--;)F(i[n],s(n),o.reject);return o.promise()}});var H=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;T.Deferred.exceptionHook=function(t,e){n.console&&n.console.warn&&t&&H.test(t.name)&&n.console.warn(\"jQuery.Deferred exception: \"+t.message,t.stack,e)},T.readyException=function(t){n.setTimeout(function(){throw t})};var B=T.Deferred();function $(){s.removeEventListener(\"DOMContentLoaded\",$),n.removeEventListener(\"load\",$),T.ready()}T.fn.ready=function(t){return B.then(t).catch(function(t){T.readyException(t)}),this},T.extend({isReady:!1,readyWait:1,ready:function(t){(!0===t?--T.readyWait:T.isReady)||(T.isReady=!0,!0!==t&&--T.readyWait>0||B.resolveWith(s,[T]))}}),T.ready.then=B.then,\"complete\"===s.readyState||\"loading\"!==s.readyState&&!s.documentElement.doScroll?n.setTimeout(T.ready):(s.addEventListener(\"DOMContentLoaded\",$),n.addEventListener(\"load\",$));var W=function(t,e,n,r,i,o,s){var a=0,l=t.length,c=null==n;if(\"object\"===w(n))for(a in i=!0,n)W(t,e,a,n[a],!0,o,s);else if(void 0!==r&&(i=!0,b(r)||(s=!0),c&&(s?(e.call(t,r),e=null):(c=e,e=function(t,e,n){return c.call(T(t),n)})),e))for(;a1,null,!0)},removeData:function(t){return this.each(function(){J.remove(this,t)})}}),T.extend({queue:function(t,e,n){var r;if(t)return e=(e||\"fx\")+\"queue\",r=Z.get(t,e),n&&(!r||Array.isArray(n)?r=Z.access(t,e,T.makeArray(n)):r.push(n)),r||[]},dequeue:function(t,e){e=e||\"fx\";var n=T.queue(t,e),r=n.length,i=n.shift(),o=T._queueHooks(t,e);\"inprogress\"===i&&(i=n.shift(),r--),i&&(\"fx\"===e&&n.unshift(\"inprogress\"),delete o.stop,i.call(t,function(){T.dequeue(t,e)},o)),!r&&o&&o.empty.fire()},_queueHooks:function(t,e){var n=e+\"queueHooks\";return Z.get(t,n)||Z.access(t,n,{empty:T.Callbacks(\"once memory\").add(function(){Z.remove(t,[e+\"queue\",n])})})}}),T.fn.extend({queue:function(t,e){var n=2;return\"string\"!=typeof t&&(e=t,t=\"fx\",n--),arguments.length\\x20\\t\\r\\n\\f]*)/i,vt=/^$|^module$|\\/(?:java|ecma)script/i,bt={option:[1,\"\"],thead:[1,\"\",\"
\"],col:[2,\"\",\"
\"],tr:[2,\"\",\"
\"],td:[3,\"\",\"
\"],_default:[0,\"\",\"\"]};function yt(t,e){var n;return n=void 0!==t.getElementsByTagName?t.getElementsByTagName(e||\"*\"):void 0!==t.querySelectorAll?t.querySelectorAll(e||\"*\"):[],void 0===e||e&&E(t,e)?T.merge([t],n):n}function xt(t,e){for(var n=0,r=t.length;n-1)i&&i.push(o);else if(c=at(o),s=yt(f.appendChild(o),\"script\"),c&&xt(s),n)for(u=0;o=s[u++];)vt.test(o.type||\"\")&&n.push(o);return f}qt=s.createDocumentFragment().appendChild(s.createElement(\"div\")),(wt=s.createElement(\"input\")).setAttribute(\"type\",\"radio\"),wt.setAttribute(\"checked\",\"checked\"),wt.setAttribute(\"name\",\"t\"),qt.appendChild(wt),v.checkClone=qt.cloneNode(!0).cloneNode(!0).lastChild.checked,qt.innerHTML=\"\",v.noCloneChecked=!!qt.cloneNode(!0).lastChild.defaultValue;var Ct=/^key/,Ot=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,jt=/^([^.]*)(?:\\.(.+)|)/;function St(){return!0}function Dt(){return!1}function Et(t,e){return t===function(){try{return s.activeElement}catch(t){}}()==(\"focus\"===e)}function At(t,e,n,r,i,o){var s,a;if(\"object\"==typeof e){for(a in\"string\"!=typeof n&&(r=r||n,n=void 0),e)At(t,a,n,r,e[a],o);return t}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&(\"string\"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Dt;else if(!i)return t;return 1===o&&(s=i,(i=function(t){return T().off(t),s.apply(this,arguments)}).guid=s.guid||(s.guid=T.guid++)),t.each(function(){T.event.add(this,e,i,r,n)})}function Lt(t,e,n){n?(Z.set(t,e,!1),T.event.add(t,e,{namespace:!1,handler:function(t){var r,i,o=Z.get(this,e);if(1&t.isTrigger&&this[e]){if(o.length)(T.event.special[e]||{}).delegateType&&t.stopPropagation();else if(o=l.call(arguments),Z.set(this,e,o),r=n(this,e),this[e](),o!==(i=Z.get(this,e))||r?Z.set(this,e,!1):i={},o!==i)return t.stopImmediatePropagation(),t.preventDefault(),i.value}else o.length&&(Z.set(this,e,{value:T.event.trigger(T.extend(o[0],T.Event.prototype),o.slice(1),this)}),t.stopImmediatePropagation())}})):void 0===Z.get(t,e)&&T.event.add(t,e,St)}T.event={global:{},add:function(t,e,n,r,i){var o,s,a,l,c,u,f,p,h,d,m,g=Z.get(t);if(g)for(n.handler&&(n=(o=n).handler,i=o.selector),i&&T.find.matchesSelector(st,i),n.guid||(n.guid=T.guid++),(l=g.events)||(l=g.events={}),(s=g.handle)||(s=g.handle=function(e){return void 0!==T&&T.event.triggered!==e.type?T.event.dispatch.apply(t,arguments):void 0}),c=(e=(e||\"\").match(I)||[\"\"]).length;c--;)h=m=(a=jt.exec(e[c])||[])[1],d=(a[2]||\"\").split(\".\").sort(),h&&(f=T.event.special[h]||{},h=(i?f.delegateType:f.bindType)||h,f=T.event.special[h]||{},u=T.extend({type:h,origType:m,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&T.expr.match.needsContext.test(i),namespace:d.join(\".\")},o),(p=l[h])||((p=l[h]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,d,s)||t.addEventListener&&t.addEventListener(h,s)),f.add&&(f.add.call(t,u),u.handler.guid||(u.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,u):p.push(u),T.event.global[h]=!0)},remove:function(t,e,n,r,i){var o,s,a,l,c,u,f,p,h,d,m,g=Z.hasData(t)&&Z.get(t);if(g&&(l=g.events)){for(c=(e=(e||\"\").match(I)||[\"\"]).length;c--;)if(h=m=(a=jt.exec(e[c])||[])[1],d=(a[2]||\"\").split(\".\").sort(),h){for(f=T.event.special[h]||{},p=l[h=(r?f.delegateType:f.bindType)||h]||[],a=a[2]&&new RegExp(\"(^|\\\\.)\"+d.join(\"\\\\.(?:.*\\\\.|)\")+\"(\\\\.|$)\"),s=o=p.length;o--;)u=p[o],!i&&m!==u.origType||n&&n.guid!==u.guid||a&&!a.test(u.namespace)||r&&r!==u.selector&&(\"**\"!==r||!u.selector)||(p.splice(o,1),u.selector&&p.delegateCount--,f.remove&&f.remove.call(t,u));s&&!p.length&&(f.teardown&&!1!==f.teardown.call(t,d,g.handle)||T.removeEvent(t,h,g.handle),delete l[h])}else for(h in l)T.event.remove(t,h+e[c],n,r,!0);T.isEmptyObject(l)&&Z.remove(t,\"handle events\")}},dispatch:function(t){var e,n,r,i,o,s,a=T.event.fix(t),l=new Array(arguments.length),c=(Z.get(this,\"events\")||{})[a.type]||[],u=T.event.special[a.type]||{};for(l[0]=a,e=1;e=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&(\"click\"!==t.type||!0!==c.disabled)){for(o=[],s={},n=0;n-1:T.find(i,this,null,[c]).length),s[i]&&o.push(r);o.length&&a.push({elem:c,handlers:o})}return c=this,l\\x20\\t\\r\\n\\f]*)[^>]*)\\/>/gi,Nt=/\\s*$/g;function Mt(t,e){return E(t,\"table\")&&E(11!==e.nodeType?e:e.firstChild,\"tr\")&&T(t).children(\"tbody\")[0]||t}function It(t){return t.type=(null!==t.getAttribute(\"type\"))+\"/\"+t.type,t}function Pt(t){return\"true/\"===(t.type||\"\").slice(0,5)?t.type=t.type.slice(5):t.removeAttribute(\"type\"),t}function zt(t,e){var n,r,i,o,s,a,l,c;if(1===e.nodeType){if(Z.hasData(t)&&(o=Z.access(t),s=Z.set(e,o),c=o.events))for(i in delete s.handle,s.events={},c)for(n=0,r=c[i].length;n1&&\"string\"==typeof d&&!v.checkClone&&Qt.test(d))return t.each(function(i){var o=t.eq(i);m&&(e[0]=d.call(this,i,o.html())),Ht(o,e,n,r)});if(p&&(o=(i=kt(e,t[0].ownerDocument,!1,t,r)).firstChild,1===i.childNodes.length&&(i=o),o||r)){for(a=(s=T.map(yt(i,\"script\"),It)).length;f\")},clone:function(t,e,n){var r,i,o,s,a=t.cloneNode(!0),l=at(t);if(!(v.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||T.isXMLDoc(t)))for(s=yt(a),r=0,i=(o=yt(t)).length;r0&&xt(s,!l&&yt(t,\"script\")),a},cleanData:function(t){for(var e,n,r,i=T.event.special,o=0;void 0!==(n=t[o]);o++)if(Y(n)){if(e=n[Z.expando]){if(e.events)for(r in e.events)i[r]?T.event.remove(n,r):T.removeEvent(n,r,e.handle);n[Z.expando]=void 0}n[J.expando]&&(n[J.expando]=void 0)}}}),T.fn.extend({detach:function(t){return Bt(this,t,!0)},remove:function(t){return Bt(this,t)},text:function(t){return W(this,function(t){return void 0===t?T.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)})},null,t,arguments.length)},append:function(){return Ht(this,arguments,function(t){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Mt(this,t).appendChild(t)})},prepend:function(){return Ht(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=Mt(this,t);e.insertBefore(t,e.firstChild)}})},before:function(){return Ht(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this)})},after:function(){return Ht(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)})},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(T.cleanData(yt(t,!1)),t.textContent=\"\");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map(function(){return T.clone(this,t,e)})},html:function(t){return W(this,function(t){var e=this[0]||{},n=0,r=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if(\"string\"==typeof t&&!Nt.test(t)&&!bt[(gt.exec(t)||[\"\",\"\"])[1].toLowerCase()]){t=T.htmlPrefilter(t);try{for(;n=0&&(l+=Math.max(0,Math.ceil(t[\"offset\"+e[0].toUpperCase()+e.slice(1)]-o-l-a-.5))||0),l}function oe(t,e,n){var r=Wt(t),i=(!v.boxSizingReliable()||n)&&\"border-box\"===T.css(t,\"boxSizing\",!1,r),o=i,s=Ut(t,e,r),a=\"offset\"+e[0].toUpperCase()+e.slice(1);if($t.test(s)){if(!n)return s;s=\"auto\"}return(!v.boxSizingReliable()&&i||\"auto\"===s||!parseFloat(s)&&\"inline\"===T.css(t,\"display\",!1,r))&&t.getClientRects().length&&(i=\"border-box\"===T.css(t,\"boxSizing\",!1,r),(o=a in t)&&(s=t[a])),(s=parseFloat(s)||0)+ie(t,e,n||(i?\"border\":\"content\"),o,r,s)+\"px\"}function se(t,e,n,r,i){return new se.prototype.init(t,e,n,r,i)}T.extend({cssHooks:{opacity:{get:function(t,e){if(e){var n=Ut(t,\"opacity\");return\"\"===n?\"1\":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(t,e,n,r){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var i,o,s,a=G(e),l=te.test(e),c=t.style;if(l||(e=Zt(a)),s=T.cssHooks[e]||T.cssHooks[a],void 0===n)return s&&\"get\"in s&&void 0!==(i=s.get(t,!1,r))?i:c[e];\"string\"===(o=typeof n)&&(i=it.exec(n))&&i[1]&&(n=ft(t,e,i),o=\"number\"),null!=n&&n==n&&(\"number\"!==o||l||(n+=i&&i[3]||(T.cssNumber[a]?\"\":\"px\")),v.clearCloneStyle||\"\"!==n||0!==e.indexOf(\"background\")||(c[e]=\"inherit\"),s&&\"set\"in s&&void 0===(n=s.set(t,n,r))||(l?c.setProperty(e,n):c[e]=n))}},css:function(t,e,n,r){var i,o,s,a=G(e);return te.test(e)||(e=Zt(a)),(s=T.cssHooks[e]||T.cssHooks[a])&&\"get\"in s&&(i=s.get(t,!0,n)),void 0===i&&(i=Ut(t,e,r)),\"normal\"===i&&e in ne&&(i=ne[e]),\"\"===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),T.each([\"height\",\"width\"],function(t,e){T.cssHooks[e]={get:function(t,n,r){if(n)return!Jt.test(T.css(t,\"display\"))||t.getClientRects().length&&t.getBoundingClientRect().width?oe(t,e,r):ut(t,ee,function(){return oe(t,e,r)})},set:function(t,n,r){var i,o=Wt(t),s=!v.scrollboxSize()&&\"absolute\"===o.position,a=(s||r)&&\"border-box\"===T.css(t,\"boxSizing\",!1,o),l=r?ie(t,e,r,a,o):0;return a&&s&&(l-=Math.ceil(t[\"offset\"+e[0].toUpperCase()+e.slice(1)]-parseFloat(o[e])-ie(t,e,\"border\",!1,o)-.5)),l&&(i=it.exec(n))&&\"px\"!==(i[3]||\"px\")&&(t.style[e]=n,n=T.css(t,e)),re(0,n,l)}}}),T.cssHooks.marginLeft=Vt(v.reliableMarginLeft,function(t,e){if(e)return(parseFloat(Ut(t,\"marginLeft\"))||t.getBoundingClientRect().left-ut(t,{marginLeft:0},function(){return t.getBoundingClientRect().left}))+\"px\"}),T.each({margin:\"\",padding:\"\",border:\"Width\"},function(t,e){T.cssHooks[t+e]={expand:function(n){for(var r=0,i={},o=\"string\"==typeof n?n.split(\" \"):[n];r<4;r++)i[t+ot[r]+e]=o[r]||o[r-2]||o[0];return i}},\"margin\"!==t&&(T.cssHooks[t+e].set=re)}),T.fn.extend({css:function(t,e){return W(this,function(t,e,n){var r,i,o={},s=0;if(Array.isArray(e)){for(r=Wt(t),i=e.length;s1)}}),T.Tween=se,se.prototype={constructor:se,init:function(t,e,n,r,i,o){this.elem=t,this.prop=n,this.easing=i||T.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=r,this.unit=o||(T.cssNumber[n]?\"\":\"px\")},cur:function(){var t=se.propHooks[this.prop];return t&&t.get?t.get(this):se.propHooks._default.get(this)},run:function(t){var e,n=se.propHooks[this.prop];return this.options.duration?this.pos=e=T.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):se.propHooks._default.set(this),this}},se.prototype.init.prototype=se.prototype,se.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=T.css(t.elem,t.prop,\"\"))&&\"auto\"!==e?e:0},set:function(t){T.fx.step[t.prop]?T.fx.step[t.prop](t):1!==t.elem.nodeType||!T.cssHooks[t.prop]&&null==t.elem.style[Zt(t.prop)]?t.elem[t.prop]=t.now:T.style(t.elem,t.prop,t.now+t.unit)}}},se.propHooks.scrollTop=se.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},T.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:\"swing\"},T.fx=se.prototype.init,T.fx.step={};var ae,le,ce=/^(?:toggle|show|hide)$/,ue=/queueHooks$/;function fe(){le&&(!1===s.hidden&&n.requestAnimationFrame?n.requestAnimationFrame(fe):n.setTimeout(fe,T.fx.interval),T.fx.tick())}function pe(){return n.setTimeout(function(){ae=void 0}),ae=Date.now()}function he(t,e){var n,r=0,i={height:t};for(e=e?1:0;r<4;r+=2-e)i[\"margin\"+(n=ot[r])]=i[\"padding\"+n]=t;return e&&(i.opacity=i.width=t),i}function de(t,e,n){for(var r,i=(me.tweeners[e]||[]).concat(me.tweeners[\"*\"]),o=0,s=i.length;o1)},removeAttr:function(t){return this.each(function(){T.removeAttr(this,t)})}}),T.extend({attr:function(t,e,n){var r,i,o=t.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===t.getAttribute?T.prop(t,e,n):(1===o&&T.isXMLDoc(t)||(i=T.attrHooks[e.toLowerCase()]||(T.expr.match.bool.test(e)?ge:void 0)),void 0!==n?null===n?void T.removeAttr(t,e):i&&\"set\"in i&&void 0!==(r=i.set(t,n,e))?r:(t.setAttribute(e,n+\"\"),n):i&&\"get\"in i&&null!==(r=i.get(t,e))?r:null==(r=T.find.attr(t,e))?void 0:r)},attrHooks:{type:{set:function(t,e){if(!v.radioValue&&\"radio\"===e&&E(t,\"input\")){var n=t.value;return t.setAttribute(\"type\",e),n&&(t.value=n),e}}}},removeAttr:function(t,e){var n,r=0,i=e&&e.match(I);if(i&&1===t.nodeType)for(;n=i[r++];)t.removeAttribute(n)}}),ge={set:function(t,e,n){return!1===e?T.removeAttr(t,n):t.setAttribute(n,n),n}},T.each(T.expr.match.bool.source.match(/\\w+/g),function(t,e){var n=ve[e]||T.find.attr;ve[e]=function(t,e,r){var i,o,s=e.toLowerCase();return r||(o=ve[s],ve[s]=i,i=null!=n(t,e,r)?s:null,ve[s]=o),i}});var be=/^(?:input|select|textarea|button)$/i,ye=/^(?:a|area)$/i;function xe(t){return(t.match(I)||[]).join(\" \")}function qe(t){return t.getAttribute&&t.getAttribute(\"class\")||\"\"}function we(t){return Array.isArray(t)?t:\"string\"==typeof t&&t.match(I)||[]}T.fn.extend({prop:function(t,e){return W(this,T.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each(function(){delete this[T.propFix[t]||t]})}}),T.extend({prop:function(t,e,n){var r,i,o=t.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&T.isXMLDoc(t)||(e=T.propFix[e]||e,i=T.propHooks[e]),void 0!==n?i&&\"set\"in i&&void 0!==(r=i.set(t,n,e))?r:t[e]=n:i&&\"get\"in i&&null!==(r=i.get(t,e))?r:t[e]},propHooks:{tabIndex:{get:function(t){var e=T.find.attr(t,\"tabindex\");return e?parseInt(e,10):be.test(t.nodeName)||ye.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:\"htmlFor\",class:\"className\"}}),v.optSelected||(T.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),T.each([\"tabIndex\",\"readOnly\",\"maxLength\",\"cellSpacing\",\"cellPadding\",\"rowSpan\",\"colSpan\",\"useMap\",\"frameBorder\",\"contentEditable\"],function(){T.propFix[this.toLowerCase()]=this}),T.fn.extend({addClass:function(t){var e,n,r,i,o,s,a,l=0;if(b(t))return this.each(function(e){T(this).addClass(t.call(this,e,qe(this)))});if((e=we(t)).length)for(;n=this[l++];)if(i=qe(n),r=1===n.nodeType&&\" \"+xe(i)+\" \"){for(s=0;o=e[s++];)r.indexOf(\" \"+o+\" \")<0&&(r+=o+\" \");i!==(a=xe(r))&&n.setAttribute(\"class\",a)}return this},removeClass:function(t){var e,n,r,i,o,s,a,l=0;if(b(t))return this.each(function(e){T(this).removeClass(t.call(this,e,qe(this)))});if(!arguments.length)return this.attr(\"class\",\"\");if((e=we(t)).length)for(;n=this[l++];)if(i=qe(n),r=1===n.nodeType&&\" \"+xe(i)+\" \"){for(s=0;o=e[s++];)for(;r.indexOf(\" \"+o+\" \")>-1;)r=r.replace(\" \"+o+\" \",\" \");i!==(a=xe(r))&&n.setAttribute(\"class\",a)}return this},toggleClass:function(t,e){var n=typeof t,r=\"string\"===n||Array.isArray(t);return\"boolean\"==typeof e&&r?e?this.addClass(t):this.removeClass(t):b(t)?this.each(function(n){T(this).toggleClass(t.call(this,n,qe(this),e),e)}):this.each(function(){var e,i,o,s;if(r)for(i=0,o=T(this),s=we(t);e=s[i++];)o.hasClass(e)?o.removeClass(e):o.addClass(e);else void 0!==t&&\"boolean\"!==n||((e=qe(this))&&Z.set(this,\"__className__\",e),this.setAttribute&&this.setAttribute(\"class\",e||!1===t?\"\":Z.get(this,\"__className__\")||\"\"))})},hasClass:function(t){var e,n,r=0;for(e=\" \"+t+\" \";n=this[r++];)if(1===n.nodeType&&(\" \"+xe(qe(n))+\" \").indexOf(e)>-1)return!0;return!1}});var Te=/\\r/g;T.fn.extend({val:function(t){var e,n,r,i=this[0];return arguments.length?(r=b(t),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?t.call(this,n,T(this).val()):t)?i=\"\":\"number\"==typeof i?i+=\"\":Array.isArray(i)&&(i=T.map(i,function(t){return null==t?\"\":t+\"\"})),(e=T.valHooks[this.type]||T.valHooks[this.nodeName.toLowerCase()])&&\"set\"in e&&void 0!==e.set(this,i,\"value\")||(this.value=i))})):i?(e=T.valHooks[i.type]||T.valHooks[i.nodeName.toLowerCase()])&&\"get\"in e&&void 0!==(n=e.get(i,\"value\"))?n:\"string\"==typeof(n=i.value)?n.replace(Te,\"\"):null==n?\"\":n:void 0}}),T.extend({valHooks:{option:{get:function(t){var e=T.find.attr(t,\"value\");return null!=e?e:xe(T.text(t))}},select:{get:function(t){var e,n,r,i=t.options,o=t.selectedIndex,s=\"select-one\"===t.type,a=s?null:[],l=s?o+1:i.length;for(r=o<0?l:s?o:0;r-1)&&(n=!0);return n||(t.selectedIndex=-1),o}}}}),T.each([\"radio\",\"checkbox\"],function(){T.valHooks[this]={set:function(t,e){if(Array.isArray(e))return t.checked=T.inArray(T(t).val(),e)>-1}},v.checkOn||(T.valHooks[this].get=function(t){return null===t.getAttribute(\"value\")?\"on\":t.value})}),v.focusin=\"onfocusin\"in n;var ke=/^(?:focusinfocus|focusoutblur)$/,Ce=function(t){t.stopPropagation()};T.extend(T.event,{trigger:function(t,e,r,i){var o,a,l,c,u,f,p,h,m=[r||s],g=d.call(t,\"type\")?t.type:t,v=d.call(t,\"namespace\")?t.namespace.split(\".\"):[];if(a=h=l=r=r||s,3!==r.nodeType&&8!==r.nodeType&&!ke.test(g+T.event.triggered)&&(g.indexOf(\".\")>-1&&(v=g.split(\".\"),g=v.shift(),v.sort()),u=g.indexOf(\":\")<0&&\"on\"+g,(t=t[T.expando]?t:new T.Event(g,\"object\"==typeof t&&t)).isTrigger=i?2:3,t.namespace=v.join(\".\"),t.rnamespace=t.namespace?new RegExp(\"(^|\\\\.)\"+v.join(\"\\\\.(?:.*\\\\.|)\")+\"(\\\\.|$)\"):null,t.result=void 0,t.target||(t.target=r),e=null==e?[t]:T.makeArray(e,[t]),p=T.event.special[g]||{},i||!p.trigger||!1!==p.trigger.apply(r,e))){if(!i&&!p.noBubble&&!y(r)){for(c=p.delegateType||g,ke.test(c+g)||(a=a.parentNode);a;a=a.parentNode)m.push(a),l=a;l===(r.ownerDocument||s)&&m.push(l.defaultView||l.parentWindow||n)}for(o=0;(a=m[o++])&&!t.isPropagationStopped();)h=a,t.type=o>1?c:p.bindType||g,(f=(Z.get(a,\"events\")||{})[t.type]&&Z.get(a,\"handle\"))&&f.apply(a,e),(f=u&&a[u])&&f.apply&&Y(a)&&(t.result=f.apply(a,e),!1===t.result&&t.preventDefault());return t.type=g,i||t.isDefaultPrevented()||p._default&&!1!==p._default.apply(m.pop(),e)||!Y(r)||u&&b(r[g])&&!y(r)&&((l=r[u])&&(r[u]=null),T.event.triggered=g,t.isPropagationStopped()&&h.addEventListener(g,Ce),r[g](),t.isPropagationStopped()&&h.removeEventListener(g,Ce),T.event.triggered=void 0,l&&(r[u]=l)),t.result}},simulate:function(t,e,n){var r=T.extend(new T.Event,n,{type:t,isSimulated:!0});T.event.trigger(r,null,e)}}),T.fn.extend({trigger:function(t,e){return this.each(function(){T.event.trigger(t,e,this)})},triggerHandler:function(t,e){var n=this[0];if(n)return T.event.trigger(t,e,n,!0)}}),v.focusin||T.each({focus:\"focusin\",blur:\"focusout\"},function(t,e){var n=function(t){T.event.simulate(e,t.target,T.event.fix(t))};T.event.special[e]={setup:function(){var r=this.ownerDocument||this,i=Z.access(r,e);i||r.addEventListener(t,n,!0),Z.access(r,e,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=Z.access(r,e)-1;i?Z.access(r,e,i):(r.removeEventListener(t,n,!0),Z.remove(r,e))}}});var Oe=n.location,je=Date.now(),Se=/\\?/;T.parseXML=function(t){var e;if(!t||\"string\"!=typeof t)return null;try{e=(new n.DOMParser).parseFromString(t,\"text/xml\")}catch(t){e=void 0}return e&&!e.getElementsByTagName(\"parsererror\").length||T.error(\"Invalid XML: \"+t),e};var De=/\\[\\]$/,Ee=/\\r?\\n/g,Ae=/^(?:submit|button|image|reset|file)$/i,Le=/^(?:input|select|textarea|keygen)/i;function _e(t,e,n,r){var i;if(Array.isArray(e))T.each(e,function(e,i){n||De.test(t)?r(t,i):_e(t+\"[\"+(\"object\"==typeof i&&null!=i?e:\"\")+\"]\",i,n,r)});else if(n||\"object\"!==w(e))r(t,e);else for(i in e)_e(t+\"[\"+i+\"]\",e[i],n,r)}T.param=function(t,e){var n,r=[],i=function(t,e){var n=b(e)?e():e;r[r.length]=encodeURIComponent(t)+\"=\"+encodeURIComponent(null==n?\"\":n)};if(null==t)return\"\";if(Array.isArray(t)||t.jquery&&!T.isPlainObject(t))T.each(t,function(){i(this.name,this.value)});else for(n in t)_e(n,t[n],e,i);return r.join(\"&\")},T.fn.extend({serialize:function(){return T.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=T.prop(this,\"elements\");return t?T.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!T(this).is(\":disabled\")&&Le.test(this.nodeName)&&!Ae.test(t)&&(this.checked||!mt.test(t))}).map(function(t,e){var n=T(this).val();return null==n?null:Array.isArray(n)?T.map(n,function(t){return{name:e.name,value:t.replace(Ee,\"\\r\\n\")}}):{name:e.name,value:n.replace(Ee,\"\\r\\n\")}}).get()}});var Ne=/%20/g,Qe=/#.*$/,Re=/([?&])_=[^&]*/,Me=/^(.*?):[ \\t]*([^\\r\\n]*)$/gm,Ie=/^(?:GET|HEAD)$/,Pe=/^\\/\\//,ze={},Fe={},He=\"*/\".concat(\"*\"),Be=s.createElement(\"a\");function $e(t){return function(e,n){\"string\"!=typeof e&&(n=e,e=\"*\");var r,i=0,o=e.toLowerCase().match(I)||[];if(b(n))for(;r=o[i++];)\"+\"===r[0]?(r=r.slice(1)||\"*\",(t[r]=t[r]||[]).unshift(n)):(t[r]=t[r]||[]).push(n)}}function We(t,e,n,r){var i={},o=t===Fe;function s(a){var l;return i[a]=!0,T.each(t[a]||[],function(t,a){var c=a(e,n,r);return\"string\"!=typeof c||o||i[c]?o?!(l=c):void 0:(e.dataTypes.unshift(c),s(c),!1)}),l}return s(e.dataTypes[0])||!i[\"*\"]&&s(\"*\")}function Xe(t,e){var n,r,i=T.ajaxSettings.flatOptions||{};for(n in e)void 0!==e[n]&&((i[n]?t:r||(r={}))[n]=e[n]);return r&&T.extend(!0,t,r),t}Be.href=Oe.href,T.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Oe.href,type:\"GET\",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Oe.protocol),global:!0,processData:!0,async:!0,contentType:\"application/x-www-form-urlencoded; charset=UTF-8\",accepts:{\"*\":He,text:\"text/plain\",html:\"text/html\",xml:\"application/xml, text/xml\",json:\"application/json, text/javascript\"},contents:{xml:/\\bxml\\b/,html:/\\bhtml/,json:/\\bjson\\b/},responseFields:{xml:\"responseXML\",text:\"responseText\",json:\"responseJSON\"},converters:{\"* text\":String,\"text html\":!0,\"text json\":JSON.parse,\"text xml\":T.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?Xe(Xe(t,T.ajaxSettings),e):Xe(T.ajaxSettings,t)},ajaxPrefilter:$e(ze),ajaxTransport:$e(Fe),ajax:function(t,e){\"object\"==typeof t&&(e=t,t=void 0),e=e||{};var r,i,o,a,l,c,u,f,p,h,d=T.ajaxSetup({},e),m=d.context||d,g=d.context&&(m.nodeType||m.jquery)?T(m):T.event,v=T.Deferred(),b=T.Callbacks(\"once memory\"),y=d.statusCode||{},x={},q={},w=\"canceled\",k={readyState:0,getResponseHeader:function(t){var e;if(u){if(!a)for(a={};e=Me.exec(o);)a[e[1].toLowerCase()+\" \"]=(a[e[1].toLowerCase()+\" \"]||[]).concat(e[2]);e=a[t.toLowerCase()+\" \"]}return null==e?null:e.join(\", \")},getAllResponseHeaders:function(){return u?o:null},setRequestHeader:function(t,e){return null==u&&(t=q[t.toLowerCase()]=q[t.toLowerCase()]||t,x[t]=e),this},overrideMimeType:function(t){return null==u&&(d.mimeType=t),this},statusCode:function(t){var e;if(t)if(u)k.always(t[k.status]);else for(e in t)y[e]=[y[e],t[e]];return this},abort:function(t){var e=t||w;return r&&r.abort(e),C(0,e),this}};if(v.promise(k),d.url=((t||d.url||Oe.href)+\"\").replace(Pe,Oe.protocol+\"//\"),d.type=e.method||e.type||d.method||d.type,d.dataTypes=(d.dataType||\"*\").toLowerCase().match(I)||[\"\"],null==d.crossDomain){c=s.createElement(\"a\");try{c.href=d.url,c.href=c.href,d.crossDomain=Be.protocol+\"//\"+Be.host!=c.protocol+\"//\"+c.host}catch(t){d.crossDomain=!0}}if(d.data&&d.processData&&\"string\"!=typeof d.data&&(d.data=T.param(d.data,d.traditional)),We(ze,d,e,k),u)return k;for(p in(f=T.event&&d.global)&&0==T.active++&&T.event.trigger(\"ajaxStart\"),d.type=d.type.toUpperCase(),d.hasContent=!Ie.test(d.type),i=d.url.replace(Qe,\"\"),d.hasContent?d.data&&d.processData&&0===(d.contentType||\"\").indexOf(\"application/x-www-form-urlencoded\")&&(d.data=d.data.replace(Ne,\"+\")):(h=d.url.slice(i.length),d.data&&(d.processData||\"string\"==typeof d.data)&&(i+=(Se.test(i)?\"&\":\"?\")+d.data,delete d.data),!1===d.cache&&(i=i.replace(Re,\"$1\"),h=(Se.test(i)?\"&\":\"?\")+\"_=\"+je+++h),d.url=i+h),d.ifModified&&(T.lastModified[i]&&k.setRequestHeader(\"If-Modified-Since\",T.lastModified[i]),T.etag[i]&&k.setRequestHeader(\"If-None-Match\",T.etag[i])),(d.data&&d.hasContent&&!1!==d.contentType||e.contentType)&&k.setRequestHeader(\"Content-Type\",d.contentType),k.setRequestHeader(\"Accept\",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(\"*\"!==d.dataTypes[0]?\", \"+He+\"; q=0.01\":\"\"):d.accepts[\"*\"]),d.headers)k.setRequestHeader(p,d.headers[p]);if(d.beforeSend&&(!1===d.beforeSend.call(m,k,d)||u))return k.abort();if(w=\"abort\",b.add(d.complete),k.done(d.success),k.fail(d.error),r=We(Fe,d,e,k)){if(k.readyState=1,f&&g.trigger(\"ajaxSend\",[k,d]),u)return k;d.async&&d.timeout>0&&(l=n.setTimeout(function(){k.abort(\"timeout\")},d.timeout));try{u=!1,r.send(x,C)}catch(t){if(u)throw t;C(-1,t)}}else C(-1,\"No Transport\");function C(t,e,s,a){var c,p,h,x,q,w=e;u||(u=!0,l&&n.clearTimeout(l),r=void 0,o=a||\"\",k.readyState=t>0?4:0,c=t>=200&&t<300||304===t,s&&(x=function(t,e,n){for(var r,i,o,s,a=t.contents,l=t.dataTypes;\"*\"===l[0];)l.shift(),void 0===r&&(r=t.mimeType||e.getResponseHeader(\"Content-Type\"));if(r)for(i in a)if(a[i]&&a[i].test(r)){l.unshift(i);break}if(l[0]in n)o=l[0];else{for(i in n){if(!l[0]||t.converters[i+\" \"+l[0]]){o=i;break}s||(s=i)}o=o||s}if(o)return o!==l[0]&&l.unshift(o),n[o]}(d,k,s)),x=function(t,e,n,r){var i,o,s,a,l,c={},u=t.dataTypes.slice();if(u[1])for(s in t.converters)c[s.toLowerCase()]=t.converters[s];for(o=u.shift();o;)if(t.responseFields[o]&&(n[t.responseFields[o]]=e),!l&&r&&t.dataFilter&&(e=t.dataFilter(e,t.dataType)),l=o,o=u.shift())if(\"*\"===o)o=l;else if(\"*\"!==l&&l!==o){if(!(s=c[l+\" \"+o]||c[\"* \"+o]))for(i in c)if((a=i.split(\" \"))[1]===o&&(s=c[l+\" \"+a[0]]||c[\"* \"+a[0]])){!0===s?s=c[i]:!0!==c[i]&&(o=a[0],u.unshift(a[1]));break}if(!0!==s)if(s&&t.throws)e=s(e);else try{e=s(e)}catch(t){return{state:\"parsererror\",error:s?t:\"No conversion from \"+l+\" to \"+o}}}return{state:\"success\",data:e}}(d,x,k,c),c?(d.ifModified&&((q=k.getResponseHeader(\"Last-Modified\"))&&(T.lastModified[i]=q),(q=k.getResponseHeader(\"etag\"))&&(T.etag[i]=q)),204===t||\"HEAD\"===d.type?w=\"nocontent\":304===t?w=\"notmodified\":(w=x.state,p=x.data,c=!(h=x.error))):(h=w,!t&&w||(w=\"error\",t<0&&(t=0))),k.status=t,k.statusText=(e||w)+\"\",c?v.resolveWith(m,[p,w,k]):v.rejectWith(m,[k,w,h]),k.statusCode(y),y=void 0,f&&g.trigger(c?\"ajaxSuccess\":\"ajaxError\",[k,d,c?p:h]),b.fireWith(m,[k,w]),f&&(g.trigger(\"ajaxComplete\",[k,d]),--T.active||T.event.trigger(\"ajaxStop\")))}return k},getJSON:function(t,e,n){return T.get(t,e,n,\"json\")},getScript:function(t,e){return T.get(t,void 0,e,\"script\")}}),T.each([\"get\",\"post\"],function(t,e){T[e]=function(t,n,r,i){return b(n)&&(i=i||r,r=n,n=void 0),T.ajax(T.extend({url:t,type:e,dataType:i,data:n,success:r},T.isPlainObject(t)&&t))}}),T._evalUrl=function(t,e){return T.ajax({url:t,type:\"GET\",dataType:\"script\",cache:!0,async:!1,global:!1,converters:{\"text script\":function(){}},dataFilter:function(t){T.globalEval(t,e)}})},T.fn.extend({wrapAll:function(t){var e;return this[0]&&(b(t)&&(t=t.call(this[0])),e=T(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t}).append(this)),this},wrapInner:function(t){return b(t)?this.each(function(e){T(this).wrapInner(t.call(this,e))}):this.each(function(){var e=T(this),n=e.contents();n.length?n.wrapAll(t):e.append(t)})},wrap:function(t){var e=b(t);return this.each(function(n){T(this).wrapAll(e?t.call(this,n):t)})},unwrap:function(t){return this.parent(t).not(\"body\").each(function(){T(this).replaceWith(this.childNodes)}),this}}),T.expr.pseudos.hidden=function(t){return!T.expr.pseudos.visible(t)},T.expr.pseudos.visible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},T.ajaxSettings.xhr=function(){try{return new n.XMLHttpRequest}catch(t){}};var Ue={0:200,1223:204},Ve=T.ajaxSettings.xhr();v.cors=!!Ve&&\"withCredentials\"in Ve,v.ajax=Ve=!!Ve,T.ajaxTransport(function(t){var e,r;if(v.cors||Ve&&!t.crossDomain)return{send:function(i,o){var s,a=t.xhr();if(a.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(s in t.xhrFields)a[s]=t.xhrFields[s];for(s in t.mimeType&&a.overrideMimeType&&a.overrideMimeType(t.mimeType),t.crossDomain||i[\"X-Requested-With\"]||(i[\"X-Requested-With\"]=\"XMLHttpRequest\"),i)a.setRequestHeader(s,i[s]);e=function(t){return function(){e&&(e=r=a.onload=a.onerror=a.onabort=a.ontimeout=a.onreadystatechange=null,\"abort\"===t?a.abort():\"error\"===t?\"number\"!=typeof a.status?o(0,\"error\"):o(a.status,a.statusText):o(Ue[a.status]||a.status,a.statusText,\"text\"!==(a.responseType||\"text\")||\"string\"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=e(),r=a.onerror=a.ontimeout=e(\"error\"),void 0!==a.onabort?a.onabort=r:a.onreadystatechange=function(){4===a.readyState&&n.setTimeout(function(){e&&r()})},e=e(\"abort\");try{a.send(t.hasContent&&t.data||null)}catch(t){if(e)throw t}},abort:function(){e&&e()}}}),T.ajaxPrefilter(function(t){t.crossDomain&&(t.contents.script=!1)}),T.ajaxSetup({accepts:{script:\"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript\"},contents:{script:/\\b(?:java|ecma)script\\b/},converters:{\"text script\":function(t){return T.globalEval(t),t}}}),T.ajaxPrefilter(\"script\",function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type=\"GET\")}),T.ajaxTransport(\"script\",function(t){var e,n;if(t.crossDomain||t.scriptAttrs)return{send:function(r,i){e=T(\" - - - - - - - - - - - -
-

Welcome

-

Firebase Hosting Setup Complete

-

You're seeing this because you've successfully setup Firebase Hosting. Now it's time to go build something extraordinary!

- Open Hosting Documentation -
-

Firebase SDK Loading…

- - - - diff --git a/src/Application/Error.jsx b/src/Application/Error.jsx index 756ddc362..71cf5a1a2 100644 --- a/src/Application/Error.jsx +++ b/src/Application/Error.jsx @@ -3,7 +3,10 @@ import styled, { keyframes } from "styled-components" import Flex from "~/components/Flex" -import LessonContext from "~/Contexts/Lesson" +import LessonContext from "~/Contexts/Lesson.context" + +import RemoveIcon from "~/assets/remove.svg" +import BaseButton from "~/components/Button/BaseButton" const slideIn = keyframes` from { @@ -27,30 +30,27 @@ const ErrorWrapper = styled.div` animation: ${slideIn} 500ms ease-in-out 1; width: ${props => { - if (props.width) return props.width - if (props.full) return "100%" - return "auto" - }}; + if (props.width) return props.width + if (props.full) return "100%" + return "auto" + }}; max-width: 250px; + + z-index: 13713; ` const Error = () => { - const { store, dispatch } = useContext(LessonContext) - if (!store.error.length) return null - return ( - dispatch({ type: "ERROR", payload: "" })}> - - {store.error} - - - - ) + const { store, dispatch } = useContext(LessonContext) + if (!store.notifications.error.length) return null + return ( + dispatch({ type: "ERROR", payload: "" })}> + + {store.notifications.error} + + + + ) } export default Error diff --git a/src/Application/GlobalStyle.jsx b/src/Application/GlobalStyle.jsx index e8a45dfaa..0103bec63 100644 --- a/src/Application/GlobalStyle.jsx +++ b/src/Application/GlobalStyle.jsx @@ -2,8 +2,9 @@ import { createGlobalStyle } from "styled-components" import React from "react" import theme from "~/theme" + +// import of katex was removed because of problem in styled-componenten to load import const GS = createGlobalStyle` - @import url('https://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700|PT+Sans:400,400i,700|Kalam|Faster+One'); * { box-sizing: border-box; } @@ -17,7 +18,7 @@ const GS = createGlobalStyle` min-height: 100vh; padding: 0; } - + body { padding-top: 75px; } @@ -33,9 +34,9 @@ const GS = createGlobalStyle` ` const GlobalStyle = () => { - // TODO make distinction for schul-cloud? - // TODO include theme? - return + // TODO make distinction for schul-cloud? + // TODO include theme? + return } export default GlobalStyle diff --git a/src/Application/index.jsx b/src/Application/index.jsx index 307fc1d8d..bc2aed74f 100644 --- a/src/Application/index.jsx +++ b/src/Application/index.jsx @@ -6,14 +6,17 @@ import GlobalStyle from "./GlobalStyle" import config from "~/config" import Contexts from "~/Contexts" import Error from "./Error" +import ErrorBoundary from "~/components/ErrorBoundary" const Application = () => { return ( - - - - - + + + + + + + ) } diff --git a/src/Contexts/Lesson.context.jsx b/src/Contexts/Lesson.context.jsx new file mode 100644 index 000000000..006009722 --- /dev/null +++ b/src/Contexts/Lesson.context.jsx @@ -0,0 +1,42 @@ +import React, { useReducer } from "react" +import logger from 'redux-logger' +import { prepareCreateDispatch, thunkMiddleware, sentryMiddleware } from "~/utils/dispatch" + +import { combineReducers } from "redux" +import { sectionReducer , sectionInitialState } from "./section.reducer" +import { viewReducer , viewInitialState } from "./view.reducer" +import { notificationReducer , notificationInitialState } from "./notifications.reducer" +import { courseReducer , courseInitialState } from "./course.reducer" +import { lessonReducer , lessonInitialState } from './lesson.reducer' + +const combinedReducer = combineReducers({ + lesson: lessonReducer, + sections: sectionReducer, + view: viewReducer, + notifications: notificationReducer, + course: courseReducer +}) + +const combinedInitalState = { + lesson: lessonInitialState, + sections: sectionInitialState, + view: viewInitialState, + notifications: notificationInitialState, + course: courseInitialState +} + +const LessonContext = React.createContext() +const lessonDisptachCreator = prepareCreateDispatch(logger, thunkMiddleware) +export function LessonContextProvider({ children}) { + + const [state, dispatch] = useReducer(combinedReducer, combinedInitalState) + // needed for initial of all default states, should not match any case + const value = { store: state, dispatch: lessonDisptachCreator(dispatch, state)} + return ( + + {children} + + ) +} + +export default LessonContext diff --git a/src/Contexts/Lesson.jsx b/src/Contexts/Lesson.jsx deleted file mode 100644 index cd4c5e99e..000000000 --- a/src/Contexts/Lesson.jsx +++ /dev/null @@ -1,325 +0,0 @@ -import React, { useReducer } from "react" -import qs from "qs" - -const q = qs.parse(window.location.search, { ignoreQueryPrefix: true }) - -export const initialState = { - loading: true, - error: "", - lesson: {}, - course: {}, - studentView: !!q.student_view, - editing: q.student_view ? false : true, - activeSectionId: "", - bootstrapFinished: false, - saveStatus: "", - sectionOverviewExpanded: false, - showSectionSettings: false, -} -function reducer(state, { type, payload }) { - switch (type) { - case "SET_EDITING": - if (state.studentView) return state - return { - ...state, - editing: payload, - } - - case "SET_COURSE": - return { - ...state, - course: payload, - } - - case "TOGGLE_SECTION_OVERVIEW": - return { - ...state, - sectionOverviewExpanded: - payload !== undefined - ? payload - : !state.sectionOverviewExpanded, - } - - case "TOGGLE_SECTION_SETTINGS": - return { - ...state, - showSectionSettings: - payload !== undefined - ? payload - : !state.showSectionSettings, - } - - case "BOOTSTRAP": - const newState = { - ...state, - loading: false, - error: "", - lesson: { - ...payload, - changed: new Set(), - sections: payload.sections.map(section => { - const sectionData = { ...section, changed: new Set() } - if (section.new) { - sectionData.new = undefined - sectionData.changed.add("") - } - - return sectionData - }), - }, - activeSectionId: payload.sections[0].id, - } - - return newState - - case "BOOTSTRAP_FINISH": - return { - ...state, - bootstrapFinished: true, - saveStatus: "", - } - - case "SET_ACTIVE_SECTION": - return { - ...state, - activeSectionId: payload.id, - saveStatus: "", - } - - case "SAVE_STATUS": - return { - ...state, - saveStatus: payload, - } - - case "LESSON_TITLE_CHANGE": - state.lesson.changed.add("title") - return { - ...state, - lesson: { - ...state.lesson, - title: payload, - }, - } - - case "LESSON_SAVED": - state.lesson.changed.clear() - return state - - case "SWAP_SECTIONS": - state.lesson.changed.add("order") - return { - ...state, - lesson: { - ...state.lesson, - sections: state.lesson.sections.map( - (section, index, sections) => { - if (index === payload[0]) - return sections[payload[1]] - if (index === payload[1]) - return sections[payload[0]] - return section - }, - ), - }, - } - - case "ADD_SECTION": - const newSection = { - title: "", - id: payload.tempId, - visible: true, - docValue: {}, - changed: new Set(), - } - const newSections = [] - if (payload.position === -1) newSections.push(newSection) - - state.lesson.sections.forEach((section, index) => { - newSections.push(section) - if (index === payload.position) newSections.push(newSection) - }) - - return { - ...state, - activeSectionId: payload.tempId, - lesson: { - ...state.lesson, - sections: newSections, - }, - } - - case "REPLACE_ADDED_SECTION_ID": { - return { - ...state, - activeSectionId: - state.activeSectionId === payload.tempId - ? payload.backendId - : state.activeSectionId, - lesson: { - ...state.lesson, - sections: state.lesson.sections.map(section => { - if (section.id === payload.tempId) { - return { ...section, id: payload.backendId } - } - return section - }), - }, - } - } - - case "SECTION_VISIBILITY": - return { - ...state, - lesson: { - ...state.lesson, - sections: state.lesson.sections.map(section => { - if (section.id === payload) { - section.changed.add("visible") - return { ...section, visible: !section.visible } - } - return section - }), - }, - } - - case "PREPARE_DELETE_SECTION": - let activeSectionId = state.activeSectionId - if (activeSectionId === payload) { - const deleteIndex = state.lesson.sections.findIndex( - el => el.id === payload, - ) - const newIndex = - deleteIndex === 0 ? deleteIndex + 1 : deleteIndex - 1 - activeSectionId = state.lesson.sections[newIndex].id - } - - return { - ...state, - activeSectionId, - lesson: { - ...state.lesson, - sections: state.lesson.sections.map(section => { - if (section.id === payload) - return { ...section, delete: true } - return section - }), - }, - } - - case "DELETE_SECTION": - return { - ...state, - lesson: { - ...state.lesson, - sections: state.lesson.sections.filter( - section => section.id !== payload, - ), - }, - } - - case "SECTION_TITLE_CHANGE": - return { - ...state, - lesson: { - ...state.lesson, - sections: state.lesson.sections.map(section => { - if (section.id !== payload.sectionId) return section - - section.changed.add("title") - return { ...section, title: payload.title } - }), - }, - } - - case "SECTION_DOCVALUE_CHANGE": - if (!state.editing) return state - return { - ...state, - lesson: { - ...state.lesson, - sections: state.lesson.sections.map(section => { - if (section.id !== payload.sectionId) return section - section.changed.add("docValue") - return { - ...section, - docValue: payload.docValue, - } - }), - }, - } - - case "SECTION_SAVE_DOCVALUE": - return { - ...state, - lesson: { - ...state.lesson, - sections: state.lesson.sections.map(section => { - if (section.id !== payload) return section - return { - ...section, - savedDocValue: section.docValue, - } - }), - }, - } - - case "SECTION_SAVE_DOCVALUE_FAILED": - return { - ...state, - lesson: { - ...state.lesson, - sections: state.lesson.sections.map(section => { - if (section.id !== payload.id) return section - return { - ...section, - savedDocValue: payload.lastSavedDocValue, - } - }), - }, - } - - case "SECTION_SAVED": - state.lesson.sections.forEach(section => { - if (section.id === payload) section.changed.clear() - }) - return state - - case "ERROR": - return { - ...state, - error: - payload === undefined - ? "Ein Fehler ist aufgetreten..." - : payload, - } - - case "LOADING": - return { - ...state, - loading: !!payload, - } - - case "RESET": - return initialState - - default: - return state - } -} - -const LessonContext = React.createContext() - -export function LessonContextProvider({ children }) { - const [state, dispatch] = useReducer(reducer, initialState) - - const value = { store: state, dispatch } - - return ( - - {children} - - ) -} - -export default LessonContext diff --git a/src/Contexts/course.actions.jsx b/src/Contexts/course.actions.jsx new file mode 100644 index 000000000..136dc0543 --- /dev/null +++ b/src/Contexts/course.actions.jsx @@ -0,0 +1,19 @@ +import { serverApi } from "~/utils/api" + +import { newError } from './notifications.actions' +export const SET_COURSE = 'SET_COURSE' + + +/** + * Fetch course from Schul-Cloud server and dispatch it to store + * + * @param {string} courseId - ID of course, have to be the course the lesson belong to + */ +export const fetchCourse = (courseId) => async ({dispatch}) => { + try { + const course = await serverApi.get(`/courses/${courseId}`) + dispatch({ type: SET_COURSE, payload: course }) + } catch (err) { + dispatch(newError('Daten zum Kurs konnten nicht geladen werden.')) + } +} \ No newline at end of file diff --git a/src/Contexts/course.reducer.jsx b/src/Contexts/course.reducer.jsx new file mode 100644 index 000000000..4576ab2cd --- /dev/null +++ b/src/Contexts/course.reducer.jsx @@ -0,0 +1,20 @@ +import { SET_COURSE } from "./course.actions" + +export const courseInitialState = {} +/** + * Contains all data to a course, should be nearly the same data as in the database + * + * @param {*} state - state of lesson + * @param {Object} param1 - object with the parameters type and payload + */ +export function courseReducer(state = courseInitialState, { type, payload }) { + switch (type) { + case SET_COURSE: + return { + ...state, + ...payload, + } + default: + return state + } +} \ No newline at end of file diff --git a/src/Contexts/index.jsx b/src/Contexts/index.jsx index f3a0f9f41..fda29d12f 100644 --- a/src/Contexts/index.jsx +++ b/src/Contexts/index.jsx @@ -5,9 +5,10 @@ import TouchBackend from "react-dnd-touch-backend" import { isTouchDevice } from "~/utils/device" -import { LessonContextProvider } from "./Lesson" +import { LessonContextProvider } from "./Lesson.context" import { UserContextProvider } from "./User" + const Contexts = ({ children }) => { return ( ({ + type: SET_LESSON, + payload: lesson +}) + +/** + * Triggers a Lesson update, should only use, if changes already save by server + * Will merged with existing data + * + * @param {Object} lesson - a lesson object, with updated data + */ +export const lessonWasUpdated = (lesson) => ({ + type: LESSON_UPDATED, + payload: lesson +}) + +/** + * Sets title to lesson state and markes it as changed for later save + * + * @param {string} title - new lesson title + */ +export const changeLessonTitle = (title) => ({ + type: CHANGE_LESSON_TITLE, + payload: title +}) + +/** + * Saves all changed (in changed marked) parameters to the server + */ +export const saveLesson = () => async ({state, dispatch}) => { + // keep care of adding or removing something, ...lesson is to generate hash and it should include + // everything witch is part of lesson, compared to database + const {lesson: {changed, hash, timestamp, ...lesson}, course} = state + + if (changed.size === 0) return + + const changes = {} + + dispatch({ + type: SAVING_LESSON + }) + + try{ + + changed.forEach(key => { + if(Object.prototype.hasOwnProperty.call(lesson, key)){ + changes[key] = lesson[key] + } + }) + + const newHash = generateHash(lesson) + + const message = await editorWS.emit( + 'patch', + `course/${course._id}/lessons`, + lesson._id, + changes + ) + + const payload = { + hash: newHash, + // timestamp: message.updatedAt || message.insertedAt + } + + dispatch({ + type: LESSON_SAVED, + payload + }) + saveLessonCache({ + ...lesson, + ...payload, + savedToBackend: true + }) + + } catch (err) { + dispatch({ + type: SAVING_LESSON_FAILED + }) + + saveLessonCache({ + ...state.lesson, + savedToBackend: false + }) + } + +} + +/** + * Fetch lesson data from server and overwrite current lesson + * + * @param {string} lessonId - ID of lesson + * @param {string} courseId - ID of course, lesson belong to + * @param {Object} params - query params for request + */ +export const fetchLesson = (lessonId, courseId, params) => async ({dispatch}) => { + try{ + const lesson = await editorWS.emit( + 'get', + `course/${courseId}/lessons`, + lessonId, + params + ) + dispatch({ + type: SET_LESSON, + lesson + }) + + return lesson + }catch(error){ + dispatch(newError()) + } + +} + +/** + * Fetch lesson and section data from server and overwrite current lesson and sections. + * The funktion is used to bootstrap the edtior or load a other lesson with all needed data + * + * @param {string} lessonId - ID of lesson + * @param {string} courseId - ID of course, lesson belong to + * @param {boolean} bootstrap - dispatch bootstrap finished if true + */ +export const fetchLessonWithSections = (lessonId, courseId, bootstrap = false) => async ({dispatch, state}) => { + + dispatch(startLoading()) + + try { + let {sections, ...lesson} = await editorWS.emit( + 'get', + `course/${courseId}/lessons`, + lessonId, + {all: 'true'} + ) + + lesson.sections = [] + + // lesson.id = lesson._id // needed for old version, please use _id instead + dispatch({ + type: SET_LESSON, + payload: lesson + }) + if(sections.length === 0){ + dispatch(createSection(0)) + } else { + sections = sections.map(section => { + lesson.sections.push(section._id) + return mapSection(section) + }) + dispatch(setSections(sections)) + dispatch({ + type: UPDATE_LESSON, + payload: { + sections: lesson.sections + } + }) + } + + } catch (err) { + dispatch(newError("Es konnten keine Daten vom Server oder aus dem Speicher geladen werden")) + dispatch({ + type: SET_LESSON, + payload: { + _id: new Date().getTime(), + } + }) + + dispatch(setSections([{ + _id: new Date().getTime() + + "" + + Math.floor(Math.random() * 100), + docValue: null, + visible: true, + }])) + } + + dispatch(finishLoading()) + if(bootstrap === true) dispatch({ type: BOOTSTRAP_FINISHED }) + +} \ No newline at end of file diff --git a/src/Contexts/lesson.reducer.jsx b/src/Contexts/lesson.reducer.jsx new file mode 100644 index 000000000..7b32650d5 --- /dev/null +++ b/src/Contexts/lesson.reducer.jsx @@ -0,0 +1,82 @@ +import { SET_LESSON, UPDATE_LESSON, LESSON_UPDATED , CHANGE_LESSON_TITLE , LESSON_SAVED, SWAP_SECTIONS } from "./lesson.actions" +import { ADD_SECTION , REPLACE_ADDED_SECTION_ID } from "./section.actions" +import { invertSplice } from "~/utils/reducer" + +export const lessonInitialState = { + title: '' +} + +/** + * Manage the lesson state, should contain nearly the same data as the backend + * + * @param {*} state - state of lesson + * @param {Object} param1 - object with the parameters type and payload + */ +export function lessonReducer(state = lessonInitialState, { type, payload }) { + switch (type) { + case SET_LESSON: + return { + ...payload, + changed: new Set() + } + case UPDATE_LESSON: + case LESSON_UPDATED: + return { + ...state, + ...payload + } + case CHANGE_LESSON_TITLE: + state.changed.add("title") + return { + ...state, + title: payload + } + + case LESSON_SAVED: + state.changed.clear() + return { + ...state, + ...payload + } + + case SWAP_SECTIONS: + state.changed.add('sections') + return { + ...state, + sections: state.sections.map((sectionId, index, sections) => { + switch(index){ + case payload[0]: + return sections[payload[1]] + case payload[1]: + return sections[payload[0]] + default: + return sectionId + } + }) + } + + case ADD_SECTION: // TODO: should be saved to local storage but not to the backend + return { + ...state, + sections: invertSplice(state.sections, payload.position, 0, payload.tempId) + } + + case REPLACE_ADDED_SECTION_ID: + state.changed.add('sections') // TODO: is this needed or is it already done on server side + return { + ...state, + sections: invertSplice( + state.sections, + state.sections.indexOf(payload.tempId), + 1, + payload.backendId + ) + } + + case "RESET": + return lessonInitialState + + default: + return state + } +} \ No newline at end of file diff --git a/src/Contexts/notifications.actions.jsx b/src/Contexts/notifications.actions.jsx new file mode 100644 index 000000000..982bdd7a8 --- /dev/null +++ b/src/Contexts/notifications.actions.jsx @@ -0,0 +1,21 @@ +export const ERROR = 'ERROR' +export const SAVE_STATUS = 'SAVE_STATUS' + + +/** + * adds a message to the nofification pannel for noticing the user + * + * @param {string} message - message that should show to the user + */ +export const newError = (message) => ({ + type: ERROR, + message +}) + +/** + * set status message to unsaved changes + */ +export const unsavedChanges = () => ({ + type: SAVE_STATUS, + payload: 'Ungesicherte Änderungen' +}) \ No newline at end of file diff --git a/src/Contexts/notifications.reducer.jsx b/src/Contexts/notifications.reducer.jsx new file mode 100644 index 000000000..3e909b98d --- /dev/null +++ b/src/Contexts/notifications.reducer.jsx @@ -0,0 +1,68 @@ + +import { SAVING_LESSON , LESSON_SAVED } from "./lesson.actions" +import { DELETING_SECTION_FAILED } from "./section.actions" +import { SAVE_STATUS } from "./notifications.actions" + + + +export const notificationInitialState = { + error: "", + saveStatus: "", + isSaving: 0, +} + +/** + * Notifications state contains all notifications visible to the user, like errors and saveState + * + * @param {*} state - state of lesson + * @param {Object} param1 - object with the parameters type and payload + */ +export function notificationReducer(state = notificationInitialState, { type, payload }) { + switch (type) { + case "ERROR": + return { + ...state, + error: + payload === undefined + ? "Ein Fehler ist aufgetreten..." + : payload, + } + case DELETING_SECTION_FAILED: + return { + ...state, + error: 'Beim Löschen einer Section ist ein Fehler aufgetretten' + } + + case SAVE_STATUS: + return { + ...state, + saveStatus: payload, + } + + case SAVING_LESSON: + return { + ...state, + isSaving: state.isSaving + 1, + saveStatus: 'Speichert...' + } + + case LESSON_SAVED: + if(state.isSaving > 1){ + return { + ...state, + isSaving: state.isSaving - 1 + } + } else { + return { + ...state, + isSaving: 0, + saveStatus: 'Gepspeichert' + } + } + + case "RESET": + return notificationInitialState + default: + return state + } +} \ No newline at end of file diff --git a/src/Contexts/section.actions.jsx b/src/Contexts/section.actions.jsx new file mode 100644 index 000000000..b76ef180d --- /dev/null +++ b/src/Contexts/section.actions.jsx @@ -0,0 +1,311 @@ +import { editorWS } from "~/utils/socket" +import { mergeDiff, buildDiff } from '~/utils/diff' +import uuid from "uuid/v4" +import { saveSectionCache } from "~/utils/cache" +import { generateHash } from "~/utils/crypto" +import { SET_ACTIVE_SECTION } from "./view.actions" +import { mapSection } from "~/utils/reducer" + +export const SET_SECTIONS = 'SET_SECTIONS' +export const ADD_SECTION = 'ADD_SECTION' +export const REPLACE_ADDED_SECTION_ID = "REPLACE_ADDED_SECTION_ID" +export const SWITCH_SECTION_VISIBILTY = 'SWITCH_SECTION_VISIBILTY' +export const PREPARE_DELETE_SECTION = 'PREPARE_DELETE_SECTION' +export const DELETE_SECTION = 'DELETE_SECTION' +export const DELETING_SECTION_FAILED = 'DELETING_SECTION_FAILED' +export const UPDATE_SECTION = 'UPDATE_SECTION' +export const SECTION_DOCVALUE_CHANGE = 'SECTION_DOCVALUE_CHANGE' +export const SAVING_SECTION = 'SAVING_SECTION' +export const SAVING_SECTION_FAILED = 'SAVING_SECTION_FAILED' +export const SECTION_SAVED = 'SECTION_SAVED' +export const FETCHING_SECTION = 'FETCHING_SECTION' +export const SECTION_FETCHED = 'SECTION_FETCHED' +export const FETCHING_SECTION_FAILED = 'SECTION_FETCHED' + +/** + * Switch visibible of a section to true or false depending on the current value + * Will be synced with the server while save process and makes the sections + * invisible or visble for all how do not have write permissions + * + * @param {string} sectionId - id of the sections witch visibility should switch + */ +export const switchSectionVisibility = (sectionId) => ({ + type: SWITCH_SECTION_VISIBILTY, + payload: sectionId +}) + +/** + * Set Sections in store, if there are existing sections they will overwirden + * to add a Section use addSection + * + * @param {Object[]} sections - Sections to overwrite current sections + */ +export const setSections = (sections) => ({ + type: SET_SECTIONS, + payload: sections +}) + +/** + * Add a section to the current state of sections, it is recommend to set an Id at least + * But could also called with out any parameter. Sections will be set with following parametes + * if no other value is given + * + * Defaults: + * - title: "" + * - _id: uuid - should be set to a mongoDB id, otherwise it could not saved to server + * - visible: true - also read users can see the section + * - docValue: {} - state object of serlo editor + * - changed: Set - have to be an Set Obejct with last changes, shouldn't be overwrite + * - position: -1 - section will added at least positon + * + * @param {Object} [section] - section object, all necesarry data are setten by default and can be overwirten + */ +export const addSection = (section) => ({ + type: ADD_SECTION, + payload: { + title: "", + _id: uuid(), // TODO: mark, so it will not be saved to backend with this id + visible: true, + docValue: { plugin: "rows" }, + changed: new Set(), + position: -1, // added at last pos + ...section + } +}) + +/** + * Fetch one or multible sections from the server and add it to sections state + * if no positon is setted by the server response it will be added at last position + * + * @param {...String} sectionIds - comma seperated list of section ids + */ +export const fetchSection = (...sectionIds) => ({state, dispatch}) => { + + // TODO: check connection and inform user + + const proms = sectionIds.map(async (_id) => { + + dispatch({ + type: FETCHING_SECTION, + payload: _id + }) + + return editorWS.emit( + 'get', + `lesson/${state.lesson._id}/sections`, + _id + ) + }) + + const resolved = Promise.allSettled(proms) + resolved.forEach((res, i) => { + if(res.status === 'fulfilled'){ + dispatch(addSection(mapSection(res.value))) + dispatch({ + type: SECTION_FETCHED, + payload: res.value._id + }) + } else { + dispatch({ + type: FETCHING_SECTION_FAILED, + payload: sectionIds[i] + }) + } + }) +} + +/** + * Creates a new section and persist it on the backend, section is created with default values of addSection + * + * @param {int} position - positon of section + */ +export const createSection = (position) => async ({dispatch, state}) => { + const tempId = uuid() + const {lesson} = state + position = position || state.sections.length + dispatch(addSection({ + _id: tempId, + position, + scopePermission: 'write' + })) + try{ + const section = await editorWS.emit('create', `lesson/${lesson._id}/sections`, {}) + dispatch({ + type: REPLACE_ADDED_SECTION_ID, + payload: { + tempId, + backendId: section._id, + }, + }) + } catch (err){ + dispatch({ // TODO: Recognice it and save it later, have to be a post and not a patch + // trigger could be the connection, need to be sockets as component und bind do a store + type: SAVING_SECTION_FAILED, + payload: { + _id: tempId + } + }) + } +} + +/** + * Saves all data to server, that are markes in the changed Set + */ +export const saveSections = () => async ({dispatch, state}) => { + + const { sections, lesson } = state + const NOTHING_TO_SAVE = 'nothing to save' + + const hashes = [] + // keep care of adding or removing something, ...section is to generate hash and it should include + // everything witch is part of section, compared to database + const proms = sections.map(({changed, hash, timestamp, ...section}, index) => { + const changes = {} + + if ( changed.size === 0 ) return Promise.resolve(NOTHING_TO_SAVE) + + dispatch({ + type: SAVING_SECTION + }) + + changed.forEach(key => { + if(key === 'docValue'){ + changes.stateDiff = buildDiff( + section.savedDocValue, + section.docValue, + ) + } else if (Object.prototype.hasOwnProperty.call(section, key)) { + changes[key] = section[key] + } + }) + + // meaby a hash should be part of the server request, but not implemented write now + hashes[index] = generateHash(section) + + return editorWS.emit( + 'patch', + `lesson/${lesson._id}/sections`, + section._id, + changes, + { state: 'diff' } + ); + }) + + const resolved = await Promise.allSettled(proms) + + resolved.forEach((res, i) => { + // keep care of adding or removing something, ...section is to generate hash and it should include + // everything witch is part of section, compared to database + const {changed, ...section} = sections[i] + const sectionId = section._id + + if(res.status === 'fulfilled'){ + if(res.value !== NOTHING_TO_SAVE){ + dispatch({ + type: SECTION_SAVED, + payload: sectionId + }) + + saveSectionCache({ + ...section, + // timestamp: res.value.updatedAt || res.value.instertedAt, + hash: hashes[i], + savedToBackend: true + }) + } + } else { + dispatch({ + type: SAVING_SECTION_FAILED, + payload: sectionId + }) + saveSectionCache({ + section, + hash: hashes[i], + savedToBackend: false + }) + } + }) + + +} + +/** + * Sets docValue + * + * @param {string} sectionId - ID of a section + * @param {Object} docValue - should be a Serlo Editor State + */ +export const updateSectionDocValue = (sectionId, docValue) => ({ + type: SECTION_DOCVALUE_CHANGE, + payload: { + _id: sectionId, + docValue + } +}) + +/** + * Use if section is already updated, for example by the sockets + * + * @param {string} sectionId - ID of a section + * @param {Object} section - Section object itself + */ +export const sectionWasUpdated = (sectionId, section) => ({ + type: UPDATE_SECTION, + payload: { + _id: sectionId, + ...section + } +}) + +/** + * Merge the current docValue (Serlo state) with the diff and overwrite current docValue + * + * @param {string} sectionId - ID of a section + * @param {Object} diff - Diff generated by util function buildDiff + */ +export const mergeEditorDiff = (sectionId, diff) => ({state, dispatch}) => { + const currentSection = state.sections.find(sec => sec._id === sectionId) + const currentDocValue = currentSection.docValue + dispatch({ + type: UPDATE_SECTION, + payload: { + _id: sectionId, + docValue: mergeDiff(currentDocValue, diff) + } + }) +} + +/** + * Removes a section from lesson. Lesson will be soft deleted from backend + * + * @param {string} sectionId - MongoId of Section + */ +export const removeSection = (sectionId) => async ({state, dispatch}) => { + dispatch({ + type: PREPARE_DELETE_SECTION, + payload: sectionId, + }) + + + const index = state.sections.findIndex((section) => section._id === sectionId) + const newActiveIndex = index === 0 ? index + 1 : index - 1 + const newActiveSectionId = state.sections[newActiveIndex]._id + + dispatch({ + type: SET_ACTIVE_SECTION, + payload: newActiveSectionId + }) + try{ + const section = await editorWS.emit('remove', `lesson/${state.lesson._id}/sections`, sectionId) + dispatch({ + type: DELETE_SECTION, + payload: section._id, + }) + } catch (err){ + // TODO: check if connection to sever exist + dispatch({ + type: DELETING_SECTION_FAILED, + payload: sectionId + }) + } +} \ No newline at end of file diff --git a/src/Contexts/section.reducer.jsx b/src/Contexts/section.reducer.jsx new file mode 100644 index 000000000..28e632fa2 --- /dev/null +++ b/src/Contexts/section.reducer.jsx @@ -0,0 +1,133 @@ +import { mergeDiff } from "~/utils/diff" +import { + SWITCH_SECTION_VISIBILTY, + SET_SECTIONS, + ADD_SECTION, + REPLACE_ADDED_SECTION_ID, + PREPARE_DELETE_SECTION, + DELETE_SECTION, + DELETING_SECTION_FAILED, + UPDATE_SECTION, + SECTION_DOCVALUE_CHANGE, + SECTION_SAVED, + DOCVALUE_SAVED +} from "./section.actions" +import { + SWAP_SECTIONS +} from "./lesson.actions" +import { invertSplice } from "~/utils/reducer" + +export const sectionInitialState = [] + +/** + * Most important part for the Edtior, handles all Section data and the Editor state itself + * State is an Array of sections + * + * @param {*} state - state of lesson + * @param {Object} param1 - object with the parameters type and payload + */ +export function sectionReducer(state = sectionInitialState, { type, payload }) { + switch (type) { + case SET_SECTIONS: + return payload.map((section) => ({ + ...section, + changed: new Set() + })) + + case ADD_SECTION: + return invertSplice(state, payload.position, 0, payload) + + case REPLACE_ADDED_SECTION_ID: { + return state.map((section) => + section._id === payload.tempId + ? {...section, _id: payload.backendId} + : section + ) + } + + case SWAP_SECTIONS: + return state.map((sectionId, index, sections) => { + switch(index){ + case payload[0]: + return sections[payload[1]] + case payload[1]: + return sections[payload[0]] + default: + return sectionId + } + }) + + case SWITCH_SECTION_VISIBILTY: + return state.map((section) => { + if (section._id === payload) { + section.changed.add("visible") + return { ...section, visible: !section.visible } + } + return section + }) + + case PREPARE_DELETE_SECTION: + return state.map((section) => { + if (section._id === payload) + return { ...section, delete: true } + return section + }) + + case DELETE_SECTION: + return state.filter( + section => section._id !== payload, + ) + + case DELETING_SECTION_FAILED: + return state.map((section) => { + if (section._id === payload){ + return { ...section, delete: false} + } + }) + + case UPDATE_SECTION: + return state.map((section) => { + if(section._id === payload._id){ + // section.changed.add(Object.keys(payload)) + return {...section, ...payload} + } + return section + }) + + /* case "SECTION_TITLE_CHANGE": + return state.map(section => { + if (section._id !== payload.sectionId) return section + + section.changed.add("title") + return { ...section, title: payload.title } + }) */ + + case SECTION_DOCVALUE_CHANGE: + return state.map((section) => { + if(section._id !== payload._id) return section + section.changed.add("docValue") + return { + ...section, + docValue: payload.docValue + } + }) + + case SECTION_SAVED: + return state.map((section) => { + if (section._id === payload){ + section = { + ...section, + savedDocValue: section.docValue + } + section.changed.clear() + } + return section + }) + + case "RESET": + return sectionInitialState + + default: + return state + } +} diff --git a/src/Contexts/view.actions.jsx b/src/Contexts/view.actions.jsx new file mode 100644 index 000000000..3e147d2d9 --- /dev/null +++ b/src/Contexts/view.actions.jsx @@ -0,0 +1,70 @@ +export const SET_ACTIVE_SECTION = "SET_ACTIVE_SECTION" +export const SET_EDITING = "SET_EDITING" +export const SET_LOADING = "SET_LOADING" +export const TOGGLE_SECTION_OVERVIEW = "TOGGEL_SECTION_OVERVIEW" +export const TOGGLE_SECTION_SETTINGS = "TOGGLE_SECTION_SETTINGS" + + +export const setActiveSection = (sectionId) => ({state, dispatch}) => { + + if (state.view.activeSectionId === sectionId) { + dispatch(showSectionSettings(!state.view.showSectionSettings)) + } else { + dispatch(showSectionSettings(false)) + dispatch({ + type: SET_ACTIVE_SECTION, + payload: sectionId + }) + } +} + + +/** + * Set section editing mode + * + * @param {boolean} editing - activate or deactivate editing mode + */ +export const setEditing = (editing) => ({ + type: SET_EDITING, + payload: editing +}) + +export const startLoading = () => ({ + type: SET_LOADING, + payload: true +}) + +export const finishLoading = () => ({ + type: SET_LOADING, + payload: false +}) + +/** + * Set the visibility of the section overview + * @param {boolean} show - should be visible? + */ +export const showSectionOverview = (show = true) => ({ + type: TOGGLE_SECTION_OVERVIEW, + payload: show +}) + +export const toggleSectionOverview = () => ({state, dispatch}) => + dispatch({ + type: TOGGLE_SECTION_OVERVIEW, + payload: !state.view.sectionOverviewExpanded + }) + +/** + * Set the visibility of the section settings + * @param {boolean} show - should be visible? + */ +export const showSectionSettings= (show = true) => ({ + type: TOGGLE_SECTION_SETTINGS, + payload: show +}) + +export const toggleSectionSettings = () => ({state, dispatch}) => + dispatch({ + type: TOGGLE_SECTION_SETTINGS, + payload: !state.view.showSectionSettings + }) diff --git a/src/Contexts/view.reducer.jsx b/src/Contexts/view.reducer.jsx new file mode 100644 index 000000000..258671611 --- /dev/null +++ b/src/Contexts/view.reducer.jsx @@ -0,0 +1,92 @@ +import qs from "qs" + +import { ADD_SECTION , REPLACE_ADDED_SECTION_ID , SET_SECTIONS } from "./section.actions" +import { TOGGLE_SECTION_SETTINGS, TOGGLE_SECTION_OVERVIEW, SET_ACTIVE_SECTION , SET_EDITING , SET_LOADING } from "./view.actions" +import { BOOTSTRAP_FINISHED } from "./lesson.actions" + + + +const q = qs.parse(window.location.search, { ignoreQueryPrefix: true }) + +export const viewInitialState = { + loading: true, + studentView: !!q.student_view, + editing: false, + bootstrapFinished: false, + sectionOverviewExpanded: false, + showSectionSettings: false, + activeSectionId: '', +} + +/** + * Manage all data are relvant for the view of the user, like loading and editing mode + * + * @param {*} state - state of lesson + * @param {Object} param1 - object with the parameters type and payload + */ +export function viewReducer(state = viewInitialState, { type, payload }) { + switch (type) { + case SET_EDITING: + // switch between editing and view mode + if (state.studentView) return state + return { + ...state, + editing: payload, + } + + case SET_SECTIONS: + return { + ...state, + activeSectionId: payload[0]._id || null + } + + case SET_LOADING: + return { + ...state, + loading: payload + } + case ADD_SECTION: + return { + ...state, + activeSectionId: payload._id, + showSectionSettings: false, + } + + case REPLACE_ADDED_SECTION_ID: + return payload.tempId === state.activeSectionId + ? { ...state, activeSectionId: payload.backendId } + : state + + case TOGGLE_SECTION_OVERVIEW: + return { + ...state, + sectionOverviewExpanded: payload + } + + case TOGGLE_SECTION_SETTINGS: + return { + ...state, + showSectionSettings: payload + } + + + case BOOTSTRAP_FINISHED: + return { + ...state, + bootstrapFinished: true, + saveStatus: "", + } + + case SET_ACTIVE_SECTION: + return { + ...state, + activeSectionId: payload, + } + + case "RESET": + return viewInitialState + + default: + return state + } +} diff --git a/src/assets/add-white.svg b/src/assets/add-white.svg index 9363be40d..8edfadb09 100644 --- a/src/assets/add-white.svg +++ b/src/assets/add-white.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/assets/arrow-back.svg b/src/assets/arrow-back.svg index 93f1b32e2..decd70fad 100644 --- a/src/assets/arrow-back.svg +++ b/src/assets/arrow-back.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/assets/arrow-down.svg b/src/assets/arrow-down.svg index b81207776..203b24694 100644 --- a/src/assets/arrow-down.svg +++ b/src/assets/arrow-down.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/assets/arrow-left.svg b/src/assets/arrow-left.svg index 729010c10..be2fb2fbd 100644 --- a/src/assets/arrow-left.svg +++ b/src/assets/arrow-left.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/assets/arrow-right.svg b/src/assets/arrow-right.svg index 2383d39ca..b07451f03 100644 --- a/src/assets/arrow-right.svg +++ b/src/assets/arrow-right.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/assets/arrow-up.svg b/src/assets/arrow-up.svg index 996ed4b2b..e3ab5d8b2 100644 --- a/src/assets/arrow-up.svg +++ b/src/assets/arrow-up.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/assets/chat-bubble.svg b/src/assets/chat-bubble.svg new file mode 100644 index 000000000..df866fc7e --- /dev/null +++ b/src/assets/chat-bubble.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/close-white.svg b/src/assets/close-white.svg index 08bb3edd6..00ffe4377 100644 --- a/src/assets/close-white.svg +++ b/src/assets/close-white.svg @@ -1,4 +1 @@ - - - - + \ No newline at end of file diff --git a/src/assets/close.svg b/src/assets/close.svg index a42ba6324..56e6142e8 100644 --- a/src/assets/close.svg +++ b/src/assets/close.svg @@ -1,4 +1 @@ - - - - + \ No newline at end of file diff --git a/src/assets/double-arrow-left-red.svg b/src/assets/double-arrow-left-red.svg index 9838a3226..b6903fe5f 100644 --- a/src/assets/double-arrow-left-red.svg +++ b/src/assets/double-arrow-left-red.svg @@ -1,18 +1 @@ - - - - - round-expand-24px - - - Created with Sketch. - - - - - - - - - - + \ No newline at end of file diff --git a/src/assets/double-arrow-left-white.svg b/src/assets/double-arrow-left-white.svg index f87da6baa..805257d64 100644 --- a/src/assets/double-arrow-left-white.svg +++ b/src/assets/double-arrow-left-white.svg @@ -1,18 +1 @@ - - - - - round-expand-24px - - - Created with Sketch. - - - - - - - - - - + \ No newline at end of file diff --git a/src/assets/drag-handle.svg b/src/assets/drag-handle.svg index 79fe60025..ebbf34687 100644 --- a/src/assets/drag-handle.svg +++ b/src/assets/drag-handle.svg @@ -1,12 +1 @@ - - - - ic-Drag handle - Created with Sketch. - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/src/assets/duplicate-white.svg b/src/assets/duplicate-white.svg index eb0de301d..708dd3521 100644 --- a/src/assets/duplicate-white.svg +++ b/src/assets/duplicate-white.svg @@ -1,4 +1 @@ - - - - + \ No newline at end of file diff --git a/src/assets/eye-red.svg b/src/assets/eye-red.svg index bdc43d1ee..ba41653ee 100644 --- a/src/assets/eye-red.svg +++ b/src/assets/eye-red.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/assets/header-settings.svg b/src/assets/header-settings.svg index 2e6cd1c5b..324bd5f71 100644 --- a/src/assets/header-settings.svg +++ b/src/assets/header-settings.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/assets/info-white.svg b/src/assets/info-white.svg index 89a7d257b..b4f1ec817 100644 --- a/src/assets/info-white.svg +++ b/src/assets/info-white.svg @@ -1,4 +1 @@ - - - - + \ No newline at end of file diff --git a/src/assets/list-red.svg b/src/assets/list-red.svg index f3d762a4c..4ce95ffdb 100644 --- a/src/assets/list-red.svg +++ b/src/assets/list-red.svg @@ -1,5 +1 @@ - - - - - + \ No newline at end of file diff --git a/src/assets/list.svg b/src/assets/list.svg index 55f4bd16b..4b756648b 100644 --- a/src/assets/list.svg +++ b/src/assets/list.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/assets/no-preview-white.svg b/src/assets/no-preview-white.svg index 4f8f9bfc3..6f11abfcf 100644 --- a/src/assets/no-preview-white.svg +++ b/src/assets/no-preview-white.svg @@ -1,4 +1 @@ - - - - + \ No newline at end of file diff --git a/src/assets/no-preview.svg b/src/assets/no-preview.svg index e72cd84bc..267a0dc24 100644 --- a/src/assets/no-preview.svg +++ b/src/assets/no-preview.svg @@ -1,4 +1 @@ - - - - + \ No newline at end of file diff --git a/src/assets/notes-red.svg b/src/assets/notes-red.svg index d505f61c6..fe1453fd9 100644 --- a/src/assets/notes-red.svg +++ b/src/assets/notes-red.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/assets/notes.svg b/src/assets/notes.svg index 1888cba6c..d0cea9b8d 100644 --- a/src/assets/notes.svg +++ b/src/assets/notes.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/assets/overview-red.svg b/src/assets/overview-red.svg index 41d784cf1..119118170 100644 --- a/src/assets/overview-red.svg +++ b/src/assets/overview-red.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/assets/overview.svg b/src/assets/overview.svg index e282afc67..9a75ae5f3 100644 --- a/src/assets/overview.svg +++ b/src/assets/overview.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/assets/plus-red-round.svg b/src/assets/plus-red-round.svg index 697d7ad70..210871343 100644 --- a/src/assets/plus-red-round.svg +++ b/src/assets/plus-red-round.svg @@ -1,16 +1 @@ - - - - - ic-round-add_circle - - - Created with Sketch. - - - - - - - - + \ No newline at end of file diff --git a/src/assets/plus-white.svg b/src/assets/plus-white.svg index c1d957bf7..33f8493f4 100644 --- a/src/assets/plus-white.svg +++ b/src/assets/plus-white.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/assets/preview-white.svg b/src/assets/preview-white.svg index 19db07011..d2516c6ce 100644 --- a/src/assets/preview-white.svg +++ b/src/assets/preview-white.svg @@ -1,4 +1 @@ - - - - + \ No newline at end of file diff --git a/src/assets/preview.svg b/src/assets/preview.svg index a391217b4..e2198b29e 100644 --- a/src/assets/preview.svg +++ b/src/assets/preview.svg @@ -1,4 +1 @@ - - - - + \ No newline at end of file diff --git a/src/assets/remove.svg b/src/assets/remove.svg index 1a38f9504..d904d38af 100644 --- a/src/assets/remove.svg +++ b/src/assets/remove.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/assets/settings.svg b/src/assets/settings.svg index 7855ef0af..fa97a058f 100644 --- a/src/assets/settings.svg +++ b/src/assets/settings.svg @@ -1,4 +1 @@ - - - - + \ No newline at end of file diff --git a/src/assets/share-red.svg b/src/assets/share-red.svg index 63fd223d3..d4d1e0add 100644 --- a/src/assets/share-red.svg +++ b/src/assets/share-red.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/assets/share-white.svg b/src/assets/share-white.svg index 6ebbca249..2396ce0ba 100644 --- a/src/assets/share-white.svg +++ b/src/assets/share-white.svg @@ -1,4 +1 @@ - - - - + \ No newline at end of file diff --git a/src/assets/task-icon.svg b/src/assets/task-icon.svg new file mode 100644 index 000000000..085c41c86 --- /dev/null +++ b/src/assets/task-icon.svg @@ -0,0 +1 @@ + diff --git a/src/assets/trash-white.svg b/src/assets/trash-white.svg index d79edec34..4fe756740 100644 --- a/src/assets/trash-white.svg +++ b/src/assets/trash-white.svg @@ -1,4 +1 @@ - - - - + \ No newline at end of file diff --git a/src/assets/trash.svg b/src/assets/trash.svg index 83842c27d..5c63d89dc 100644 --- a/src/assets/trash.svg +++ b/src/assets/trash.svg @@ -1,4 +1 @@ - - - - + \ No newline at end of file diff --git a/src/components/Button/BaseButton.jsx b/src/components/Button/BaseButton.jsx new file mode 100644 index 000000000..344dd51ab --- /dev/null +++ b/src/components/Button/BaseButton.jsx @@ -0,0 +1,29 @@ +import React, { useContext } from "react" +import color from "color" +import styled, { css } from "styled-components" + +import theme from "~/theme" + +const StyledButton = styled.button` + height: ${props => props.theme.height || '48px'}; + background: ${props => props.theme.background || 'none'}; + border: ${props => props.theme.border || 'none'}; + cursor: pointer; + + ${props => props.theme.padding ? css`padding: ${props.theme.padding};` : css`padding: 5px 10px;` } + ${props => props.theme.width ? css`width: ${props.theme.width};` : css`` } + + svg, img { + height: 100%; + } +` + +const BaseButton = ({ styles, children, onClick = () => {}, ...props }) => { + return ( + {} : onClick} {...props}> + {children} + + ) +} + +export default BaseButton diff --git a/src/components/Container.jsx b/src/components/Container.jsx index 54524a572..856b00530 100644 --- a/src/components/Container.jsx +++ b/src/components/Container.jsx @@ -1,6 +1,6 @@ import React, { useContext } from "react" import styled, { css } from "styled-components" -import LessonContext from "~/Contexts/Lesson" +import LessonContext from "~/Contexts/Lesson.context" const StyledContainer = styled.div` padding: 25px calc((100vw - 995px) / 2); diff --git a/src/components/ErrorBoundary.jsx b/src/components/ErrorBoundary.jsx new file mode 100644 index 000000000..3f03784b8 --- /dev/null +++ b/src/components/ErrorBoundary.jsx @@ -0,0 +1,56 @@ +import React, {Component} from 'react' +import * as Sentry from '@sentry/browser' +import { UserInformationError } from '~/utils/errors' + + +const defaultMessage = 'Es ist ein schwerwiegender Fehler aufgetretten'; +class ErrorBoundary extends Component { + + + + constructor(props) { + super(props); + + this.state = { + eventId: null, + hasError: false, + message: defaultMessage + }; + } + + static getDerivedStateFromError (error) { + // Update state so the next render will show the fallback UI. + return { hasError: true }; + } + + componentDidCatch(error, errorInfo) { + console.log(error) + if(error instanceof UserInformationError){ + this.setState({ + ...this.state, + message: error.message + }) + } + Sentry.withScope((scope) => { + scope.setExtras(errorInfo); + const eventId = Sentry.captureException(error); + this.setState({eventId}); + }); + } + + render() { + if (this.state.hasError) { + // render fallback UI + return ( + +

{this.state.message}

+ +
+ ); + } + + return this.props.children; + } +} + +export default ErrorBoundary; \ No newline at end of file diff --git a/src/components/InfoBanner.jsx b/src/components/InfoBanner.jsx new file mode 100644 index 000000000..6d7d1d9df --- /dev/null +++ b/src/components/InfoBanner.jsx @@ -0,0 +1,106 @@ +import React, { useContext, useRef, useState } from "react"; +import styled, { css } from "styled-components"; +import Text from "~/components/Text"; +import Icon from "~/assets/chat-bubble.svg"; +import config from "~/config"; +import WindowWidth from "./WindowWidth"; + +const Banner = styled.div` + padding-box; + overflow: hidden; + background-color: #f5f5f5; + width: 100vw; + transition: 250ms all ease-in-out; + & span { + display: block; + margin: -10px 0 0 20px; + color: #666; + } + ${(props) => + props.expanded + ? css` + padding: 0 278px 0 40px; + margin: -20px -38px 15px; + margin-left: 240px; + ` + : css` + padding: 0px 18px 0 92px; + margin: -20px 1px 15px; + `} +`; + +const ContainerFeedback = styled.div` + display: flex; + flex-direction: row; + justify-content: space-between; + align-item: center; + padding-bottom: 10px; +`; +const Ribbon = styled.div` + transform: rotate(-26deg); + display: block; + position: relative; + top: 3px; + left: -118px; + width: 200px; + height: 20px; + padding-top: 3px; + text-align: center; + font-size: 12px; + font-weight: bold; + color: #fff; + background-color: #455b6a; +`; + +const Feedback = styled(Text)` + color: #b1063a; + align-text: top; + float: right; + margin-top: -10px; + padding: 0 0 10px 20px; +`; +const StyledLink = styled.a` + &::after { + display: none; + } +`; +const ChatIcon = styled(Icon)` + color: grey; + height: 1rem; +`; + +const BannerText = ({ windowWidth }) => { + if (windowWidth > config.breakpoints.tablet) { + return ( + + Erstellte Inhalte werden gespeichert und können Schüler:innen + bereitgestellt werden. +
+ Teilen und Kopieren der Inhalte ist noch nicht möglich. +
+ ); + } + return null; +}; + +const InfoBanner = ({ editing, expanded }) => { + if (editing) { + return ( + + BETA + + + + + + Wir freuen uns über Feedback + + + + ); + } else { + return null; + } +}; + +export default InfoBanner; diff --git a/src/components/Input/Text.jsx b/src/components/Input/Text.jsx index 2995bf96c..7149964cb 100644 --- a/src/components/Input/Text.jsx +++ b/src/components/Input/Text.jsx @@ -31,15 +31,15 @@ const StyledTextInput = styled.input` ` const TextInput = ({ value, onChange, size = 20, readOnly, ...props }) => { - return ( - onChange(evt.target.value)} - size={size} - readOnly={readOnly} - {...props} - /> - ) + return ( + onChange(evt.target.value)} + size={size} + readOnly={readOnly} + {...props} + /> + ) } export default TextInput diff --git a/src/components/ModalActions.jsx b/src/components/ModalActions.jsx new file mode 100644 index 000000000..066dc1b87 --- /dev/null +++ b/src/components/ModalActions.jsx @@ -0,0 +1,78 @@ +import React, { useContext, useRef, useState } from "react"; +import styled, { css } from "styled-components"; +import { Portal } from "react-portal" +import Container from "~/components/Container" +import Button from "~/components/Button" +import Flex from "~/components/Flex" + +const Wrapper = styled.div` + position: fixed; + top: 0; + left: 0; + background-color: rgba(0, 0, 0, 0.3); + display: flex; + justify-content: center; + align-items: center; + width: 100vw; + height: 100vh; + z-index: 999; +` + +const Content = styled(Container)` + background-color: #fff; + max-width: 500px; + border-radius: 5px; + box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23); + z-index: 1000; +` + + + + +ModalActions.propTypes = { + action: ({ action }) => { + if (action && action.type !== Button) { + return new Error('Modal expects action to be a Button instance.') + } + } +} + + + +function ModalActions({ children, actions, cancelButton = true, isOpen, closeModal }) { + return ( + isOpen && + + e.stopPropagation()} small> + {children} +
+ + {cancelButton === true ? + : null + } + {actions.map((action, index) => { + return ( + + ) + })} + + +
+
+
+ + ) +} + +export default ModalActions \ No newline at end of file diff --git a/src/components/TaskIcon.jsx b/src/components/TaskIcon.jsx new file mode 100644 index 000000000..8e923bebc --- /dev/null +++ b/src/components/TaskIcon.jsx @@ -0,0 +1,51 @@ +import React, { useState } from "react"; +import styled from "styled-components"; +import config from "~/config"; + +import Icon from "~/assets/task-icon.svg"; +import WindowWidth from "./WindowWidth"; + +const TaskBackground = styled.div` + display: flex; + justify-content: center; + align-items: center; + width: 2.5rem; + height: 2.5rem; + border-radius: 50%; + background-color: ${(props) => props.BackgroundColor}; + margin-right: 0.694rem; + flex-shrink: 0; +`; + +const IconWhite = styled(Icon)` + color: white; + height: 1rem +`; +const IconColor = styled(Icon)` + color: ${(props) => props.Color}; + margin-right: 0.694rem; + flex-shrink: 0; + margin-top: 0.2rem; +`; + +const TaskIcon = ({ color = "#FFF", windowWidth }) => { + if (windowWidth > config.breakpoints.tablet) { + return ( + + + + ); + } else { + return ; + } +}; + +const ResponsivTaskIcon = ({ color = "#FFF" }) => { + return ( + + + + ); +}; + +export default ResponsivTaskIcon; diff --git a/src/components/WindowWidth.jsx b/src/components/WindowWidth.jsx new file mode 100644 index 000000000..74d37e824 --- /dev/null +++ b/src/components/WindowWidth.jsx @@ -0,0 +1,36 @@ +import React, { useState } from "react" +import styled from "styled-components" +import config from "~/config" + + + + + +class WindowWidth extends React.Component { + + constructor(props) { + super(props); + this.state = {width: window.innerWidth}; + } + + componentDidMount() { + window.addEventListener("resize", () => this.setState({width: window.innerWidth})); + } + + renderChildren() { + return React.Children.map(this.props.children,child => + React.cloneElement(child, {windowWidth: this.state.width} )) + } + + + render() { + return ( + + {this.renderChildren()} + + ) + } +} + + +export default WindowWidth; diff --git a/src/config.js b/src/config.js index 75a169600..70b139d77 100644 --- a/src/config.js +++ b/src/config.js @@ -1,8 +1,26 @@ +// env variables will be set to the window object in public/env.js during build +// https://blog.codecentric.de/en/2018/12/react-application-container-environment-aware-kubernetes-deployment/ +// NOTE: You can not put this window and process stuff into a variable +// because parcel does not allow dynamic access to process.env. So something like process.env[name] does not work. :( + +// ⚠ DANGER ⚠ +// If you introduce new config options with process.env +// also add them to deploy/env.sh const config = { - GRAPHQL_HTTP_URL: - process.env.GRAPHQL_HTTP_URL || "http://localhost:4000/graphql", - GRAPHQL_WS_URL: process.env.GRAPHQL_WS_URL || "ws://localhost:4000", - DISABLE_BACKEND: true, -} -export default config + EDITOR_API_URL: window.EDITOR_API_URL || process.env.EDITOR_API_URL || "http://localhost:4001", + SERVER_API_URL: window.SERVER_API_URL || process.env.SERVER_API_URL || "http://localhost:3030", + EDITOR_SOCKET_URL: window.EDITOR_SOCKET_URL || process.env.EDITOR_SOCKET_URL || "ws://localhost:4001", + HOMEWORK_URI: window.HOMEWORK_URI || process.env.HOMEWORK_URI || "/homework", + ENABLE_LTI: window.ENABLE_LTI || process.env.ENABLE_LTI || false, + + breakpoints: { + tablet: 750, + desktop: 991, + desktopLg: 1200, + }, +}; + +// eslint-disable-next-line no-console +console.info("config", config); +export default config; diff --git a/src/index.html b/src/index.html index c9c22af67..64c9dc268 100644 --- a/src/index.html +++ b/src/index.html @@ -4,14 +4,27 @@ + Editor - Editor + + +
- - + \ No newline at end of file diff --git a/src/index.js b/src/index.js index 598661739..7d1c5dfb4 100644 --- a/src/index.js +++ b/src/index.js @@ -1,14 +1,35 @@ import "@babel/polyfill" import React from "react" import ReactDOM from "react-dom" +import * as Sentry from '@sentry/browser' +import { bindAllSettledToPromise } from '~/utils/promise' +import { version } from '~/../package.json'; + +import Application from '~/Application/index'; + function renderApp() { - const Application = require("~/Application/index").default - ReactDOM.render(, document.getElementById("editor")) + + if(process.env.SENTRY_DSN){ + Sentry.init({ + dsn: process.env.SENTRY_DSN, + environment: process.env.ENVIRONMENT, + release: version, + integrations: [ + new Sentry.Integrations.Breadcrumbs({}) + ], + }) + } + + // const Application = require("~/Application/index").default + ReactDOM.render(, document.getElementById("editor")) } +// implement Promise.allSettled if not supported by browser +bindAllSettledToPromise() + renderApp() if (module.hot) { - module.hot.accept(renderApp) + module.hot.accept(renderApp) } diff --git a/src/plugins/etherpad/Etherpad.jsx b/src/plugins/etherpad/Etherpad.jsx index fba159c5b..486d80b3d 100644 --- a/src/plugins/etherpad/Etherpad.jsx +++ b/src/plugins/etherpad/Etherpad.jsx @@ -1,7 +1,7 @@ import React, { useState, useEffect, useContext } from "react" import shortid from "shortid" -import LessonContext from "~/Contexts/Lesson" +import LessonContext from "~/Contexts/Lesson.context" import Input from "~/components/Input" import Flex from "~/components/Flex" @@ -9,54 +9,32 @@ import Flex from "~/components/Flex" import { createBoard } from "./utils" const Etherpad = ({ focused, state }) => { - useEffect(() => { - if (state.id.value) return - state.id.set(shortid.generate()) - }, []) + useEffect(() => { + if (state._id.value) return + state._id.set(shortid.generate()) + }, []) - const { store, dispatch } = useContext(LessonContext) + const { store, dispatch } = useContext(LessonContext) - let etherpadFrame - if (state.id.value) { - etherpadFrame = ( - + +const LTI13Frame = (state, idToken) => { + const csrf = (document.getElementsByName('_csrf')[0] ? document.getElementsByName('_csrf')[0].value : undefined) + const html = `data:text/html;charset=utf-8, + +
+ + +
+ + ` + return ( + + ) +} + +const LTI = ({ state, editable }) => { + const [tools, setTools] = useState({}) + const [loading, setLoading] = useState(true) + const [idToken, setIdToken] = useState("") + const { store: user } = useContext(UserContext) + + async function bootstrap() { + if (state.url.value) { + const iss = window.location.protocol + '//' + window.location.host + '/'; + const pseudonym = await getPseudonym(user.id, state.templateId.value) + const current = new Date(); + const name = encodeURI(depseudonymizationFrame(iss, pseudonym)); + if(state.ltiVersion.value === '1.3.0') { + const request = { + iss, + name, + aud: state.clientId.value, + sub: pseudonym, + exp: current.getTime() + 3 * 60, + iat: current.getTime(), + nonce: shortid.generate() + shortid.generate(), + 'https://purl.imsglobal.org/spec/lti/claim/message_type': state.ltiMessageType.value, + 'https://purl.imsglobal.org/spec/lti/claim/roles': [ + `http://purl.imsglobal.org/vocab/lis/v2/membership#${user.roles[0].name}`, + ], + 'https://purl.imsglobal.org/spec/lti/claim/resource_link': { + id: state.id.value, + }, + 'https://purl.imsglobal.org/spec/lti/claim/version': state.ltiVersion.value, + 'https://purl.imsglobal.org/spec/lti/claim/deployment_id': state.id.value, + 'https://purl.imsglobal.org/spec/lti-dl/claim/deep_linking_settings': + (state.ltiMessageType.value === 'LtiDeepLinkingRequest' + ? { + accept_types: ['ltiLink'], + accept_media_types: 'image/*,text/html', + accept_presentation_document_targets: ['iframe', 'window'], + deep_link_return_url: `${config.SERVER_API_URL}/tools/${state.id.value}/link`, + } + : undefined), + } + setIdToken(await sign(request)) + window.addEventListener("message", receiveMessage, false); + + function receiveMessage(event) { + if (event.origin !== config.SERVER_API_URL) + return; + + if (event.data.id === state.id.value) { + state.url.set(event.data.url) + state.ltiMessageType.set('basic-lti-launch-request') + setIdToken(null) + } + } + } + } else { + setTools(await getTools()) + } + setLoading(false) + } + + useEffect(() => { + bootstrap() + }, []) + + const setTool = (tool) => { + state.id.set(shortid.generate()) + state.templateId.set(tool._id) + state.clientId.set(tool.oAuthClientId) + state.ltiMessageType.set(tool.lti_message_type) + state.ltiVersion.set(tool.lti_version) + state.url.set(tool.url) + } + + if (loading) { + return loader + } else { + if (state.url.value) { + if (idToken) { + return LTI13Frame(state, idToken) + } else if (state.ltiVersion.value === 'LTI-1p0') { + return LTI11Frame(state) + } else { + bootstrap() + return loader + } + } else { + if(editable) { + return toolSelector(tools, setTool) + } else { + return
+ } + } + } +} + +export default LTI diff --git a/src/plugins/lti/Preview.jsx b/src/plugins/lti/Preview.jsx new file mode 100644 index 000000000..b757f309b --- /dev/null +++ b/src/plugins/lti/Preview.jsx @@ -0,0 +1,18 @@ +import React from "react" +import Flex from "~/components/Flex" + +import {generatePlugin} from './index' + +const LtiPreview = () => +

LTI Tools

+
+ +const ltiPlugin = generatePlugin(LtiPreview) + +export default ltiPlugin diff --git a/src/plugins/lti/assets/logo.png b/src/plugins/lti/assets/logo.png new file mode 100644 index 000000000..c7afa85ba Binary files /dev/null and b/src/plugins/lti/assets/logo.png differ diff --git a/src/plugins/lti/assets/logo.svg b/src/plugins/lti/assets/logo.svg new file mode 100644 index 000000000..035d79681 --- /dev/null +++ b/src/plugins/lti/assets/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/plugins/lti/index.jsx b/src/plugins/lti/index.jsx new file mode 100644 index 000000000..7c3c85c74 --- /dev/null +++ b/src/plugins/lti/index.jsx @@ -0,0 +1,27 @@ +import React from "react" +import { object, string } from "@edtr-io/plugin" + +import LtiIcon from "./assets/logo.svg" +import LTI from "./LTI" + +export const ltiState = object({ + id: string(), + templateId: string(), + url: string(), + clientId: string(), + ltiMessageType: string(), + ltiVersion: string(), +}) + +export const SizedLtiIcon = () => ( + +) + +export const generatePlugin = (Component) => ({ + Component, + state: ltiState, +}) + +const ltiPlugin = generatePlugin(LTI) + +export default ltiPlugin diff --git a/src/plugins/lti/utils.js b/src/plugins/lti/utils.js new file mode 100644 index 000000000..b9d897508 --- /dev/null +++ b/src/plugins/lti/utils.js @@ -0,0 +1,19 @@ +import { serverApi } from "~/utils/api" + +export const getTools = async () => { + return await serverApi.get('/ltitools/?isTemplate=true&isLocal=false') +} + +export const getPseudonym = async (userId, toolId) => { + const response = await serverApi.get(`/pseudonym/?userId=${userId}&toolId=${toolId}`) + return response.data[0].pseudonym +} + +export const sign = async (request) => { + return await serverApi.post('/tools/sign/lti13', {request}) +} + +export const depseudonymizationFrame = (url, pseudonym) => { + const properties = 'title="username" style="height: 26px; width: 180px; border: none;"'; + return ``; +} \ No newline at end of file diff --git a/src/plugins/nexboard/Nexboard.jsx b/src/plugins/nexboard/Nexboard.jsx index b537b33c8..3d3474681 100644 --- a/src/plugins/nexboard/Nexboard.jsx +++ b/src/plugins/nexboard/Nexboard.jsx @@ -1,5 +1,5 @@ import React, { useState, useEffect, useContext } from "react" -import LessonContext from "~/Contexts/Lesson" +import LessonContext from "~/Contexts/Lesson.context" import UserContext from "~/Contexts/User" import { createBoard, getBoard } from "./utils" import Action from "~/components/Action" @@ -14,15 +14,15 @@ const Nexboard = ({ focused, state }) => { async function bootstrap() { try { let board - if (state.id.value) { - board = await getBoard(state.id.value) + if (state._id.value) { + board = await getBoard(state._id.value) } else { board = await createBoard( - store.lesson.id, + store.lesson._id, `${store.lesson.title} Nexboard`, ) } - state.id.set(board.id) + state._id.set(board._id) setBoard(board) } catch (err) {} diff --git a/src/plugins/nexboard/Preview.jsx b/src/plugins/nexboard/Preview.jsx index 508bf871a..2d6bef953 100644 --- a/src/plugins/nexboard/Preview.jsx +++ b/src/plugins/nexboard/Preview.jsx @@ -1,25 +1,24 @@ import React from "react" import Flex from "~/components/Flex" -const etherpadPlugin = { - Component: () => { - return ( - -

Nexboard

-
- ) - }, - icon: () => ( - - ), - title: "Etherpad", - description: "Real time collaboration.", + +import { generatePlugin } from "./index" + + +const EtherpadPreview = () => { + return ( + +

Nexboard

+
+ ) } +const etherpadPlugin = generatePlugin(EtherpadPreview) + export default etherpadPlugin diff --git a/src/plugins/nexboard/index.jsx b/src/plugins/nexboard/index.jsx index 900b37d77..9e45705c9 100644 --- a/src/plugins/nexboard/index.jsx +++ b/src/plugins/nexboard/index.jsx @@ -2,23 +2,24 @@ import React from "react" import { object, string } from "@edtr-io/plugin" import Nexboard from "./Nexboard" + +import NextboadIcon from "./assets/logo.png" + export const nexboardState = object({ - id: string(), + id: string(), }) -const nexboardPlugin = { - Component: Nexboard, - state: nexboardState, - icon: () => ( - - ), - title: "Nexboard", - description: +export const generatePlugin = (Component) => ({ + Component, + state: nexboardState, + icon: () => ( + + ), + title: "Nexboard", + description: "Benutze das digitale Nexboard, um all deine Ideen festzuhalten!", -} +}) + +const nexboardPlugin = generatePlugin(Nexboard) export default nexboardPlugin diff --git a/src/plugins/nexboard/utils.js b/src/plugins/nexboard/utils.js index 383ce0fb5..c148e83d8 100644 --- a/src/plugins/nexboard/utils.js +++ b/src/plugins/nexboard/utils.js @@ -1,25 +1,25 @@ -import api from "~/utils/api" +import { serverApi } from "~/utils/api" export const createBoard = async (lessonId, title) => { - let nexboardAttachment = await api.get( + let nexboardAttachment = await serverApi.get( `/editor/attachments?key=nexboard&lesson=${lessonId}`, ) if (!nexboardAttachment.length) { - const nexboardProject = await api.post(`/nexboard/projects`, { + const nexboardProject = await serverApi.post(`/nexboard/projects`, { // title, }) - nexboardAttachment = await api.post("/editor/attachments", { + nexboardAttachment = await serverApi.post("/editor/attachments", { key: "nexboard", - value: nexboardProject.id, + value: nexboardProject._id, lesson: lessonId, }) } else { nexboardAttachment = nexboardAttachment[0] } - const board = await api.post(`/nexboard/boards`, { + const board = await serverApi.post(`/nexboard/boards`, { title, projectId: nexboardAttachment.value, // description, @@ -28,5 +28,5 @@ export const createBoard = async (lessonId, title) => { } export const getBoard = id => { - return api.get(`/nexboard/boards/${id}`) + return serverApi.get(`/nexboard/boards/${id}`) } diff --git a/src/plugins/notes/Renderer.jsx b/src/plugins/notes/Renderer.jsx index 386d03643..fc78005d0 100644 --- a/src/plugins/notes/Renderer.jsx +++ b/src/plugins/notes/Renderer.jsx @@ -10,7 +10,7 @@ const Text = styled.p` const TextWrapper = styled.div` background-color: rgb(250, 250, 250); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23); - z-index: 50; + z-index: 4; transition: 250ms all ease-in-out; opacity: ${props => (props.visible ? 1 : 0)}; pointer-events: ${props => (props.visible ? "all" : "none")}; @@ -62,7 +62,7 @@ const Arrow = styled.div` transform: translate(-100%, -50%); overflow: hidden; background-color: transparent; - z-index: 51; + z-index: 5; &::after { content: ""; diff --git a/src/utils/api.js b/src/utils/api.js index 22e3ee8d7..6bdaaf077 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -1,22 +1,23 @@ import axios from "axios" import { getCookie } from "~/utils/cookie" import config from "~/config" +import { jwt } from "./jwt" // EXAMPLE: // 1. normal get request // api.get('/editor/lessons/123').then(data => { -// console.log(data) +// console.info(data) // }) // // 2. post request with body // api.post('/editor/lessons/123', { name: 'Augustiner' }).then(data => { -// console.log(data) +// console.info(data) // }) // // 3. post request with body with an error // api.post('/editor/sections/456', { name: 'Augustiner' }) // .then(data => { -// console.log(data) +// console.info(data) // }) // .catch(err => { // console.error(err) @@ -26,164 +27,175 @@ import config from "~/config" // api.post('/editor/sections/456', { name: 'Whatever' }, { picture: store.picture }) // .then(data => { // // picture will be sent as FormData -// console.log(data) +// console.info(data) // } // ) -const BACKEND_URL = BACKEND_URL || "" + +axios.defaults.headers.common.Authorization = jwt +axios.defaults.headers.common['Content-Type'] = 'application/json' + +const SERVER_API_URL = config.SERVER_API_URL || "" +const EDITOR_API_URL = config.EDITOR_API_URL || "" const bodyRequest = ( - type, - endpoint, - body, - files, - uploadProgress, - fakeResponse, + type, + baseURL, + endpoint, + body, + files, + uploadProgress, + fakeResponse, ) => { - if (fakeResponse && config.DISABLE_BACKEND) { - return new Promise(resolve => - setTimeout(() => resolve(fakeResponse), 250), - ) - } - - return new Promise((resolve, reject) => { - let data - - if (files) { - data = new FormData() - - Object.keys(body).forEach(key => { - data.append(key, body[key]) - }) - - Object.keys(files).forEach(key => { - data.append(key, files[key]) - }) - } else { - data = body - } - axios[type](endpoint, data, { - baseURL: BACKEND_URL || "http://localhost:3030", // TODO include test system? staging? - headers: { - "Content-Type": "application/json", - Authorization: - (getCookie("jwt").startsWith("Bearer ") ? "" : "Bearer ") + - getCookie("jwt"), - }, - onUploadProgress: + if (fakeResponse && config.DISABLE_BACKEND) { + return new Promise(resolve => + setTimeout(() => resolve(fakeResponse), 250), + ) + } + + return new Promise((resolve, reject) => { + let data + + if (files) { + data = new FormData() + + Object.keys(body).forEach(key => { + data.append(key, body[key]) + }) + + Object.keys(files).forEach(key => { + data.append(key, files[key]) + }) + } else { + data = body + } + + axios[type](endpoint, data, { + baseURL, // TODO include test system? staging?‚ + onUploadProgress: uploadProgress && typeof uploadProgress === "function" - ? uploadProgress - : undefined, - }) - .then(result => { - resolve(result.data) - }) - .catch(err => { - if ( - err && + ? uploadProgress + : undefined, + }) + .then(result => { + resolve(result.data) + }) + .catch(err => { + if ( + err && err.response && err.response.data && err.response.data.error - ) { - err.description = err.response.data.error - reject(err) - } else { - reject(err) - } - }) - }) + ) { + err.description = err.response.data.error + reject(err) + } else { + reject(err) + } + }) + }) } -const api = { - get: (endpoint, fakeResponse) => { - if (fakeResponse && config.DISABLE_BACKEND) { - return new Promise(resolve => - setTimeout(() => resolve(fakeResponse), 250), - ) - } - - return new Promise((resolve, reject) => { - axios - .get(endpoint, { - baseURL: BACKEND_URL || "http://localhost:3030", // TODO include test system? staging? - headers: { - Authorization: - (getCookie("jwt").startsWith("Bearer ") - ? "" - : "Bearer ") + getCookie("jwt"), - }, - }) - .then(result => resolve(result.data)) - .catch(err => { - if ( - err && +class Api { + + constructor( baseURL ) { + this.baseURL = baseURL + } + + get (endpoint, fakeResponse) { + if (fakeResponse && config.DISABLE_BACKEND) { + return new Promise(resolve => + setTimeout(() => resolve(fakeResponse), 250), + ) + } + + return new Promise((resolve, reject) => { + axios + .get(endpoint, { + baseURL: this.baseURL, + }) + .then(result => resolve(result.data)) + .catch(err => { + if ( + err && err.response && err.response.data && err.response.data.error - ) { - err.description = err.response.data.error - reject(err) - } else { - reject(err) - } - }) - }) - }, - - post: (endpoint, body, files, uploadProgress, fakeResponse) => - bodyRequest( - "post", - endpoint, - body, - files, - uploadProgress, - fakeResponse, - ), - put: (endpoint, body, files, uploadProgress, fakeResponse) => - bodyRequest("put", endpoint, body, files, uploadProgress, fakeResponse), - patch: (endpoint, body, files, uploadProgress, fakeResponse) => - bodyRequest( - "patch", - endpoint, - body, - files, - uploadProgress, - fakeResponse, - ), - delete: (endpoint, fakeResponse) => { - if (fakeResponse && process.env.NODE_ENV !== "production") { - return new Promise(resolve => - setTimeout(() => resolve(fakeResponse), 250), - ) - } - - return new Promise((resolve, reject) => { - axios - .delete(endpoint, { - baseURL: BACKEND_URL || "http://localhost:3030", // TODO include test system? staging? - headers: { - Authorization: + ) { + err.description = err.response.data.error + reject(err) + } else { + reject(err) + } + }) + }) + } + + post (endpoint, body, files, uploadProgress, fakeResponse) { + return bodyRequest( + "post", + this.baseURL, + endpoint, + body, + files, + uploadProgress, + fakeResponse, + ) + } + + put (endpoint, body, files, uploadProgress, fakeResponse) { + return bodyRequest("put", this.baseURL, endpoint, body, files, uploadProgress, fakeResponse) + } + + patch (endpoint, body, files, uploadProgress, fakeResponse){ + return bodyRequest( + "patch", + this.baseURL, + endpoint, + body, + files, + uploadProgress, + fakeResponse, + ) + } + + delete (endpoint, fakeResponse) { + if (fakeResponse && process.env.NODE_ENV !== "production") { + return new Promise(resolve => + setTimeout(() => resolve(fakeResponse), 250), + ) + } + + return new Promise((resolve, reject) => { + axios + .delete(endpoint, { + baseURL: this.baseURL, // TODO include test system? staging? + headers: { + Authorization: (getCookie("jwt").startsWith("Bearer ") - ? "" - : "Bearer ") + getCookie("jwt"), - }, - }) - .then(result => resolve(result.data)) - .catch(err => { - if ( - err && + ? "" + : "Bearer ") + getCookie("jwt"), + }, + }) + .then(result => resolve(result.data)) + .catch(err => { + if ( + err && err.response && err.response.data && err.response.data.error - ) { - err.description = err.response.data.error - reject(err) - } else { - reject(err) - } - }) - }) - }, + ) { + err.description = err.response.data.error + reject(err) + } else { + reject(err) + } + }) + }) + } } -export default api +export default Api + +export const serverApi = new Api( SERVER_API_URL) +export const editorApi = new Api( EDITOR_API_URL) diff --git a/src/utils/cache.js b/src/utils/cache.js index 4e28caac5..78612ffe0 100644 --- a/src/utils/cache.js +++ b/src/utils/cache.js @@ -1,12 +1,33 @@ -export function saveEditorData(data, lessonId) { - localStorage.setItem("EDITOR_DATA-" + lessonId, JSON.stringify(data)) +const EDITOR_LESSON_DATA = 'EDITOR_LESSON_DATA' +const EDITOR_SECTION_DATA = 'EDITOR_SECTION_DATA' + +export function saveLessonCache(lesson) { + localStorage.setItem(`${EDITOR_LESSON_DATA}-${lesson._id}`, JSON.stringify(lesson)) +} + +export function loadLessonCache(lessonId) { + const lesson = localStorage.getItem(`${EDITOR_LESSON_DATA}-${lessonId}`) + if (lesson) { + return JSON.parse(lesson) + } + + return {} +} + +export function saveSectionCache(sections) { + const array = Array.isArray(sections) ? sections : [sections]; + array.forEach((section) => { + localStorage.setItem(`${EDITOR_SECTION_DATA}-${section._id}`, JSON.stringify(section)) + }) } -export function loadEditorData(lessonId) { - const savedData = localStorage.getItem("EDITOR_DATA-" + lessonId) - if (savedData) { - return JSON.parse(savedData) - } +export function loadSectionCache(...sectionIds) { + const sections = sectionIds.map(id => { + const data = localStorage.getItem(`${EDITOR_SECTION_DATA}-${id}`) + if (data) { + return JSON.parse(data) + } + }) - return {} + return sections } diff --git a/src/utils/crypto.js b/src/utils/crypto.js new file mode 100644 index 000000000..dfdb8302d --- /dev/null +++ b/src/utils/crypto.js @@ -0,0 +1,5 @@ +import { sha1 } from 'object-hash' + +export const generateHash = (data) => { + return sha1(data) +} \ No newline at end of file diff --git a/src/utils/dispatch.js b/src/utils/dispatch.js new file mode 100644 index 000000000..18084d657 --- /dev/null +++ b/src/utils/dispatch.js @@ -0,0 +1,109 @@ + +import * as Sentry from '@sentry/browser' +// import { initialState } from "~/Contexts/User"; +// import { useReducer } from "react"; +// import { isRedirect } from "@reach/router"; + + +/** + * allows to add Middleware, which exectuted before or instead the react dispatcher. + * Middelwares get access to state and dispatch and called in order of declaration. + * + * Main structur of a Middleware has to be: + * function myMiddelare (options){ + * return ({state, dispatch}) => next => action => { + * //my action + * next(action); + * } + * } + * + * As example take a look at thunkMiddleware + * + * @param {...function} middlewares - inspieret by redux middleware, for example take a lock at thunkMiddleware + * + * @return {function} + * @param {function} dispatch - react hook dispatcher function + * @param {Object} state - react hook state + */ +export const prepareCreateDispatch = (...middlewares) => { + + + if(middlewares.length === 0){ + return (dispatch) => dispatch + } + + let isPreparing = true + + let dispatch = () => { + throw new Error( + 'Dispatching while constructing your middleware is not allowed. ' + + 'Other middleware would not be applied to this dispatch.' + ) + } + + const MiddlewareApi = { + state: null, + getState: function(){return MiddlewareApi.state}, + dispatch: (action) => dispatch(action) + } + + // obeject given to the middleware functions, is needed to refence the current state object + // if the middleware calls state as ({state, dispatch}) state is not referenced to the current object + // and stays on the old value, for this and for compatibility with redux plugins the function getState + // retruns allways the current state + const preparedDispatcher = middlewares + // maps state and dispatch to every Middleware + // this is important to give every middleware the new dispatcher and not the old one + .map((a) => a( MiddlewareApi )) + // returns a function where each calls a(b(...args)), when called the chian will build and + // the last function get the argument, the function is called with... here it is the original dispatcher + .reduce((a,b) => (...args) => a(b(...args))) + + return (rdispatch, state) => { + + // set state on all state changes and reflect it to the middleware functions + MiddlewareApi.state = state + + if(isPreparing){ + dispatch = preparedDispatcher(rdispatch) + isPreparing = false + } + + return MiddlewareApi.dispatch + } + +} + +/** + * Allow to run async actions by returning a function witch accept {state, dispatch} as paramter + * Could be added to dispatcher by createDispatch + * + * Funktions have to look like: + * const myAction => (payload) => ({state, dispatch}){ + * // do somthing with payload and call dispatcher + * } + * + * + * The function is ispired by thunkMiddelware for redux + * https://www.npmjs.com/package/redux-thunk + */ +export const thunkMiddleware = ({getState, dispatch}) => (next) => action => { + if(typeof action === 'function'){ + return action({state: getState(), dispatch}) + } + return next(action) +} + + +/** + * Check if action type contains ERROR, FAILED, FAILURE or WARNING + * and send a message to sentry if it does + */ +export const sentryMiddleware = ({getState, dispatch}) => (next) => action => { + if( /(ERROR|FAILED|FAILURE|WARNING)/i.test(action.type) ) { + Sentry.captureMessage(JSON.stringify(action)) + // TODO: check if state could also send to sentry or user data has been filtered + } + + next(action); +} \ No newline at end of file diff --git a/src/utils/dispatch.test.helper.js b/src/utils/dispatch.test.helper.js new file mode 100644 index 000000000..dc72e9702 --- /dev/null +++ b/src/utils/dispatch.test.helper.js @@ -0,0 +1,54 @@ +import React, { useReducer, createContext } from 'react' +import { prepareCreateDispatch } from '~/utils/dispatch' + + +const initState = { + test: 'failed', + switch: false +} + +const reducer = (state, {type, payload}) => { + switch(type){ + case 'MIDDLEWARE': + return { + ...state, + test: payload + } + case 'SOME_OTHER': + return { + ...state, + test: payload + } + case 'SWITCH': + const newState = { + ...state, + ...payload + } + return newState + default: + return state + } +} + +export function TestComponent(props){ + return ( +
+ ) +} + +export const createProvider = (...middlewares) => { + + const Context = createContext() + + const createDispatch = prepareCreateDispatch(...middlewares) + + return function Provider(){ + const [state, reactDispatch] = useReducer(reducer, initState) + const dispatch = createDispatch(reactDispatch, state) + return ( + + + + ) + } +} \ No newline at end of file diff --git a/src/utils/dispatch.test.js b/src/utils/dispatch.test.js new file mode 100644 index 000000000..928ffb23b --- /dev/null +++ b/src/utils/dispatch.test.js @@ -0,0 +1,196 @@ +import React, { useReducer, createContext, useEffect } from 'react' +import test from 'ava' +import renderer from 'react-test-renderer' + +import { thunkMiddleware } from './dispatch' +import { createProvider, TestComponent } from './dispatch.test.helper' + + +const middleware = ({state, dispatch}) => { + return next => { + return action => { + if(action.type === 'TEST'){ + return dispatch({ + type: 'MIDDLEWARE', + payload: 'success' + }) + } + return next(action) + } + } +} + + +const preMiddleware = (type) => { + return ({state, dispatch}) => next => action => { + if(action.type === type){ + return dispatch({ + type: 'TEST' + }) + } + + return next(action) + } +} + +const postMiddleware = (payload) => { + return ({state, dispatch}) => next => + { + return action => { + if(action.type === 'MIDDLEWARE'){ + return dispatch({ + type: 'SOME_OTHER', + payload: payload + }) + } + + return next(action) + } + } +} + +const someOtherMiddleware = ({state, dispatch}) => next => +{ + return action => { + return next(action) + } +} + + +test('without middelware', t => { + + const Provider = createProvider() + + const rendered = renderer.create() + const renderedInstance = rendered.root + + const comp = renderedInstance.findByType(TestComponent) + + comp.props.dispatch({type: 'MIDDLEWARE', payload: 'without middleware'}) + t.is(comp.props.state.test, 'without middleware') + comp.props.dispatch({type: 'SOME_OTHER', payload: 'haha'}) + t.is(comp.props.state.test, 'haha') + + +}) + +test('add dispatch middleware and execute', t => { + + const Provider = createProvider(middleware) + + const rendered = renderer.create() + const renderedInstance = rendered.root + + const comp = renderedInstance.findByType(TestComponent) + + comp.props.dispatch({type: 'TEST'}) + t.is(comp.props.state.test, 'success') + comp.props.dispatch({type: 'SOME_OTHER', payload: 'haha'}) + t.is(comp.props.state.test, 'haha') + + +}) + +test('test dispatch is everytime looped through middlewares', t => { + + const Provider = createProvider(preMiddleware('HUNZ'), middleware) + + const rendered = renderer.create() + const renderedInstance = rendered.root + + const comp = renderedInstance.findByType(TestComponent) + + comp.props.dispatch({type: 'HUNZ'}) + t.is(comp.props.state.test, 'success') + +}) + +test('test adding 4 middlewares', t => { + + const Provider = createProvider(preMiddleware('HUNZ'), middleware, someOtherMiddleware, postMiddleware('blub')) + + const rendered = renderer.create() + const renderedInstance = rendered.root + + const comp = renderedInstance.findByType(TestComponent) + + comp.props.dispatch({type: 'HUNZ'}) + t.is(comp.props.state.test, 'blub') +}) + +/** + **************************************** + * ** + * ** Test for thunk middleware + * ** + **************************************** + **/ + +const asyncFu = (test) => async ({dispatch, state}) => { + + const payload = await new Promise((resolve, reject) => { + setTimeout(() => { + resolve({ + test, + switch: !state.switch, + }) + }, 100) + }) + + dispatch({ + type: 'SWITCH', + payload + }) + + return payload +} + +const asyncOnlyLastChar = ( test ) => async ({dispatch}) => { + const payload = await new Promise((resolve) => { + setTimeout(async () => { + const sliced = test.slice(-1) + const payload = await dispatch(asyncFu(sliced)) + resolve(payload) + }, 10) + }) + + return payload +} + +test('test thunkMiddleware', async t => { + + const Provider = createProvider(thunkMiddleware) + + const rendered = renderer.create() + const renderedInstance = rendered.root + + const comp = renderedInstance.findByType(TestComponent) + const {state, dispatch} = comp.props + + const switchState = state.switch + const data = await dispatch(asyncFu('Affenmesserkampf!')) + t.is(data.switch, !switchState) + t.is(data.test, 'Affenmesserkampf!') + t.is(comp.props.state.switch, !switchState) + t.is(comp.props.state.test, 'Affenmesserkampf!') + +}) + +test('test thunkMiddleware async function call in async function', async t => { + + const Provider = createProvider(thunkMiddleware) + + const rendered = renderer.create() + const renderedInstance = rendered.root + + const comp = renderedInstance.findByType(TestComponent) + const {state, dispatch} = comp.props + + const switchState = state.switch + const data = await dispatch(asyncOnlyLastChar('Affenmesserkampf!')) + t.is(data.switch, !switchState) + t.is(data.test, '!') + t.is(comp.props.state.switch, !switchState) + t.is(comp.props.state.test, '!') + +}) \ No newline at end of file diff --git a/src/utils/errors.js b/src/utils/errors.js new file mode 100644 index 000000000..d0fdfad0a --- /dev/null +++ b/src/utils/errors.js @@ -0,0 +1,7 @@ +export class UserInformationError extends Error { + + constructor(err, userInfo){ + super(err); + this.message = userInfo + } +} \ No newline at end of file diff --git a/src/utils/fake.js b/src/utils/fake.js index db0d54c89..8ad6c1f5c 100644 --- a/src/utils/fake.js +++ b/src/utils/fake.js @@ -1,105 +1,106 @@ import uuid from "uuid/v4" export const lessonFakeData = { - _id: "TEST", - title: "vhkodft", - note: "", - sections: [ - { - _id: "5cd1528f7acaa04a5a7f9386", - visible: true, - note: "", - parent: null, - title: "", - flag: "isTemplate", - lesson: "5cd15282f1fe5772f05ef43c", - owner: { - _id: "5cd152827acaa04a5a7f9383", - users: ["0000d231816abba584714c9e"], - lesson: "5cd15282f1fe5772f05ef43c", - owner: "0000d231816abba584714c9e", - type: "group", - }, - permissions: [], - state: { - plugin: "rows", - state: [ - { - plugin: "text", - state: { - object: "value", - document: { - object: "document", - data: {}, - nodes: [ - { - object: "block", - type: "paragraph", - data: {}, - nodes: [ - { - object: "text", - leaves: [ - { - object: "leaf", - text: + _id: "5d6010ab2e10bd00131e2e71", + title: "Nur ein Test", + courseId: "5d513167807ca90013ebcd22", + note: "", + sections: [ + { + _id: "5cd1528f7acaa04a5a7f9386", + visible: true, + note: "", + parent: null, + title: "", + flag: "isTemplate", + lesson: "5cd15282f1fe5772f05ef43c", + owner: { + _id: "5cd152827acaa04a5a7f9383", + users: ["0000d231816abba584714c9e"], + lesson: "5cd15282f1fe5772f05ef43c", + owner: "0000d231816abba584714c9e", + type: "group", + }, + permissions: [], + state: { + plugin: "rows", + state: [ + { + plugin: "text", + state: { + object: "value", + document: { + object: "document", + data: {}, + nodes: [ + { + object: "block", + type: "paragraph", + data: {}, + nodes: [ + { + object: "text", + leaves: [ + { + object: "leaf", + text: "Herzlich Willkommen in der Alpha-Version des neuen Themen-Werkzeugs!\n\nDas ist das Grundgerüst für den komplett überarbeiteten Themen-Editor. Schon in dieser frühen Entwicklungsphase freuen wir uns über Feedback zu den vorhandenen Funktionen, um diese zu verbessern und zu erweitern. Bitte beachte: Es wird nichts gespeichert, das ist eine reine Spielwiese.\n\nProbier es aus und gib uns formloses Feedback - jedes kleine bisschen hilft!", - marks: [], - }, - ], - }, - ], - }, - ], - }, - }, - }, - ], - }, - type: "section", - }, - ], - type: "lesson", - users: { - _id: "5cd152827acaa04a5a7f9384", - users: [], - lesson: "5cd15282f1fe5772f05ef43c", - owner: "0000d231816abba584714c9e", - type: "group", - }, - owner: { - _id: "5cd152827acaa04a5a7f9383", - users: [ - { - userId: "0000d231816abba584714c9e", - name: "Cord Carl", - roles: ["teacher"], - }, - ], - lesson: "5cd15282f1fe5772f05ef43c", - owner: "0000d231816abba584714c9e", - type: "group", - }, + marks: [], + }, + ], + }, + ], + }, + ], + }, + }, + }, + ], + }, + type: "section", + }, + ], + type: "lesson", + users: { + _id: "5cd152827acaa04a5a7f9384", + users: [], + lesson: "5cd15282f1fe5772f05ef43c", + owner: "0000d231816abba584714c9e", + type: "group", + }, + owner: { + _id: "5cd152827acaa04a5a7f9383", + users: [ + { + userId: "0000d231816abba584714c9e", + name: "Cord Carl", + roles: ["teacher"], + }, + ], + lesson: "5cd15282f1fe5772f05ef43c", + owner: "0000d231816abba584714c9e", + type: "group", + }, } export const getFakeSection = (lessonId = "5cd15282f1fe5772f05ef43c") => { - return { - _id: uuid(), - visible: true, - note: "", - parent: null, - title: "", - flag: "isTemplate", - lesson: lessonId, - owner: { - _id: "5cd152827acaa04a5a7f9383", - users: ["0000d231816abba584714c9e"], - lesson: "5cd15282f1fe5772f05ef43c", - owner: "0000d231816abba584714c9e", - type: "group", - }, - permissions: [], - state: {}, - type: "section", - } + return { + _id: uuid(), + visible: true, + note: "", + parent: null, + title: "", + flag: "isTemplate", + lesson: lessonId, + owner: { + _id: "5cd152827acaa04a5a7f9383", + users: ["0000d231816abba584714c9e"], + lesson: "5cd15282f1fe5772f05ef43c", + owner: "0000d231816abba584714c9e", + type: "group", + }, + permissions: [], + state: {}, + type: "section", + } } diff --git a/src/utils/jwt.js b/src/utils/jwt.js new file mode 100644 index 000000000..57b906aa5 --- /dev/null +++ b/src/utils/jwt.js @@ -0,0 +1,3 @@ +import { getCookie } from "~/utils/cookie" + +export const jwt = (getCookie("jwt").startsWith("Bearer ") ? "" : "Bearer ") + getCookie("jwt"); \ No newline at end of file diff --git a/src/utils/promise.js b/src/utils/promise.js new file mode 100644 index 000000000..dd1e00df1 --- /dev/null +++ b/src/utils/promise.js @@ -0,0 +1,13 @@ + +export const bindAllSettledToPromise = () => { + if(typeof Promise.allSettled !== 'function'){ + + Promise.allSettled = (proms) => Promise.all(proms.map((prom) => + prom.then( + value => ({value, status: 'fulfilled'}), + error => ({reason: error, status: 'rejected'}) + ))) + } + + return Promise.allSettled +} \ No newline at end of file diff --git a/src/utils/reducer.js b/src/utils/reducer.js new file mode 100644 index 000000000..7af92d452 --- /dev/null +++ b/src/utils/reducer.js @@ -0,0 +1,34 @@ +/** + * Maps Object from the backend to the needed section attribute + * @param {Object} section - section object sended from the backend + */ +export const mapSection = (section) => { + return { + ...section, + id: section._id, // needed for old version, please use _id instead + docValue: (section.state && Object.keys(section.state).length !== 0) + ? section.state + : { plugin: "rows" }, + savedDocValue: section.state, // value of docValue that is saved on the backend, needed for creating diff when docValue was changed + notes: section.note, + visible: section.visible || true, // TODO: remove should be set by server and blur mode should removed + } +} + + +/** + * Copies an array and runs splice on it. + * The copie of the array is retruned, not the spliced elements + * + * @param {any[]} array - array that need a copie and splice should called on + * @param {Integer} start - start postion in array + * @param {Integer} deleteCount - elements to delete + * @param {...any} item - elements to add + * + * @returns {any[]} - new Array with all object without the spliced ones + */ +export const invertSplice = (array, start, deleteCount, ...item) => { + const newArrayWithAddedSectinstate = [...array] + newArrayWithAddedSectinstate.splice(start, deleteCount, ...item) + return newArrayWithAddedSectinstate +} \ No newline at end of file diff --git a/src/utils/socket.js b/src/utils/socket.js new file mode 100644 index 000000000..750ab4a07 --- /dev/null +++ b/src/utils/socket.js @@ -0,0 +1,73 @@ +import io from 'socket.io-client' +import { jwt } from './jwt' +import { useContext } from 'react' +import LessonContext from "~/Contexts/Lesson.context" +import config from "~/config" + +const EDITOR_SOCKET_URL = config.EDITOR_SOCKET_URL || "" + + +// const { store, dispatch } = useContext(LessonContext) + +class Socket { + + constructor(url, authorization){ + this.url = url + this.socket = io(url) + this.isConnected = false + + this.socket.on('connect', () => { + this.authorization(authorization) + this.isConnected = this.socket.connected + }) + + this.socket.on('reconnect', () => { + this.authorization(authorization) + this.isConnected = this.socket.connected + }) + + this.socket.on('disconnect', () => { + this.isConnected = this.socket.connected + }) + + this.socket.on('error', (error) => { + console.error(error) + /* dispatch({ + type: 'ERROR', + payload: 'Die Verbindung zum Server konnte nicht aufrecht erhalten werden' + }) */ + }) + } + + + async authorization(token){ + try { + await this.emit('authorization', { + token, + }) + } catch (err) { + /* dispatch({ + type: 'ERROR', + payload: 'Die Authentifizierung ist fehlgeschlagen. Bitte melde dich an' + }) */ + } + } + + on(...params){ + this.socket.on(...params) + return this + } + + emit(...params){ + return new Promise((resolve, reject) => { + this.socket.emit(...params, (error, message) => { + if(error) return reject(error) + return resolve(message) + }) + }) + } +} + +export const editorWS = new Socket(EDITOR_SOCKET_URL, jwt) + +export default Socket diff --git a/src/workspace/Feedback.jsx b/src/workspace/Feedback.jsx deleted file mode 100644 index ef89c8732..000000000 --- a/src/workspace/Feedback.jsx +++ /dev/null @@ -1,64 +0,0 @@ -import React from "react" - -import styled, { keyframes } from "styled-components" -import Button from "~/components/Button" - -const StyledLink = styled.a` - &::after { - display: none; - } -` - -const anim = keyframes` - 0% { - transform: scale(0.85); - opacity: 0.8; - } - - 50% { - transform: scale(1.05); - opacity: 1; - } - - 100% { - transform: scale(1); - opacity: 1; - } -` - -const FeedbackBtn = styled(Button)` - animation-name: ${anim}; - position: fixed; - bottom: 50px; - right: 50px; - z-index: 9999999; - animation-play-state: running; - animation-duration: 1000ms; - animation-iteration-count: 5; - animation-direction: alternate; - animation-timing-function: ease-in-out; - box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2), 0 3px 6px rgba(0, 0, 0, 0.36); - background-color: #f6a800; - border-color: #f6a800; - z-index: 9999999; - - &:hover, - &:focus, - &:visited, - &:active { - background-color: #f6a800; - border-color: #f6a800; - } -` - -const Feedback = () => { - return ( - - - Gib uns Feedback! - - - ) -} - -export default Feedback diff --git a/src/workspace/Lesson/Header/Back.jsx b/src/workspace/Lesson/Header/Back.jsx index 61b40d6e7..50d36fd65 100644 --- a/src/workspace/Lesson/Header/Back.jsx +++ b/src/workspace/Lesson/Header/Back.jsx @@ -1,33 +1,36 @@ import React from "react" import styled from "styled-components" -import Flex from "~/components/Flex" - +import BaseButton from "~/components/Button/BaseButton" +import ArrowIcon from "~/assets/arrow-back.svg" +/* const StyledBack = styled(Flex)` background-color: #af0437; padding: 10px; height: 100%; cursor: pointer; ` +*/ + +const Back = ({theme}) => { + const currentUrl = window.location.href + const currentBaseURL = (/^((https|http):\/\/[\w\d:.-]+)/.exec(currentUrl) || [])[0] + const regexResult = /courses\/([a-f0-9]{24})\/topics\/([a-f0-9]{24})/.exec(currentUrl) + let jumpUrl = '/'; + + if (Array.isArray(regexResult) && regexResult[1]) { + jumpUrl = `${currentBaseURL}/courses/${regexResult[1]}` + } -const Back = () => { - return ( - { - window.location.href = window.location.href.replace( - "?edtr=true", - "", - ) - }}> - - - ) + return ( + { + window.location.href = jumpUrl + }}> + + + ) } export default Back diff --git a/src/workspace/Lesson/Header/BreadCrumbs.jsx b/src/workspace/Lesson/Header/BreadCrumbs.jsx index 2d5b130ed..712c6d58c 100644 --- a/src/workspace/Lesson/Header/BreadCrumbs.jsx +++ b/src/workspace/Lesson/Header/BreadCrumbs.jsx @@ -1,82 +1,80 @@ import React, { useState, useEffect } from "react" import styled from "styled-components" -import api from "~/utils/api" - import Action from "~/components/Action" import Flex from "~/components/Flex" import Input from "~/components/Input" +import { changeLessonTitle } from "~/Contexts/lesson.actions" +// TODO: width: 170px; should not set fix, take length of Input const TitleInput = styled(Input)` - font-weight: 700; - width: 150px; - margin-top: 0px; + font-weight: 700; + width: 170px; + margin-top: 0px; ` const StyledCrumb = styled(Flex)` - @media (max-width: 900px) { - display: none; - } + @media (max-width: 900px) { + display: none; + } ` const Crumb = ({ to, caption }) => { - return ( - - - {caption} - + return ( + + + {caption} +    - {"/"} + {"/"}    - - ) + + ) } - const BreadCrumbs = ({ store, dispatch }) => { - const courseId = window.location.pathname.split("/")[2] - const [crumbData, setCrumbData] = useState({ - crumbs: [ - { caption: "Meine Kurse", to: "/courses" }, - { - caption: store.course.name || "Kurs", - to: `/courses/${courseId}`, - }, - ], - }) - - const updateTitle = async (value) => { + const { + lesson: { _id: lessonId }, + course, + } = store + const [crumbData, setCrumbData] = useState({ + crumbs: [ + { caption: "Meine Kurse", to: "/courses" }, + { + caption: store.course.name || "Kurs", + to: `/courses/${course._id}`, + }, + ], + }) - dispatch({ - type: "LESSON_TITLE_CHANGE", - payload: value, - }) - } + const updateTitle = async (title) => { + dispatch(changeLessonTitle(title)); + } - useEffect(() => { - setCrumbData({ - crumbs: crumbData.crumbs.map((el, i) => { - if (i !== 1) return el - return { ...el, caption: store.course.name || "Kurs" } - }), - }) - }, [store.course.name]) + useEffect(() => { + setCrumbData({ + crumbs: crumbData.crumbs.map((el, i) => { + if (i !== 1) return el + return { ...el, caption: store.course.name || "Kurs" } + }), + }) + }, [store.course.name]) - return ( - - {crumbData.crumbs.map(c => ( - - ))} - - - ) + return ( + + {crumbData.crumbs.map(c => ( + + ))} + + + ) } export default BreadCrumbs diff --git a/src/workspace/Lesson/Header/Settings/Content.jsx b/src/workspace/Lesson/Header/Settings/Content.jsx index a80adf825..d27bf6efa 100644 --- a/src/workspace/Lesson/Header/Settings/Content.jsx +++ b/src/workspace/Lesson/Header/Settings/Content.jsx @@ -5,6 +5,8 @@ import qs from "qs" import Action from "~/components/Action" import Flex from "~/components/Flex" +import EyeSVG from "~/assets/eye-red.svg" + const Wrapper = styled(Flex)` padding: 15px; right: 0; @@ -15,7 +17,7 @@ const Wrapper = styled(Flex)` opacity: ${props => (props.visible ? 1 : 0)}; transition: 250ms all ease-in-out; background-color: #fff; - z-index: 100; + z-index: 2; box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1), 0 3px 6px rgba(0, 0, 0, 0.18); border-radius: 5px 0px 0px 5px; @@ -32,19 +34,33 @@ const ActionWrapper = styled.div` const StyledAction = styled(Action)` display: flex; align-items: center; + cursor: pointer; ` -const StyledIcon = styled.img` - width: 24px; - cursor: pointer; - margin-left: 10px; +const StyledText = styled.span` + margin-right: 7px; ` const Settings = ({ store, visible }) => { - const q = qs.parse(window.location.search, { ignoreQueryPrefix: true }) + const q = qs.parse(window.location.search, { ignoreQueryPrefix: true }) - const studentQuery = qs.stringify({ ...q, student_view: true }) + const studentQuery = qs.stringify({ ...q, student_view: true }) + return ( + + {!store.studentView && ( + + + Schüleransicht + + + + )} + + ) + // code that is uses later + /* return ( @@ -53,7 +69,7 @@ const Settings = ({ store, visible }) => { - {!store.studentView && ( + {!store.view.studentView && ( @@ -64,6 +80,7 @@ const Settings = ({ store, visible }) => { )} ) + */ } export default Settings diff --git a/src/workspace/Lesson/Header/Settings/index.jsx b/src/workspace/Lesson/Header/Settings/index.jsx index 14585eb30..08d7424dc 100644 --- a/src/workspace/Lesson/Header/Settings/index.jsx +++ b/src/workspace/Lesson/Header/Settings/index.jsx @@ -2,54 +2,46 @@ import React, { useState, useEffect } from "react" import styled from "styled-components" import Flex from "~/components/Flex" +import BaseButton from "~/components/Button/BaseButton" +import SettingsIcon from "~/assets/header-settings.svg" import Content from "./Content" -const StyledSettings = styled(Flex)` - background-color: #af0437; - padding: 10px 0; - height: 100%; - margin-left: 15px; - cursor: pointer; -` - function useResizeListener(visible, setVisible, store) { - function resizeListener() { - if (visible && window.innerWidth < 1250) { - setVisible(false) - } - - if (!visible && window.innerWidth > 1250) { - setVisible(true) - } - } - - useEffect(() => { - if (window.innerWidth > 1250 && !store.bootstrapFinished) { - setVisible(true) - } - - // window.addEventListener("resize", resizeListener) - // return () => window.removeEventListener("resize", resizeListener) - }, [visible]) + function resizeListener() { + if (visible && window.innerWidth < 1250) { + setVisible(false) + } + + if (!visible && window.innerWidth > 1250) { + setVisible(true) + } + } + + useEffect(() => { + if (window.innerWidth > 1250 && !store.view.bootstrapFinished) { + setVisible(true) + } + + // window.addEventListener("resize", resizeListener) + // return () => window.removeEventListener("resize", resizeListener) + }, [visible]) } -const Settings = ({ store, dispatch }) => { - const [expanded, setExpanded] = useState(false) - useResizeListener(expanded, setExpanded, store) - return ( - - { - setExpanded(!expanded) - }} - /> - - - ) +const Settings = ({ store, theme }) => { + const [expanded, setExpanded] = useState(false) + useResizeListener(expanded, setExpanded, store) + return ( + { + setExpanded(!expanded) + }} + > + + + + ) } export default Settings diff --git a/src/workspace/Lesson/Header/index.jsx b/src/workspace/Lesson/Header/index.jsx index 1dadbf9d9..569a90b39 100644 --- a/src/workspace/Lesson/Header/index.jsx +++ b/src/workspace/Lesson/Header/index.jsx @@ -1,7 +1,7 @@ import React, { useContext, useEffect, useState } from "react" import styled, { css } from "styled-components" -import LessonContext from "~/Contexts/Lesson" +import LessonContext from "~/Contexts/Lesson.context" import Flex from "~/components/Flex" import Text from "~/components/Text" @@ -10,6 +10,7 @@ import { Toggle } from "~/components/Button" import Back from "./Back" import BreadCrumbs from "./BreadCrumbs" import Settings from "./Settings" +import { setEditing } from "~/Contexts/view.actions" const StyledHeader = styled(Flex)` position: fixed; @@ -18,11 +19,11 @@ const StyledHeader = styled(Flex)` background-color: #fff; width: 100vw; box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1), 0 3px 6px rgba(0, 0, 0, 0.18); - z-index: 200; + z-index: 3; &:hover .save-status { ${props => - props.editing && + props.editing && css` opacity: 1 !important; `} @@ -34,57 +35,91 @@ const SaveStatus = styled(Text)` margin-right: 25px; ` +const buttonTheme = { + background: "#af0437", + height: "55px", + padding: "10px", +} + +const smallButtonTheme = { + ...buttonTheme, + padding: "10px 0" +} + +const hasPermission = (sections = [], sectionId = '') => { + const section = sections.find(s => s._id.toString() === sectionId.toString()) || {}; + return section.scopePermission === 'write'; +} + const Header = () => { - const { store, dispatch } = useContext(LessonContext) - const [showSaveStatus, setShowSaveStatus] = useState(false) - - useEffect(() => { - let timeout - if (store.saveStatus === "Ungesicherte Änderungen") - return setShowSaveStatus(true) - if ( - store.saveStatus === "Gespeichert" || - store.saveStatus === "Lokal Gespeichert" - ) - timeout = setTimeout(() => setShowSaveStatus(false), 1500) - - return () => clearTimeout(timeout) - }, [store.saveStatus]) - - return ( - - - - - - - - - {store.saveStatus} - - {!store.studentView && ( - { - dispatch({ type: "SET_EDITING", payload: newValue }) - }} - /> - )} - - - - ) + const { store, dispatch } = useContext(LessonContext) + const [showSaveStatus, setShowSaveStatus] = useState(false) + + const { + notifications:{ + saveStatus, + }, + view: { + editing, + studentView, + activeSectionId, + }, + sections + } = store + + // TODO: do not work re-implement + useEffect(() => { + let timeout + if (saveStatus === "Ungesicherte Änderungen") + return setShowSaveStatus(true) + if ( + saveStatus === "Gespeichert" || + saveStatus === "Lokal Gespeichert" + ) + timeout = setTimeout(() => setShowSaveStatus(false), 1500) + + return () => clearTimeout(timeout) + }, [saveStatus]) + + const editPermission = hasPermission(sections, activeSectionId); + const showEditToggle = editPermission && !studentView; + // TODO: is disabled for the moment + const enabled = false; + + return ( + + + + + + + + {enabled && ( + {saveStatus} + )} + {showEditToggle && ( + { + dispatch(setEditing(newValue)) + }} + /> + )} + + + + ) } export default Header diff --git a/src/workspace/Lesson/Section/Controls.jsx b/src/workspace/Lesson/Section/Controls.jsx index 44170c7e6..b09f49e4c 100644 --- a/src/workspace/Lesson/Section/Controls.jsx +++ b/src/workspace/Lesson/Section/Controls.jsx @@ -4,53 +4,47 @@ import styled, { css } from "styled-components" import Flex from "~/components/Flex" import Action from "~/components/Action" import Container from "~/components/Container" -import Button from "~/components/Button" +import { setActiveSection } from "~/Contexts/view.actions" const StyledAction = styled(Action)` - ${props => - props.disabled && - css` - opacity: 0.6; - pointer-events: none; - cursor: not-allowed; + ${props => + props.disabled && + css` + opacity: 0.6; + pointer-events: none; + cursor: not-allowed; - &:hover { - text-decoration: none; - } - `} + &:hover { + text-decoration: none; + } + `} ` const Controls = ({ dispatch, prevId, nextId }) => { - return ( - - - { - prevId && - dispatch({ - type: "SET_ACTIVE_SECTION", - payload: { id: prevId }, - }) - }}> + return ( + + + { + prevId && + dispatch(setActiveSection(prevId)) + }}> ❮  Vorheriger Abschnitt - - { - nextId && - dispatch({ - type: "SET_ACTIVE_SECTION", - payload: { id: nextId }, - }) - }}> + + { + nextId && + dispatch(setActiveSection(nextId)) + }}> Nächster Abschnitt  ❯ - - - - ) + + + + ) } export default Controls diff --git a/src/workspace/Lesson/Section/Editor.jsx b/src/workspace/Lesson/Section/Editor.jsx index bf015c5d4..972e350d9 100644 --- a/src/workspace/Lesson/Section/Editor.jsx +++ b/src/workspace/Lesson/Section/Editor.jsx @@ -1,89 +1,150 @@ -import React, { useContext, useEffect } from "react" +import React, { useEffect, useState } from "react" import styled from "styled-components" import { - Editor as Edtr, - EditorContext, - useScopedSelector, - getPendingChanges, + Editor as Edtr, + useScopedDispatch, +// useScopedSelector } from "@edtr-io/core" -import { serializeRootDocument } from "@edtr-io/store" +/* +import { + focusNext, + focusPrevious, + persist, + redo, + reset, + undo, + hasPendingChanges as hasPendingChangesSelector +} from '@edtr-io/store' +*/ +import theme from "~/theme" +import { createTheme } from "./createTheme" -import { CustomTheme, ThemeProvider } from "@edtr-io/ui" +import { plugins } from "~/plugins" -import theme from "~/theme" -import plugins from "./plugins" -export { default as plugins } from "./plugins" +export const EdtrWrapper = styled.div` + min-height: 50px; + padding: 0 10px; + font-size: 1.3rem; + line-height: 1.4; + + svg{ + font-size: 1.4rem + } -export const EditorWrapper = styled.div` - min-height: 50px; - font-size: 20px; - line-height: 1.4; + .fa-4x{ + font-size: 3rem; + } - @media (max-width: 991px) { - font-size: 18px; - } + @media (max-width: 991px) { + font-size: 1.2rem; + } - @media (max-width: 768px) { - font-size: 18px; - } + @media (max-width: 768px) { + font-size: 1.2rem; + } - @media (max-width: 575px) { - font-size: 16px; - } + @media (max-width: 575px) { + font-size: 1.1rem; + } ` -export const editorTheme = { - editor: { - primary: { - background: theme.colors.primary, - }, - }, - plugins: { - rows: { - menu: { - highlightColor: theme.colors.primary, - dropzone: { - highlightColor: theme.colors.primary, - }, - }, - }, - text: { - hoverColor: "#B6B6B6", - }, - }, -} +/** + * props + * @param section + * @param editing + * @param onChange + * https://github.com/edtr-io/edtr-io/blob/master/api/core.api.md + */ +export const Editor = (props) => { + const children = React.useCallback((document) => { + return ( + + {document} + + ) + }) + + const [initialState, setInitialState] = useState(props.section.docValue) + useEffect(() => { + // if the user not in write mode, the edtr is updating + if(!props.editing){ + setInitialState(props.section.docValue) + } + }, [props.section.docValue]) -export default class Editor extends React.Component { - constructor(props) { - super(props) - this.docValue = - this.props.docValue && Object.keys(this.props.docValue).length - ? this.props.docValue - : { - plugin: "rows", - } + // TODO: onError pass to Edtr - this.onChange = this.onChange.bind(this) - } + const editable = props.section.scopePermission === 'write' && props.editing; + + return ( + + + {children} + + + ) +} +export default Editor - onChange({changed, getDocument}){ - this.props.dispatchChange(getDocument()) - } +/** + * props + * @param docValue + */ +function PlainEditorContainerInner(props) { + const dispatch = useScopedDispatch() + // const hasPendingChanges = useScopedSelector(hasPendingChangesSelector()) + useEffect(() => { + if(props.docValue && props.docValue.state){ + dispatch((scope) => ({ + type: 'SetPartialState', + scope, + payload: props.docValue + })) + } + }, [props.docValue]) - render() { - return ( - - - - - ) - } + return ( + +
{props.children}
+ {/* + + + */} +
+ ) } diff --git a/src/workspace/Lesson/Section/createTheme.js b/src/workspace/Lesson/Section/createTheme.js new file mode 100644 index 000000000..7466d9bc9 --- /dev/null +++ b/src/workspace/Lesson/Section/createTheme.js @@ -0,0 +1,20 @@ +export const createTheme = (theme) => ({ + editor: { + primary: { + background: theme.colors.primary, + }, + }, + plugins: { + rows: { + menu: { + highlightColor: theme.colors.primary, + dropzone: { + highlightColor: theme.colors.primary, + }, + }, + }, + text: { + hoverColor: "#B6B6B6", + }, + }, +}); \ No newline at end of file diff --git a/src/workspace/Lesson/Section/index.jsx b/src/workspace/Lesson/Section/index.jsx index 5346735b4..4668a7620 100644 --- a/src/workspace/Lesson/Section/index.jsx +++ b/src/workspace/Lesson/Section/index.jsx @@ -1,128 +1,146 @@ -import React, { useContext, useRef, useEffect } from "react" -import styled, { css } from "styled-components" +import React, { useContext, useRef, useState } from "react"; +import styled, { css } from "styled-components"; -import LessonContext from "~/Contexts/Lesson" +import LessonContext from "~/Contexts/Lesson.context"; +import Icon from "~/assets/chat-bubble.svg"; -import Flex from "~/components/Flex" -import Input from "~/components/Input" -import Text from "~/components/Text" -import Container from "~/components/Container" +import Flex from "~/components/Flex"; +import Text from "~/components/Text"; +import InfoBanner from "~/components/InfoBanner"; +import Container from "~/components/Container"; -import Editor from "./Editor" -import Controls from "./Controls" +import Editor from "./Editor"; +import Controls from "./Controls"; +import { updateSectionDocValue } from "~/Contexts/section.actions"; const StyledSection = styled(Flex)` - transition: 250ms all ease-in-out; - ${props => - props.delete && - css` - transform: translateX(500px); - opacity: 0; - `} - ${props => - props.sectionOverviewExpanded - ? css` - margin-left: 250px; - ` - : css` - margin-left: 55px; - `} -` + transition: 250ms all ease-in-out; + ${(props) => + props.delete && + css` + transform: translateX(500px); + opacity: 0; + `} + ${(props) => + props.sectionOverviewExpanded + ? css` + margin-left: 250px; + ` + : css` + margin-left: 55px; + `} +`; const Wrapper = styled.div` - flex-shrink: 1; - flex-grow: 1; - max-width: 850px; - width: 100%; - - filter: ${props => !props.visible && "blur(2px)"}; - /* box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23); */ - background-color: #fff; - border-radius: 5px; - transition: 250ms margin ease-in-out; -` + flex-shrink: 1; + flex-grow: 1; + max-width: 850px; + width: 100%; + /* box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23); */ + background-color: #fff; + border-radius: 5px; + transition: 250ms margin ease-in-out; +`; +/* const SectionInput = styled(Input)` - font-weight: 700; - margin-left: 25px; - margin-right: 25px; - margin-right: 25px; - width: calc(100% - 50px); - font-family: "PT Sans Narrow", sans-serif; + font-weight: 700; + margin-left: 25px; + margin-right: 25px; + margin-right: 25px; + width: calc(100% - 50px); + font-family: "PT Sans Narrow", sans-serif; ` +*/ -const Warning = styled(Text)` - width: auto; - max-width: 850px; - padding: 15px; - background-color: #cc0000; - color: #fff; - margin-bottom: 25px; -` +const getSectionData = (store, sectionId = "") => { + const index = store.sections.findIndex((s) => s._id === sectionId); + if (index === -1) { + return [null, index]; + } + return [store.sections[index], index]; +}; + +const Section = () => { + const { store, dispatch } = useContext(LessonContext); + const sectionRef = useRef(null); + + const [timeout, setTimeoutState] = useState(null); + const onChange = ({ changed, getDocument }) => { + if (timeout) { + clearTimeout(timeout); + setTimeoutState(null); + } + + setTimeoutState( + setTimeout(() => { + setTimeoutState(null); + dispatch( + updateSectionDocValue( + store.view.activeSectionId, + getDocument() + ) + ); + }, 250) + ); + }; + const [section, index] = getSectionData(store, store.view.activeSectionId); + + if (!store.view.activeSectionId || index === -1) { + // TODO: notifcation and set new section + const text = + index === -1 + ? "Der Abschnitt existiert nicht." + : "Kein Abschnitt ausgewählt."; + return ( + + + {text} + + + ); + } + + // TODO: useEffect error + + // TODO: controls get section id as prop an fetch all other data + // TODO: how to use section.delete at this position? + + return ( + + + + + + + = 0 && store.sections[index - 1]._id} + nextId={ + index + 1 < store.sections.length && + store.sections[index + 1]._id + } + /> + + + + ); +}; -const Section = ({ store, dispatch }) => { - const sectionRef = useRef(null) - - if (!store.activeSectionId) - return ( - - - Kein Abschnitt ausgewählt... - - - ) - - const index = store.lesson.sections.findIndex( - section => section.id === store.activeSectionId, - ) - const section = store.lesson.sections[index] - const isLast = store.lesson.sections.length - 1 === index - - return ( - - - - +++ Alpha-Testversion +++ ohne Speicherfunktion +++ wir - freuen uns über Feedback 🙂 +++ - - - - { - dispatch({ - type: "SECTION_DOCVALUE_CHANGE", - payload: { - sectionId: section.id, - docValue, - }, - }) - }} - /> - = 0 && store.lesson.sections[index - 1].id - } - nextId={ - index + 1 < store.lesson.sections.length && - store.lesson.sections[index + 1].id - } - /> - - - ) -} - -export default Section +export default Section; diff --git a/src/workspace/Lesson/Section/plugins.js b/src/workspace/Lesson/Section/plugins.js deleted file mode 100644 index e074c43b1..000000000 --- a/src/workspace/Lesson/Section/plugins.js +++ /dev/null @@ -1,102 +0,0 @@ -import { rowsPlugin } from "@edtr-io/plugin-rows" -import { anchorPlugin } from "@edtr-io/plugin-anchor" -import { blockquotePlugin } from "@edtr-io/plugin-blockquote" -import { spoilerPlugin } from "@edtr-io/plugin-spoiler" -import { textPlugin } from "@edtr-io/plugin-text" -import { scMcExercisePlugin } from "@edtr-io/plugin-sc-mc-exercise" -import { equationsPlugin } from "@edtr-io/plugin-equations" -import { geogebraPlugin } from "@edtr-io/plugin-geogebra" -import { videoPlugin } from "@edtr-io/plugin-video" -import { inputExercisePlugin } from "@edtr-io/plugin-input-exercise" -import { createFilePlugin, parseFileType } from "@edtr-io/plugin-files" -import { createImagePlugin } from "@edtr-io/plugin-image" -// import { highlightPlugin } from "@edtr-io/plugin-highlight" -// import { h5pPlugin } from "@edtr-io/plugin-h5p" - -import nexboardPlugin from "~/plugins/nexboard" -import etherpadPlugin from "~/plugins/etherpad" -import notesPlugin from "~/plugins/notes" - -function readFile(file) { - return new Promise(resolve => { - const reader = new FileReader() - reader.onload = function(e) { - const dataUrl = e.target.result - //simulate uploadtime - setTimeout(() => resolve({ file, dataUrl }), 1000) - } - - reader.readAsDataURL(file) - }) -} - -const mockUploadFileHandler = file => { - return readFile(file).then(loaded => { - return { - location: loaded.dataUrl, - name: loaded.file.name, - type: parseFileType(loaded.file.name), - } - }) -} - -const ALLOWED_EXTENSIONS = ["gif", "jpg", "jpeg", "png", "svg"] - -function matchesAllowedExtensions(fileName) { - const extension = fileName - .toLowerCase() - .slice(fileName.lastIndexOf(".") + 1) - return ALLOWED_EXTENSIONS.indexOf(extension) >= 0 -} - -function validateFile(file) { - if (matchesAllowedExtensions(file.name)) { - return { valid: true } - } else { - return { - valid: false, - errors: - "Die ausgewählte Datei konnte nicht als Bild erkannt werden.", - } - } -} -export function mockUploadImageHandler(file) { - const validation = validateFile(file) - if (!validation.valid) { - alert(validation.errors) - return Promise.reject(validation.errors) - } - - return readFile(file).then(loaded => { - return loaded.dataUrl - }) -} - -const filesPlugin = createFilePlugin({ upload: mockUploadFileHandler }) -const imagePlugin = createImagePlugin({ - upload: mockUploadImageHandler, - validate: validateFile, - secondInput: "description", -}) - -const plugins = { - text: textPlugin, - // notes: notesPlugin, - rows: rowsPlugin, - blockquote: blockquotePlugin, - etherpad: etherpadPlugin, - image: imagePlugin, - files: filesPlugin, - spoiler: spoilerPlugin, - geogebra: geogebraPlugin, - // inputExercise: inputExercisePlugin, - video: videoPlugin, - // equations: equationsPlugin, - // anchor: anchorPlugin, - // nexboard: nexboardPlugin, - // singleMultipleChoice: scMcExercisePlugin, - // highlight: highlightPlugin, - // h5p: h5pPlugin, -} - -export default plugins diff --git a/src/workspace/Lesson/SectionOverview/Preview/Controls/DeleteModal.jsx b/src/workspace/Lesson/SectionOverview/Preview/Controls/DeleteModal.jsx deleted file mode 100644 index 1c1d17342..000000000 --- a/src/workspace/Lesson/SectionOverview/Preview/Controls/DeleteModal.jsx +++ /dev/null @@ -1,67 +0,0 @@ -import React from "react" -import styled from "styled-components" - -import { PortalWithState } from "react-portal" -import Heading from "~/components/Heading" -import Text from "~/components/Text" -import Container from "~/components/Container" -import Button from "~/components/Button" -import Flex from "~/components/Flex" - -const Wrapper = styled.div` - position: fixed; - top: 0; - left: 0; - background-color: rgba(0, 0, 0, 0.3); - display: flex; - justify-content: center; - align-items: center; - width: 100vw; - height: 100vh; - z-index: 9999; -` - -const Content = styled(Container)` - background-color: #fff; - max-width: 500px; - border-radius: 5px; - box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23); -` - -function DeleteModal({ confirmDelete, renderIcon, sectionTitle }) { - return ( - - {({ openPortal, closePortal, isOpen, portal }) => ( - - {renderIcon(openPortal)} - {portal( - - - "{sectionTitle}" löschen - - Bist du dir sicher, dass du diesen Abschnitt - löschen möchtest? Du kannst dies nicht - rückgängig machen. - -
- - - - -
-
, - )} -
- )} -
- ) -} - -export default DeleteModal diff --git a/src/workspace/Lesson/SectionOverview/Preview/Controls/index.jsx b/src/workspace/Lesson/SectionOverview/Preview/Controls/index.jsx deleted file mode 100644 index c210a4b75..000000000 --- a/src/workspace/Lesson/SectionOverview/Preview/Controls/index.jsx +++ /dev/null @@ -1,163 +0,0 @@ -import React, { useContext, useRef } from "react" -import styled, { css } from "styled-components" - -import api from "~/utils/api" - -import dragIcon from "~/assets/drag-handle.svg" -import previewIcon from "~/assets/preview.svg" -import noPreviewIcon from "~/assets/no-preview.svg" -import trashIcon from "~/assets/trash.svg" -import settingsIcon from "~/assets/settings.svg" - -import Flex from "~/components/Flex" - -import DeleteModal from "./DeleteModal" - -const StyledControls = styled(Flex)` - width: 30px; - padding: 0; - overflow: hidden; - flex-shrink: 0; - - transition: 250ms all ease-in-out; - ${props => - !props.expanded - ? css` - width: 0; - opacity: 0; - height: 0; - pointer-events: none; - ` - : !props.editing && - css` - opacity: 0; - width: 30px; - height: 0; - pointer-events: none; - `} -` - -const Icon = styled.img` - cursor: pointer; - margin: 18px 5px; - width: 20px; - - ${props => - !props.visible && - css` - display: none; - `} - - ${props => { - return ( - props.drag && - css` - cursor: grab; - user-select: none; - - &:active { - cursor: grabbing; - } - ` - ) - }} - - ${props => { - return ( - props.isOnly && - css` - cursor: not-allowed; - user-select: none; - opacity: 0.5; - &:active { - cursor: not-allowed; - } - ` - ) - }} -` - -const DragHandle = ({ connectDragSource, ...props }) => { - const dh = ( - - {}} /> - - ) - - return connectDragSource(dh) -} - -const Controls = ({ - sectionId, - store, - index, - dispatch, - visible, - sectionTitle, - connectDragSource, -}) => { - function handleOrderChange(down) { - dispatch({ - type: "SWAP_SECTIONS", - payload: [index, down === true ? index + 1 : index - 1], - }) - } - - async function confirmDelete() { - dispatch({ - type: "PREPARE_DELETE_SECTION", - payload: sectionId, - }) - - setTimeout(() => { - dispatch({ - type: "DELETE_SECTION", - payload: sectionId, - }) - }, 250) - - await api.delete(`/editor/sections/${sectionId}`) - } - - const isOnly = store.lesson.sections.length === 1 - - return ( - - - { - dispatch({ type: "TOGGLE_SECTION_SETTINGS" }) - }} - /> - {/* { - dispatch({ type: "SECTION_VISIBILITY", payload: sectionId }) - }} - /> - { - return ( - !isOnly && openModal(e)} - /> - ) - }} - /> */} - - ) -} - -export default Controls diff --git a/src/workspace/Lesson/SectionOverview/Preview/DnDHOC.jsx b/src/workspace/Lesson/SectionOverview/Preview/DnDHOC.jsx deleted file mode 100644 index 1e6422ac6..000000000 --- a/src/workspace/Lesson/SectionOverview/Preview/DnDHOC.jsx +++ /dev/null @@ -1,56 +0,0 @@ -import React from "react" -import { DragSource, DropTarget } from "react-dnd" - -export default comp => - DropTarget( - "preview", - { - hover(props, monitor, component) { - if (!component) { - return null - } - const node = component.getNode() - if (!node) { - return null - } - const dragIndex = monitor.getItem().index - const hoverIndex = props.index - if (dragIndex === hoverIndex) { - return - } - const hoverBoundingRect = node.getBoundingClientRect() - const hoverMiddleY = - (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2 - const clientOffset = monitor.getClientOffset() - const hoverClientY = clientOffset.y - hoverBoundingRect.top - - if (dragIndex < hoverIndex && hoverClientY < hoverMiddleY) { - return - } - if (dragIndex > hoverIndex && hoverClientY > hoverMiddleY) { - return - } - - props.moveSection(dragIndex, hoverIndex) - monitor.getItem().index = hoverIndex - }, - }, - connect => ({ - connectDropTarget: connect.dropTarget(), - }), - )( - DragSource( - "preview", - { - beginDrag: props => ({ - id: props.id, - index: props.index, - }), - }, - (connect, monitor) => ({ - connectDragSource: connect.dragSource(), - connectDragPreview: connect.dragPreview(), - isDragging: monitor.isDragging(), - }), - )(comp), - ) diff --git a/src/workspace/Lesson/SectionOverview/Preview/Editor.jsx b/src/workspace/Lesson/SectionOverview/Preview/Editor.jsx index a3d56fb31..82592a40e 100644 --- a/src/workspace/Lesson/SectionOverview/Preview/Editor.jsx +++ b/src/workspace/Lesson/SectionOverview/Preview/Editor.jsx @@ -2,14 +2,13 @@ import React from "react" import styled from "styled-components" import { Editor as Edtr } from "@edtr-io/core" -import etherpadPluginPreview from "~/plugins/etherpad/Preview" -import nexboardPluginPreview from "~/plugins/nexboard/Preview" -import { plugins } from "~/workspace/Lesson/Section/Editor" +import { previewPlugins } from "~/plugins" const EditorWrapper = styled.div` + padding: 20px; width: 850px; transform-origin: left top; - transform: ${props => props.expanded && "scale(0.15)"}; + transform: ${props => props.expanded && "scale(0.2)"}; overflow: hidden; user-select: none; * { @@ -18,33 +17,28 @@ const EditorWrapper = styled.div` ` export default class Editor extends React.Component { - constructor(props) { - super(props) - this.docValue = + constructor(props) { + super(props) + this.docValue = this.props.docValue && Object.keys(this.props.docValue).length - ? this.props.docValue - : { - plugin: "rows", - } - } + ? this.props.docValue + : { + plugin: "rows", + } + } - render() { - return ( - - - - ) - } + render() { + return ( + + + + ) + } } diff --git a/src/workspace/Lesson/SectionOverview/Preview/EditorPreview.jsx b/src/workspace/Lesson/SectionOverview/Preview/EditorPreview.jsx deleted file mode 100644 index 0c97240be..000000000 --- a/src/workspace/Lesson/SectionOverview/Preview/EditorPreview.jsx +++ /dev/null @@ -1,166 +0,0 @@ -import React, { Component } from "react" -import styled, { css } from "styled-components" -import { DragLayer } from "react-dnd" -import { isTouchDevice } from "~/utils/device" - -import Editor from "./Editor" - -function collect(monitor) { - return { - sourceOffset: monitor.getSourceClientOffset(), - } -} - -const Outer = styled.div` - /* padding: 3px; */ - border: 10px solid - ${props => (props.active ? "rgba(163, 163, 163, 1.00)" : "transparent")}; - border-radius: 3px; - background: ${props => - props.expanded ? "rgba(163, 163, 163, 1)" : "transparent"}; - flex-shrink: 0; - margin: 8px 0; - width: 155px; - height: 118px; - flex-shrink: 0; - transition: 250ms all ease-in-out; - - ${props => - !props.active - ? css` - border-color: transparent; - background: transparent; - ` - : css` - margin: 24px 0; - `} - ${props => - !props.expanded && - css` - width: 30px; - height: 30px; - border-radius: 15px; - border-color: transparent; - `} -` - -const Wrapper = styled.div` - overflow: hidden; - cursor: pointer; - box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.4); - transition: 250ms all ease-in-out; - position: relative; - font-size: 20px; - line-height: 1.42; - width: 135px; - height: 98px; - flex-shrink: 0; - - ${props => - props.expanded - ? css` - padding: 15px 0; - height: 98px; - border-radius: 3px; - background-color: #fff; - border: 3px solid rgba(68, 68, 68, 1); - ${props => - !props.active && - css` - border-color: #fff; - `} - ` - : css` - border: 3px solid transparent; - background-color: rgba(170, 170, 170, 1); - width: 18px; - height: 18px; - border-radius: 9px; - box-shadow: none !important; - transform: scale(0.5); - transform-origin: center center; - - ${props => - props.active && - css` - transform: scale(1); - `} - - &:hover { - transform: scale(1); - } - `} - - &:hover { - box-shadow: 0 3px 10px 0 rgba(0, 0, 0, 0.6); - } - - ${({ visible }) => { - return ( - !visible && - css` - opacity: 0.7; - ` - ) - }} - - display: ${({ hidden }) => hidden && "none"}; - -` - -const EditorPreview = ({ - store, - section, - expanded, - index, - activeSectionIndex, - dispatch, - previewRef, - wrapperRef, - isDragging, - sourceOffset, - k, -}) => { - const dragStyle = - !isDragging || !isTouchDevice() - ? {} - : { - transform: sourceOffset - ? `translate(${sourceOffset.x}px, ${sourceOffset.y - - wrapperRef.current.offsetTop}px)` - : "", - } - - return ( - - - - ) -} - -export default DragLayer(collect)(EditorPreview) diff --git a/src/workspace/Lesson/SectionOverview/Preview/index.jsx b/src/workspace/Lesson/SectionOverview/Preview/index.jsx index 60eff99e0..70ed96c41 100644 --- a/src/workspace/Lesson/SectionOverview/Preview/index.jsx +++ b/src/workspace/Lesson/SectionOverview/Preview/index.jsx @@ -1,87 +1,172 @@ -import React, { useRef, useImperativeHandle } from "react" +import React, { Component, useState, useEffect, useMemo } from "react" import styled, { css } from "styled-components" +import { useDrag, useDrop } from "react-dnd" +import { isTouchDevice } from "~/utils/device" -import Flex from "~/components/Flex" +import Editor from "./Editor" +import { setActiveSection } from "~/Contexts/view.actions" -import theme from "~/theme" +function collect(monitor) { + return { + sourceOffset: monitor.getSourceClientOffset(), + } +} -import DnDHOC from "./DnDHOC" -import Controls from "./Controls" -import EditorPreview from "./EditorPreview" -import { isTouchDevice } from "~/utils/device" +const Outer = styled.div` + /* padding: 3px; */ + border: 10px solid + ${props => (props.active ? "rgba(163, 163, 163, 1.00)" : "transparent")}; + border-radius: 3px; + background: ${props => + props.expanded ? "rgba(163, 163, 163, 1)" : "transparent"}; + + transition: 250ms all ease-in-out; + width: 100%; + + ${props => + !props.active + ? css` + border-color: transparent; + background: transparent; + ` + : css``} + ${props => + !props.expanded && + css` + border: none; + border-radius: 15px; + `} +` -const OuterMost = styled(Flex)` - width: 100%; +const Wrapper = styled.div` + overflow: hidden; + cursor: pointer; + box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.4); transition: 250ms all ease-in-out; - transform: ${props => props.delete && "translateX(100%)"}; + position: relative; + font-size: 20px; + line-height: 1.42; + height: 100%; + margin: 15px auto; + width: 200px; + height: 160px; + + ${props => + props.expanded + ? css` + margin: 8px 10px; + border-radius: 3px; + background-color: #fff; + border: 3px solid rgba(68, 68, 68, 1); + ${props => + !props.active && + css` + border-color: #fff; + `} + ` + : css` + border: 3px solid transparent; + background-color: rgba(170, 170, 170, 1); + width: 18px; + height: 18px; + border-radius: 9px; + box-shadow: none !important; + transform: scale(0.5); + transform-origin: center center; + + ${props => + props.active && + css` + transform: scale(1); + `} + + &:hover { + transform: scale(1); + } + `} + + &:hover { + box-shadow: 0 3px 10px 0 rgba(0, 0, 0, 0.6); + } + + ${({ visible }) => { + return ( + !visible && + css` + opacity: 0.7; + ` + ) + }} + ` -/* eslint-disable */ -const Preview = React.forwardRef( - ( - { - store, - k, - dispatch, - section, - index, - isDragging, - connectDragSource, - connectDropTarget, - connectDragPreview, - ...props - }, - ref, - ) => { - const expanded = store.sectionOverviewExpanded - - const activeSectionIndex = store.lesson.sections.findIndex( - el => el.id === store.activeSectionId, - ) - - // DnD - const wrapperRef = useRef(null) - const previewRef = useRef(null) - if (connectDragSource) { - connectDragPreview(previewRef) - connectDropTarget(wrapperRef) - // const opacity = isDragging ? 0 : 1 - useImperativeHandle(ref, () => ({ - getNode: () => wrapperRef.current, - })) - } - - const p = ( -
- - - - -
- ) - return connectDragSource(p) - }, -) - -export default DnDHOC(Preview) +const Preview = ({ + active, + section, + expanded, + onClick, + getSectionIndex, + moveSection +}) => { + + // reduzing the time a preview is rendered, added for performance reasosns + const [docValue, setDocValue] = useState(section.docValue) + useEffect(() => { + setDocValue(section.docValue) + }, [section.changed.size]) + + const currentIndex = getSectionIndex(section._id) + const [{ isDragging }, drag] = useDrag({ + item: { type: 'Preview', _id: section._id, originalIndex: currentIndex }, + collect: monitor => ({ + isDragging: monitor.isDragging(), + }), + end: (dropResult, monitor) => { + const { _id, originalIndex } = monitor.getItem() + const didDrop = monitor.didDrop() + if (!didDrop) { + moveSection(getSectionIndex(_id), originalIndex) + } + }, + }) + + const [, drop] = useDrop({ + accept: 'Preview', + canDrop: () => false, + hover({ _id: draggedId }) { + if (draggedId !== section._id) { + const overIndex = getSectionIndex(section._id) + moveSection(getSectionIndex(draggedId), overIndex) + } + }, + }) + + const dragStyles = { + opacity: isDragging ? 0 : 1, + cursor: isDragging ? 'auto' : 'move', + } + return ( + drag(drop(node))} + active={active} + expanded={expanded} + style={dragStyles}> + onClick(section)}> + {expanded && ( + + )} + + + ) +} + +export default Preview diff --git a/src/workspace/Lesson/SectionOverview/Settings/DeleteModal.jsx b/src/workspace/Lesson/SectionOverview/Settings/DeleteModal.jsx deleted file mode 100644 index f21a49f80..000000000 --- a/src/workspace/Lesson/SectionOverview/Settings/DeleteModal.jsx +++ /dev/null @@ -1,72 +0,0 @@ -import React from "react" -import styled from "styled-components" - -import { PortalWithState } from "react-portal" -import Heading from "~/components/Heading" -import Text from "~/components/Text" -import Container from "~/components/Container" -import Button from "~/components/Button" -import Flex from "~/components/Flex" - -const Wrapper = styled.div` - position: fixed; - top: 0; - left: 0; - background-color: rgba(0, 0, 0, 0.3); - display: flex; - justify-content: center; - align-items: center; - width: 100vw; - height: 100vh; - z-index: 9999; -` - -const Content = styled(Container)` - background-color: #fff; - max-width: 500px; - border-radius: 5px; - box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23); -` - -function DeleteModal({ confirmDelete, renderIcon, sectionTitle }) { - return ( - - {({ openPortal, closePortal, isOpen, portal }) => ( - - {renderIcon(openPortal)} - {portal( - - - "{sectionTitle}" löschen - - Bist du dir sicher, dass du diesen Abschnitt - löschen möchtest? Du kannst dies nicht - rückgängig machen. - -
- - - - -
-
, - )} -
- )} -
- ) -} - -export default DeleteModal diff --git a/src/workspace/Lesson/SectionOverview/Settings/index.jsx b/src/workspace/Lesson/SectionOverview/Settings/index.jsx index 3e2034396..da3d007ef 100644 --- a/src/workspace/Lesson/SectionOverview/Settings/index.jsx +++ b/src/workspace/Lesson/SectionOverview/Settings/index.jsx @@ -1,52 +1,65 @@ import React, { useContext } from "react" -import { Portal } from "react-portal" + import styled, { css } from "styled-components" -import LessonContext from "~/Contexts/Lesson" -import api from "~/utils/api" +import { useState } from 'react'; +import LessonContext from "~/Contexts/Lesson.context" import Flex from "~/components/Flex" - +import { Portal } from "react-portal" import previewIcon from "~/assets/preview-white.svg" import noPreviewIcon from "~/assets/no-preview-white.svg" -import trashIcon from "~/assets/trash-white.svg" +import TrashIcon from "~/assets/trash-white.svg" import duplicateIcon from "~/assets/duplicate-white.svg" import shareIcon from "~/assets/share-white.svg" import infoIcon from "~/assets/info-white.svg" -import closeIcon from "~/assets/close-white.svg" +import CloseIcon from "~/assets/close-white.svg" +import Heading from "~/components/Heading" +import Text from "~/components/Text" + +import ModalActions from "~/components/ModalActions" +import { editorWS } from "~/utils/socket" +import { switchSectionVisibility, removeSection } from "~/Contexts/section.actions" +import { toggleSectionSettings } from "~/Contexts/view.actions" +import BaseButton from "~/components/Button/BaseButton" +import Button from "~/components/Button" +import { colors } from "react-select/src/theme" -import DeleteModal from "./DeleteModal" const Wrapper = styled(Flex)` background-color: #455b6a; width: 100vw; - position: fixed; + position: fixed; + justify-content: space-between; left: 0; - top: 62px; + top: 55px; padding: 10px 15px; - z-index: 99999; + z-index: 6; box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1), 0 3px 6px rgba(0, 0, 0, 0.18); ` +const buttonTheme = { + height: "28px", + padding: "1px", +} const Icon = styled.img` cursor: pointer; margin-right: 25px; - width: 20px; &:last-child { margin-right: 0; } /* ${props => - !props.visible && - css` + !props.visible && + css` display: none; `} */ ${props => { - return ( - props.isOnly && - css` + return ( + props.isOnly && // only one section + css` cursor: not-allowed; user-select: none; opacity: 0.5; @@ -54,88 +67,81 @@ const Icon = styled.img` cursor: not-allowed; } ` - ) - }} + ) + }} ` -const Settings = () => { - const { store, dispatch } = useContext(LessonContext) - const activeSectionId = store.activeSectionId - const activeSection = store.lesson.sections.find( - el => el.id === activeSectionId, - ) - const activeSectionIndex = store.lesson.sections.findIndex( - el => el.id === activeSectionId, - ) - - const isOnly = store.lesson.sections.length === 1 - - async function confirmDelete() { - dispatch({ - type: "PREPARE_DELETE_SECTION", - payload: activeSectionId, - }) - - setTimeout(() => { - dispatch({ - type: "DELETE_SECTION", - payload: activeSectionId, - }) - }, 250) - - await api.delete(`/editor/sections/${activeSectionId}`) - } - if (!store.showSectionSettings) return null - - return ( - - - - - - - { - return ( - !isOnly && openModal(e)} - /> - ) - }} - /> - { - dispatch({ - type: "SECTION_VISIBILITY", - payload: activeSectionId, - }) - }} - visible - /> - - - { - dispatch({ type: "TOGGLE_SECTION_SETTINGS" }) - }} - /> - - - - ) +const Settings = () => { + const { store, dispatch } = useContext(LessonContext) + const activeSectionId = store.view.activeSectionId + const activeSection = store.sections.find( + el => el._id === activeSectionId, + ) + const activeSectionIndex = store.sections.findIndex( + el => el._id === activeSectionId, + ) + + const isOnly = store.sections.length === 1 + const [isOpen, setOpen] = useState(false) + + async function confirmDelete() { + dispatch(removeSection(activeSectionId)) + } + if (!store.view.showSectionSettings) return null + + + return ( + + + + {/* + + + + */} + setOpen(false)} + showModal={() => setOpen(true)} + > + "{activeSection.title || `Abschnitt ${activeSectionIndex + 1}`}" löschen + + {`Bist du dir sicher, dass du diesen Abschnitt + löschen möchtest? Du kannst dies nicht + rückgängig machen.`} + + {/* // show / hide section + // dispatch(switchSectionVisibility(activeSectionId))} + // visible + // /> + */} + + setOpen(true)} + theme={buttonTheme} + > + + + + + { + dispatch(toggleSectionSettings()) + }} + /> + + + + ) } export default Settings diff --git a/src/workspace/Lesson/SectionOverview/SidebarControls.jsx b/src/workspace/Lesson/SectionOverview/SidebarControls.jsx index 136a8e24f..cbcf5f301 100644 --- a/src/workspace/Lesson/SectionOverview/SidebarControls.jsx +++ b/src/workspace/Lesson/SectionOverview/SidebarControls.jsx @@ -1,121 +1,114 @@ import React from "react" import styled, { css } from "styled-components" -import uuid from "uuid/v4" import api from "~/utils/api" import theme from "~/theme" -import { getFakeSection } from "~/utils/fake" - +import BaseButton from "~/components/Button/BaseButton" +import { createSection } from "~/Contexts/section.actions" import Flex from "~/components/Flex" +import { toggleSectionOverview } from "~/Contexts/view.actions" + +import PlusRedRound from "~/assets/plus-red-round.svg"; +import DoubleArrowLeftRed from "~/assets/double-arrow-left-red.svg"; +import DoubleArrowLeftWhite from "~/assets/double-arrow-left-white.svg"; + +const DoubleArrowLeftRedRotated = styled(DoubleArrowLeftRed)` + transform: rotate(180deg); +` const Wrapper = styled(Flex)` - width: 100%; - background-color: ${props => (props.expanded ? "#455B6A" : "transparent")}; - position: absolute; - bottom: 0; - left: 0; + width: 100%; + background-color: ${props => (props.expanded ? "#455B6A" : "transparent")}; + position: absolute; + bottom: 0; + left: 0; +` + +const StyledIcon = ({children}) => { + const Styled = styled.div` + cursor: pointer; + margin: 15px; + width: 24px; + height: 24px; + flex-shrink: 0; + transform: ${props => !props.expanded && "rotate(180deg)"}; + transition: 250ms all ease-in-out; ` + return ( + + {children} + + ) +} -const StyledIcon = styled.img` - cursor: pointer; - margin: 15px; - width: 24px; - height: 24px; - flex-shrink: 0; - transform: ${props => !props.expanded && "rotate(180deg)"}; - transition: 250ms all ease-in-out; +const AddWrapper = styled.div` + height: 24px; + background-color: #fff; + width: 40px; + height: 40px; + border-radius: 18px; + display: flex; + justify-content: center; + align-items: center; + ${props => + props.visible + ? css` + margin: 10px; + ` + : css` + position: absolute; + top: 0; + left: 50%; + transform: translate(-50%, -50%); + `} ` -async function addNewSection(store, dispatch) { - const tempId = uuid() - const lessonId = store.lesson.id - const position = store.lesson.sections.length - 1 - dispatch({ - type: "ADD_SECTION", - payload: { - position, - tempId, - }, - }) +const ExpandButton = ({expanded, onClick}) => { - const newSection = await api.post( - "/editor/sections", - { - lesson: lessonId, - visible: true, - position, - notes: "", - title: "", - }, - null, - null, - getFakeSection(lessonId), - ) + const ModifiedBaseButton = Object.assign(BaseButton, onClick) - dispatch({ - type: "REPLACE_ADDED_SECTION_ID", - payload: { - tempId, - backendId: newSection._id, - }, - }) + if(expanded){ + return ( + + + ) + } else { + return ( + + + ) + } } -const AddWrapper = styled.div` - height: 24px; - background-color: #fff; - width: 40px; - height: 40px; - border-radius: 18px; - display: flex; - justify-content: center; - align-items: center; - ${props => - props.visible - ? css` - margin: 10px; - ` - : css` - position: absolute; - top: 0; - left: 50%; - transform: translate(-50%, -50%); - `} -` const SidebarControls = ({ store, dispatch }) => { - const expanded = store.sectionOverviewExpanded - return ( - - {store.editing && ( - - { - addNewSection(store, dispatch) - }} - style={{ width: 40, height: 40 }} - src={require("~/assets/plus-red-round.svg")} - redRound={!expanded} - /> - - )} - { - dispatch({ - type: "TOGGLE_SECTION_OVERVIEW", - payload: !expanded, - }) - }} - /> - - ) + const { + sections, + view: { + sectionOverviewExpanded: expanded, + editing + } + } = store + return ( + + {editing && ( + + { + dispatch(createSection(sections.length)) + }} + > + + )} + { + dispatch(toggleSectionOverview()) + }} + /> + + ) } export default SidebarControls diff --git a/src/workspace/Lesson/SectionOverview/index.jsx b/src/workspace/Lesson/SectionOverview/index.jsx index 732770feb..2aa736a8a 100644 --- a/src/workspace/Lesson/SectionOverview/index.jsx +++ b/src/workspace/Lesson/SectionOverview/index.jsx @@ -1,29 +1,32 @@ import React, { useEffect, useState, useContext } from "react" import styled, { css } from "styled-components" -import Heading from "~/components/Heading" import theme from "~/theme" import Preview from "./Preview" import Settings from "./Settings" import SidebarControls from "./SidebarControls" +import { showSectionOverview , setActiveSection } from "~/Contexts/view.actions" + +import {useDrop} from 'react-dnd' + const Wrapper = styled.div` left: 0; position: fixed; bottom: 0; - width: ${props => (props.expanded ? 220 : 50)}px; - height: calc(100vh - 62px); + min-width: 50px; + height: calc(100vh - 55px); overflow: hidden; transition: 250ms all ease-in-out; background-color: rgba(69, 91, 106, 0.25); - z-index: 100; + z-index: 2; box-shadow: inset -3px 0px 6px rgba(0, 0, 0, 0.1), inset -3px 0px 6px rgba(0, 0, 0, 0.18); border-radius: 0; ${props => - !props.expanded && + !props.expanded && css` box-shadow: none; background-color: #fff; @@ -31,18 +34,13 @@ const Wrapper = styled.div` ` const Previews = styled.div` - padding: ${props => - props.editing && props.expanded - ? "15px 30px 15px 5px" - : !props.expanded - ? "15px 10px" - : "15px 30px 15px 0"}; + width: 100%; height: calc(100vh - 62px); overflow: auto; padding-bottom: 100px; ${props => - !props.expanded && + !props.expanded && css` display: flex; flex-direction: column; @@ -52,70 +50,84 @@ const Previews = styled.div` ` function useResizeListener(store, dispatch) { - function resizeListener() { - if (store.sectionOverviewExpanded && window.innerWidth < 1350) { - dispatch({ type: "TOGGLE_SECTION_OVERVIEW", payload: false }) - } + function resizeListener() { + if (store.view.sectionOverviewExpanded && window.innerWidth < 1350) { + dispatch(showSectionOverview(false)) + } - if ( - store.sectionOverviewExpanded === false && + if ( + store.view.sectionOverviewExpanded === false && window.innerWidth > 1350 - ) { - dispatch({ type: "TOGGLE_SECTION_OVERVIEW", payload: true }) - } - } - - useEffect(() => { - if (window.innerWidth > 1350 && !store.bootstrapFinished) { - dispatch({ type: "TOGGLE_SECTION_OVERVIEW", payload: true }) - } - - // window.addEventListener("resize", resizeListener) - // return () => window.removeEventListener("resize", resizeListener) - }, [store.sectionOverviewExpanded]) + ) { + dispatch(showSectionOverview(true)) + } + } + + useEffect(() => { + if (window.innerWidth > 1350 && !store.view.bootstrapFinished) { + dispatch(showSectionOverview(true)) + } + + // window.addEventListener("resize", resizeListener) + // return () => window.removeEventListener("resize", resizeListener) + }, [store.view.sectionOverviewExpanded]) } + + const SectionOverview = ({ store, dispatch }) => { - useResizeListener(store, dispatch) - const expanded = store.sectionOverviewExpanded - const sections = store.lesson.sections - - function moveSection(fromIndex, toIndex) { - dispatch({ type: "SWAP_SECTIONS", payload: [fromIndex, toIndex] }) - } - - return ( - - - - {sections - .filter((section, index) => { - if (store.editing) return true - return section.visible - }) - .map((section, index) => { - const editorKey = - section.id + - "-" + - Math.round(new Date().getTime() / 5000) - return ( - - ) - })} - - - - - - ) + useResizeListener(store, dispatch) + const { + sections, + view: { + sectionOverviewExpanded: expanded, + editing, + } + } = store; + + function moveSection(fromIndex, toIndex) { + dispatch({ type: "SWAP_SECTIONS", payload: [fromIndex, toIndex] }) + } + + const getSectionIndex = id => { + return sections.findIndex(s => s._id === id) + + } + + const setSection = (section) => { + dispatch(setActiveSection(section._id)) + } + + const [, drop] = useDrop({ accept: 'Preview' }) + return ( + + + + {sections + .filter((section, index) => { + if (editing) return true + return section.visible + }) + .map((section, index) => { + return ( + + ) + })} + + + + + + ) } export default SectionOverview diff --git a/src/workspace/Lesson/hooks.js b/src/workspace/Lesson/hooks.js index baa82fa27..9595fed01 100644 --- a/src/workspace/Lesson/hooks.js +++ b/src/workspace/Lesson/hooks.js @@ -1,217 +1,102 @@ -import React, { useEffect, useState } from "react" - -import api from "~/utils/api" -import config from "~/config" -import { lessonFakeData } from "~/utils/fake" -import { setCookie } from "~/utils/cookie" -import { useInterval } from "~/utils/hooks" -import { loadEditorData, saveEditorData } from "~/utils/cache" -import { buildDiff } from "~/utils/diff" +import { useEffect, useState } from "react" +import { fetchCourse } from "~/Contexts/course.actions" +import { fetchLessonWithSections, lessonWasUpdated, saveLesson, setLesson } from "~/Contexts/lesson.actions" +import { unsavedChanges , newError } from '~/Contexts/notifications.actions' +import { saveSections, sectionWasUpdated, setSections, fetchSection , mergeEditorDiff } from '~/Contexts/section.actions' +import { serverApi } from "~/utils/api" +import { loadLessonCache, loadSectionCache } from "~/utils/cache" +import { editorWS } from "~/utils/socket" export function useBootstrap(id, courseId, dispatch, dispatchUserAction) { - async function fetchData() { - try { - const user = await api.get("/me") - dispatchUserAction({ type: "BOOTSTRAP_USER", payload: user }) - } catch (err) { - console.warn("Could not fetch user data") - } - - try { - const cacheData = loadEditorData(id) - let lesson - if ( - cacheData && - cacheData.hasOwnProperty("lesson") && - (cacheData.savedToBackend === false || config.DISABLE_BACKEND) - ) { - lesson = cacheData.lesson - } else { - lesson = await api.get(`/editor/lessons/${id}`, lessonFakeData) - if (lesson.sections.length === 0) { - const section = await api.post(`/editor/sections/`, { - lesson: lesson._id, - visible: true, - }) - lesson.sections = [section] - } - - lesson.id = lesson._id - lesson.sections = lesson.sections.map(section => ({ - ...section, - id: section._id, - docValue: section.state, - notes: section.note, - })) - } - - dispatch({ type: "BOOTSTRAP", payload: lesson }) - } catch (err) { - dispatch({ type: "ERROR" }) - dispatch({ - type: "BOOTSTRAP", - payload: { - id: new Date().getTime(), - sections: [ - { - id: - new Date().getTime() + - "" + - Math.floor(Math.random() * 100), - docValue: null, - visible: true, - }, - ], - changed: new Set(), - }, - }) - } - requestAnimationFrame(() => { - dispatch({ type: "BOOTSTRAP_FINISH" }) - }) - } - - async function fetchCourse() { - try { - const courseId = window.location.pathname.split("/")[2] - const course = await api.get(`/courses/${courseId}`) - dispatch({ type: "SET_COURSE", payload: course }) - } catch (err) {} - } - - useEffect(() => { - fetchData() - fetchCourse() - }, []) -} - -export async function saveLesson(store, dispatch, override) { - if (!store.editing && !override) return - dispatch({ type: "SAVE_STATUS", payload: "Sichern..." }) - const savePromises = [] - - const lessonChanges = {} - store.lesson.changed.forEach(key => { - if (key === "order") { - lessonChanges.sections = store.lesson.sections.map( - section => section.id, - ) - } else { - lessonChanges[key] = store.lesson[key] - } - }) - if (store.lesson.changed.size !== 0) - savePromises.push( - new Promise(async resolve => { - try { - const lessonResult = await api.patch( - `/editor/lessons/${store.lesson.id}`, - lessonChanges, - ) - dispatch({ type: "LESSON_SAVED" }) - resolve(lessonResult) - } catch (err) { - resolve("error") - } - }), - ) - else savePromises.push(Promise.resolve("No lesson changes")) - - // save sections - store.lesson.sections.forEach(section => { - const sectionChanges = {} - let savedDocValue = JSON.parse(JSON.stringify(section.docValue)) - section.changed.forEach(key => { - if (key === "docValue") { - savedDocValue = - typeof section.docValue === "object" && - JSON.parse(JSON.stringify(section.docValue)) - - sectionChanges.state = buildDiff( - section.savedDocValue, - section.docValue, - ) - - dispatch({ type: "SECTION_SAVE_DOCVALUE", payload: section.id }) - } else if (key === "notes") { - sectionChanges.note = section.notes - } else { - sectionChanges[key] = section[key] - } - }) - if (Object.keys(sectionChanges).length === 0) { - return savePromises.push( - Promise.resolve(`No changes for section ${section.id}`), - ) - } - - savePromises.push( - new Promise(async resolve => { - try { - const backendResult = await api.patch( - `/editor/sections/${section.id}`, - sectionChanges, - null, - null, - { - success: true, - }, - ) - dispatch({ type: "SECTION_SAVED", payload: section.id }) - resolve(backendResult) - } catch (err) { - if ( - sectionChanges.hasOwnProperty("state") && - savedDocValue - ) { - dispatch({ - type: "SECTION_SAVE_DOCVALUE_FAILED", - payload: { - id: section.id, - lastSavedDocValue: savedDocValue, - }, - }) - } - resolve("error") - } - }), - ) - }) - - const results = await Promise.all(savePromises) - const cacheData = { - savedToBackend: true, - lesson: { - ...store.lesson, - sections: store.lesson.sections.map(section => ({ - ...section, - savedDocValue: undefined, - docValue: section.docValue, - })), - }, - } - - if (results.includes("error")) { - cacheData.savedToBackend = false - } - - saveEditorData(cacheData, store.lesson.id) - - dispatch({ - type: "SAVE_STATUS", - payload: !cacheData.savedToBackend - ? "Lokal Gespeichert" - : "Gespeichert", - }) + async function bootstrap() { + if (courseId) { + try { + const user = await serverApi.get("/me") + dispatchUserAction({ type: "BOOTSTRAP_USER", payload: user }) + } catch (err) { + dispatch(newError('Es konnten nicht alle Daten geladen werden, eventuell kommt es zu einschränkungen')) + } + } else { + console.warn('TODO: Set fake user with permissions.'); + } + + const cachedLessonData = loadLessonCache(id) + if ( + cachedLessonData && + Object.prototype.hasOwnProperty.call(cachedLessonData, 'sections') && + (cachedLessonData.savedToBackend === false || !editorWS.isConnected) + ) { + // TODO: compare timestamps and hash with server state and save if possible or set + // saved to true if hash is the same (needs server route, to do not send all data) + console.info('Data are loaded from cach', !cachedLessonData.savedToBackend) + dispatch(setLesson(cachedLessonData)) + const sections = loadSectionCache(...cachedLessonData.sections) + + dispatch(setSections(sections)) + + if(sections.length !== cachedLessonData.sections.length){ + const sectionsNotInChache = cachedLessonData.sections.filter(secId => !sections.find(section => section.id === secId)) + dispatch(fetchSection(...sectionsNotInChache)) + } + } else { + await dispatch(fetchLessonWithSections(id, courseId, true)) + } + + /* requestAnimationFrame(() => { + // dispatch({ type: "BOOTSTRAP_FINISH" }) + }) */ + } + + async function registerHandler(){ + + const dispatchLessonUpdate = (lesson) => + dispatch(lessonWasUpdated(lesson)) + + editorWS.on('course/:courseId/lessons patched', dispatchLessonUpdate) + editorWS.on('course/:courseId/lessons updated', dispatchLessonUpdate) + + const dispatchSectionUpdate = (data) => { + const { stateDiff, _id, ...section } = data + if(stateDiff){ + dispatch(mergeEditorDiff(_id, stateDiff)) + } + if(section){ + dispatch(sectionWasUpdated(_id, section)) + } + } + + editorWS.on('lesson/:lessonId/sections patched', dispatchSectionUpdate) + editorWS.on('lesson/:lessonId/sections updated', dispatchSectionUpdate) + } + + useEffect(() => { + dispatch(fetchCourse(courseId)) + bootstrap() + registerHandler() + }, []) } export function useChangeListener(store, dispatch) { - useEffect(() => { - if (!store.bootstrapFinished) return - dispatch({ type: "SAVE_STATUS", payload: "Ungesicherte Änderungen" }) - }, [store.lesson]) + const [timeout, setTimeoutState] = useState(null) + useEffect(() => { + if (!store.view.bootstrapFinished) return + // dispatch({ type: "SAVE_STATUS", payload: "Ungesicherte Änderungen" }) + + if (timeout) { + clearTimeout(timeout); + } else { + dispatch(unsavedChanges()); + } + + setTimeoutState(setTimeout(() => { + setTimeoutState(null) + dispatch(saveLesson()) + dispatch(saveSections()) + }, 1000) + ) + }, [store.lesson, store.sections]) } export function useFullScreenListener(store, dispatch) { - return true + return true } diff --git a/src/workspace/Lesson/index.jsx b/src/workspace/Lesson/index.jsx index 57d224387..4128186df 100644 --- a/src/workspace/Lesson/index.jsx +++ b/src/workspace/Lesson/index.jsx @@ -3,7 +3,7 @@ import styled from "styled-components" import config from "~/config" -import LessonContext from "~/Contexts/Lesson" +import LessonContext from "~/Contexts/Lesson.context" import UserContext from "~/Contexts/User" import { useInterval } from "~/utils/hooks" @@ -16,11 +16,13 @@ import Section from "./Section" import SectionOverview from "./SectionOverview" import { - useBootstrap, - useChangeListener, - useFullScreenListener, - saveLesson, + useBootstrap, + useChangeListener, + useFullScreenListener, } from "./hooks" +import { newError } from "~/Contexts/notifications.actions" +import { saveSections } from "~/Contexts/section.actions" +import { UserInformationError } from "~/utils/errors" const Wrapper = styled.div` position: relative; @@ -28,52 +30,56 @@ const Wrapper = styled.div` ` const Lesson = props => { - const { store, dispatch } = useContext(LessonContext) - const { store: userStore, dispatch: dispatchUserAction } = useContext( - UserContext, - ) - - let id = "TEST" - let courseId = "TEST_COURSE" - try { - const location = window.location.pathname - const regex = /courses[\/]([a-f0-9]{24})\/topics[\/]([a-f0-9]{24})/ - const [, _courseId, topicId] = regex.exec(location.toString()) - - if (topicId && _courseId){ - id = topicId - courseId = _courseId - } - } catch (err) { - //console.log('invalid url: have to look like /courses/:courseId/topics/:topicId') - } - - useBootstrap(id, courseId, dispatch, dispatchUserAction) - useChangeListener(store, dispatch) - useInterval(() => saveLesson(store, dispatch), 10000) - - useEffect(() => { - if (store.bootstrapFinished && store.editing === false) - saveLesson(store, dispatch, true) - }, [store.editing]) - - if (store.loading) { - return ( - - - - - - ) - } - - return ( - -
-
- - - ) + + const { store, dispatch } = useContext(LessonContext) + const { store: userStore, dispatch: dispatchUserAction } = useContext( + UserContext, + ) + + let id = "TEST" + let courseId = "TEST_COURSE" + try { + const location = window.location.pathname + if(!(location === '' || location === '/')){ + const regex = /courses[\/]([a-f0-9]{24})\/topics[\/]([a-f0-9]{24})/ + const [, _courseId, topicId] = regex.exec(location.toString()) + + if (topicId && _courseId){ + id = topicId + courseId = _courseId + } + } + } catch (err) { + console.log('invalid url: has to look like /courses/:courseId/topics/:topicId') + throw new UserInformationError(err, 'Die URL scheint nicht die nötigen Informationen zu beinhalten, bitte URL prüfen') + } + + + useBootstrap(id, courseId, dispatch, dispatchUserAction) + useChangeListener(store, dispatch) + + useEffect(() => { + if (store.view.bootstrapFinished && store.view.editing === false) + dispatch(saveSections()) + }, [store.view.editing]) + + if (store.view.loading) { + return ( + + + + + + ) + } + + return ( + +
+ +
+ + ) } export default Lesson diff --git a/src/workspace/index.jsx b/src/workspace/index.jsx index be9584b12..07b891a9a 100644 --- a/src/workspace/index.jsx +++ b/src/workspace/index.jsx @@ -1,14 +1,12 @@ -import React, { useEffect } from "react" -import Lesson from "./Lesson" -import Feedback from "./Feedback" +import React, { useEffect } from "react"; +import Lesson from "./Lesson"; const Workspace = () => { - return ( - - - - - ) -} + return ( + + + + ); +}; -export default Workspace +export default Workspace;