From d003138333edc1f6bd4064deb7bb781df43b62d3 Mon Sep 17 00:00:00 2001 From: Samu Lang Date: Mon, 5 Apr 2021 23:16:27 +0100 Subject: [PATCH] Review by @matthieubosquet Add codecov integration to GitHub action Publish package to NPM from GitHub action Encode/decode SPARQL properly when adding to URL fragment Use TypeScript linting and fix warnings Demo webroot is only in /docs Add blank text to literals in toolbox Extract alias types Validate LANGTAG in langString Add description to lib package Remove unused dependency from lib package --- .github/workflows/{node.js.yml => ci.yml} | 4 + .github/workflows/publish.yml | 19 + .gitignore | 1 + README.md | 5 +- demo/.eslintrc.json | 11 + demo/.gitignore | 1 - demo/package-lock.json | 1112 ++++++++++++++++- demo/package.json | 11 +- demo/src/AppMain.ts | 8 +- demo/src/SparqlEditor.ts | 4 +- demo/wwwroot/browserconfig.xml | 12 - demo/wwwroot/icons/android-chrome-192x192.png | Bin 1860 -> 0 bytes demo/wwwroot/icons/android-chrome-512x512.png | Bin 4969 -> 0 bytes demo/wwwroot/icons/apple-touch-icon.png | Bin 1555 -> 0 bytes demo/wwwroot/icons/favicon-16x16.png | Bin 478 -> 0 bytes demo/wwwroot/icons/favicon-32x32.png | Bin 610 -> 0 bytes demo/wwwroot/icons/favicon.ico | Bin 15086 -> 0 bytes demo/wwwroot/icons/mstile-150x150.png | Bin 1256 -> 0 bytes demo/wwwroot/icons/mstile-310x150.png | Bin 1378 -> 0 bytes demo/wwwroot/icons/mstile-310x310.png | Bin 2717 -> 0 bytes demo/wwwroot/icons/mstile-70x70.png | Bin 1148 -> 0 bytes demo/wwwroot/icons/safari-pinned-tab.svg | 15 - demo/wwwroot/index.html | 58 - demo/wwwroot/manifest.webmanifest | 20 - demo/wwwroot/style.css | 72 -- demo/wwwroot/toolbox.xml | 757 ----------- docs/app.js | 2 +- docs/toolbox.xml | 418 ++++--- package/.eslintrc.json | 11 + package/index.d.ts | 2 + package/package-lock.json | 866 ++++++++++++- package/package.json | 11 +- package/src/Block.ts | 11 +- package/src/BlockGenerator.ts | 34 +- package/src/CodeGenerator.ts | 17 +- package/src/StringifiedMap.ts | 6 +- package/src/aliases.ts | 67 + package/src/blocks.ts | 11 +- package/src/index.ts | 3 +- package/types/sparqljs/index.d.ts | 4 +- 40 files changed, 2389 insertions(+), 1184 deletions(-) rename .github/workflows/{node.js.yml => ci.yml} (81%) create mode 100644 .github/workflows/publish.yml create mode 100644 demo/.eslintrc.json delete mode 100644 demo/wwwroot/browserconfig.xml delete mode 100644 demo/wwwroot/icons/android-chrome-192x192.png delete mode 100644 demo/wwwroot/icons/android-chrome-512x512.png delete mode 100644 demo/wwwroot/icons/apple-touch-icon.png delete mode 100644 demo/wwwroot/icons/favicon-16x16.png delete mode 100644 demo/wwwroot/icons/favicon-32x32.png delete mode 100644 demo/wwwroot/icons/favicon.ico delete mode 100644 demo/wwwroot/icons/mstile-150x150.png delete mode 100644 demo/wwwroot/icons/mstile-310x150.png delete mode 100644 demo/wwwroot/icons/mstile-310x310.png delete mode 100644 demo/wwwroot/icons/mstile-70x70.png delete mode 100644 demo/wwwroot/icons/safari-pinned-tab.svg delete mode 100644 demo/wwwroot/index.html delete mode 100644 demo/wwwroot/manifest.webmanifest delete mode 100644 demo/wwwroot/style.css delete mode 100644 demo/wwwroot/toolbox.xml create mode 100644 package/.eslintrc.json create mode 100644 package/src/aliases.ts diff --git a/.github/workflows/node.js.yml b/.github/workflows/ci.yml similarity index 81% rename from .github/workflows/node.js.yml rename to .github/workflows/ci.yml index d8df6a8c..feddc60b 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/ci.yml @@ -29,3 +29,7 @@ jobs: - run: npm ci - run: npm run build --if-present - run: npm test + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..8ff592e7 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,19 @@ +name: Publish to NPM + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '12.x' + registry-url: 'https://registry.npmjs.org' + - run: npm install + - run: npm publish package + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 8fb34ba6..c169bad3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules .vs obj bin +.eslintcache diff --git a/README.md b/README.md index df4c631b..67d980fd 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # sparql-blockly -[![Build Status](https://github.com/langsamu/sparql-blockly/actions/workflows/node.js.yml/badge.svg)](https://github.com/langsamu/sparql-blockly/actions) -[![npm version](https://badge.fury.io/js/sparql-blockly.svg)](https://badge.fury.io/js/sparql-blockly) +[![Build Status](https://github.com/langsamu/sparql-blockly/actions/workflows/ci.yml/badge.svg)](https://github.com/langsamu/sparql-blockly/actions) +[![npm version](https://badge.fury.io/js/sparql-blockly.svg)](https://www.npmjs.com/package/sparql-blockly) +[![codecov](https://codecov.io/gh/langsamu/sparql-blockly/branch/main/graph/badge.svg?token=X55Y21AMAE)](https://codecov.io/gh/langsamu/sparql-blockly) ## [Online demo](https://langsamu.github.io/sparql-blockly/) diff --git a/demo/.eslintrc.json b/demo/.eslintrc.json new file mode 100644 index 00000000..70340a64 --- /dev/null +++ b/demo/.eslintrc.json @@ -0,0 +1,11 @@ +{ + "root": true, + "parser": "@typescript-eslint/parser", + "plugins": [ + "@typescript-eslint" + ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ] +} \ No newline at end of file diff --git a/demo/.gitignore b/demo/.gitignore index 18b42c0c..8270b13d 100644 --- a/demo/.gitignore +++ b/demo/.gitignore @@ -1,2 +1 @@ transpiled -wwwroot/app.js diff --git a/demo/package-lock.json b/demo/package-lock.json index c5d9183f..6e4aa7c7 100644 --- a/demo/package-lock.json +++ b/demo/package-lock.json @@ -2,6 +2,114 @@ "requires": true, "lockfileVersion": 1, "dependencies": { + "@babel/code-frame": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.10.4" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", + "dev": true + }, + "@babel/highlight": { + "version": "7.13.10", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.10.tgz", + "integrity": "sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.12.11", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + } + } + }, + "@eslint/eslintrc": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.0.tgz", + "integrity": "sha512-2ZPCc+uNbjV5ERJr+aKSPRwZgKd2z11x0EgLvb1PURmUrn9QNRXFqje0Ldq454PfAVyaJYyrDvvIKSFP4NnBog==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "globals": { + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "dev": true, + "requires": { + "type-fest": "^0.8.1" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + } + } + }, + "@nodelib/fs.scandir": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", + "integrity": "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.4", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", + "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", + "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.4", + "fastq": "^1.6.0" + } + }, "@rdfjs/term-map": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@rdfjs/term-map/-/term-map-1.0.0.tgz", @@ -23,6 +131,12 @@ "resolved": "https://registry.npmjs.org/@rdfjs/to-ntriples/-/to-ntriples-1.0.2.tgz", "integrity": "sha512-ngw5XAaGHjgGiwWWBPGlfdCclHftonmbje5lMys4G2j4NvfExraPIuRZgjSnd5lg4dnulRVUll8tRbgKO+7EDA==" }, + "@types/json-schema": { + "version": "7.0.7", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz", + "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==", + "dev": true + }, "@types/node": { "version": "14.14.37", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.37.tgz", @@ -36,6 +150,122 @@ "@types/node": "*" } }, + "@typescript-eslint/eslint-plugin": { + "version": "4.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.20.0.tgz", + "integrity": "sha512-sw+3HO5aehYqn5w177z2D82ZQlqHCwcKSMboueo7oE4KU9QiC0SAgfS/D4z9xXvpTc8Bt41Raa9fBR8T2tIhoQ==", + "dev": true, + "requires": { + "@typescript-eslint/experimental-utils": "4.20.0", + "@typescript-eslint/scope-manager": "4.20.0", + "debug": "^4.1.1", + "functional-red-black-tree": "^1.0.1", + "lodash": "^4.17.15", + "regexpp": "^3.0.0", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "dependencies": { + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + } + } + }, + "@typescript-eslint/experimental-utils": { + "version": "4.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.20.0.tgz", + "integrity": "sha512-sQNlf6rjLq2yB5lELl3gOE7OuoA/6IVXJUJ+Vs7emrQMva14CkOwyQwD7CW+TkmOJ4Q/YGmoDLmbfFrpGmbKng==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/scope-manager": "4.20.0", + "@typescript-eslint/types": "4.20.0", + "@typescript-eslint/typescript-estree": "4.20.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + } + }, + "@typescript-eslint/parser": { + "version": "4.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.20.0.tgz", + "integrity": "sha512-m6vDtgL9EABdjMtKVw5rr6DdeMCH3OA1vFb0dAyuZSa3e5yw1YRzlwFnm9knma9Lz6b2GPvoNSa8vOXrqsaglA==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "4.20.0", + "@typescript-eslint/types": "4.20.0", + "@typescript-eslint/typescript-estree": "4.20.0", + "debug": "^4.1.1" + }, + "dependencies": { + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + } + } + }, + "@typescript-eslint/scope-manager": { + "version": "4.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.20.0.tgz", + "integrity": "sha512-/zm6WR6iclD5HhGpcwl/GOYDTzrTHmvf8LLLkwKqqPKG6+KZt/CfSgPCiybshmck66M2L5fWSF/MKNuCwtKQSQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.20.0", + "@typescript-eslint/visitor-keys": "4.20.0" + } + }, + "@typescript-eslint/types": { + "version": "4.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.20.0.tgz", + "integrity": "sha512-cYY+1PIjei1nk49JAPnH1VEnu7OYdWRdJhYI5wiKOUMhLTG1qsx5cQxCUTuwWCmQoyriadz3Ni8HZmGSofeC+w==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "4.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.20.0.tgz", + "integrity": "sha512-Knpp0reOd4ZsyoEJdW8i/sK3mtZ47Ls7ZHvD8WVABNx5Xnn7KhenMTRGegoyMTx6TiXlOVgMz9r0pDgXTEEIHA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.20.0", + "@typescript-eslint/visitor-keys": "4.20.0", + "debug": "^4.1.1", + "globby": "^11.0.1", + "is-glob": "^4.0.1", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "dependencies": { + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + } + } + }, + "@typescript-eslint/visitor-keys": { + "version": "4.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.20.0.tgz", + "integrity": "sha512-NXKRM3oOVQL8yNFDNCZuieRIwZ5UtjNLYtmMx2PacEAGmbaEYtGgVHUHVyZvU/0rYZcizdrWjDo+WBtRPSgq+A==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.20.0", + "eslint-visitor-keys": "^2.0.0" + } + }, "JSONStream": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", @@ -65,6 +295,12 @@ "acorn-walk": "^7.1.1" } }, + "acorn-jsx": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", + "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", + "dev": true + }, "acorn-node": { "version": "1.8.2", "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.8.2.tgz", @@ -100,12 +336,48 @@ "uri-js": "^4.2.2" } }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, "array-filter": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-1.0.0.tgz", "integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=", "dev": true }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, "asn1": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", @@ -166,6 +438,12 @@ "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" }, + "astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true + }, "async": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", @@ -249,6 +527,15 @@ "concat-map": "0.0.1" } }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, "brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", @@ -477,11 +764,68 @@ "get-intrinsic": "^1.0.2" } }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "cipher-base": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", @@ -492,6 +836,21 @@ "safe-buffer": "^5.0.1" } }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, "colors": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", @@ -618,6 +977,17 @@ "sha.js": "^2.4.8" } }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, "crypto-browserify": { "version": "3.12.0", "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", @@ -772,6 +1142,24 @@ } } }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, "domain-browser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", @@ -846,6 +1234,21 @@ } } }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + } + }, "es-abstract": { "version": "1.18.0", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0.tgz", @@ -881,6 +1284,12 @@ "is-symbol": "^1.0.2" } }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, "escodegen": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz", @@ -893,11 +1302,190 @@ "source-map": "~0.6.1" } }, + "eslint": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.23.0.tgz", + "integrity": "sha512-kqvNVbdkjzpFy0XOszNwjkKzZ+6TcwCQ/h+ozlcIWwaimBBuhlQ4nN6kbiM2L+OjDcznkTJxzYfRFH92sx4a0Q==", + "dev": true, + "requires": { + "@babel/code-frame": "7.12.11", + "@eslint/eslintrc": "^0.4.0", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^13.6.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash": "^4.17.21", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^6.0.4", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + } + } + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "dependencies": { + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + } + } + }, + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", + "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", + "dev": true + }, + "espree": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "dev": true, + "requires": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, + "esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + } + }, "estraverse": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", @@ -945,6 +1533,20 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "fast-glob": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", + "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" + } + }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -961,6 +1563,49 @@ "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==", "dev": true }, + "fastq": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", + "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz", + "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", + "dev": true + }, "follow-redirects": { "version": "1.13.3", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.3.tgz", @@ -1000,6 +1645,12 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, "get-assigned-identifiers": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz", @@ -1039,6 +1690,46 @@ "path-is-absolute": "^1.0.0" } }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globals": { + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.7.0.tgz", + "integrity": "sha512-Aipsz6ZKRxa/xQkZhNg0qIWXT6x6rD46f6x/PCnBomlttdIyAPak4YD9jTmKpZ72uROSMU87qJtcgpgHaVchiA==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + }, + "dependencies": { + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + } + } + }, + "globby": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.3.tgz", + "integrity": "sha512-ffdmosjA807y7+lA1NM0jELARVmYul/715xiILEjo3hBLPTcirgQNnXECn5g3mtR8TOLCVbkfua1Hpen25/Xcg==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + } + }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -1068,6 +1759,12 @@ "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", "dev": true }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, "has-symbols": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", @@ -1198,6 +1895,28 @@ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "dev": true }, + "ignore": { + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "dev": true + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -1300,18 +2019,45 @@ "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", "dev": true }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, "is-generator-function": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.8.tgz", "integrity": "sha512-2Omr/twNtufVZFr1GhxjOMFPAj2sjc/dKaIqBhvo4qciXfJmITGH6ZGd8eZYNHza8t1y0e01AuqRhJwfWp26WQ==", "dev": true }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, "is-negative-zero": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", "dev": true }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, "is-number-object": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.4.tgz", @@ -1372,11 +2118,33 @@ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", @@ -1432,6 +2200,12 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -1478,12 +2252,39 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, + "lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", + "dev": true + }, + "lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", + "dev": true + }, "lodash.memoize": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=", "dev": true }, + "lodash.truncate": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", + "integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=", + "dev": true + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, "md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -1495,6 +2296,22 @@ "safe-buffer": "^5.1.2" } }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, "miller-rabin": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", @@ -1603,6 +2420,12 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, "ncp": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz", @@ -1689,6 +2512,15 @@ "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", "dev": true }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, "parents": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parents/-/parents-1.0.1.tgz", @@ -1728,6 +2560,12 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, "path-parse": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", @@ -1740,6 +2578,12 @@ "integrity": "sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I=", "dev": true }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, "pbkdf2": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz", @@ -1758,6 +2602,12 @@ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "dev": true + }, "portfinder": { "version": "1.0.28", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz", @@ -1786,6 +2636,12 @@ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, "psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -1835,6 +2691,12 @@ "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", "dev": true }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -1903,6 +2765,12 @@ } } }, + "regexpp": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", + "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", + "dev": true + }, "request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", @@ -1970,6 +2838,12 @@ } } }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true + }, "requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", @@ -1986,6 +2860,27 @@ "path-parse": "^1.0.6" } }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, "ripemd160": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", @@ -1996,6 +2891,15 @@ "inherits": "^2.0.1" } }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -2020,6 +2924,15 @@ "integrity": "sha1-8aAymzCLIh+uN7mXTz1XjQypmeM=", "dev": true }, + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, "sha.js": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", @@ -2039,6 +2952,21 @@ "fast-safe-stringify": "^2.0.7" } }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, "shell-quote": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.2.tgz", @@ -2051,6 +2979,49 @@ "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", "dev": true }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + } + } + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -2058,9 +3029,9 @@ "optional": true }, "sparql-blockly": { - "version": "0.0.4-5", - "resolved": "https://registry.npmjs.org/sparql-blockly/-/sparql-blockly-0.0.4-5.tgz", - "integrity": "sha512-exyQMUNgPb7MRnrNSfakq0+H4TLngWcciXJogu6D4f83QwespKb3yi9gFZ8j9MpfSMo2WUyNRasLendX1P5feQ==", + "version": "0.0.4-9", + "resolved": "https://registry.npmjs.org/sparql-blockly/-/sparql-blockly-0.0.4-9.tgz", + "integrity": "sha512-Pu9b6Yvlt9R+cO1Spgkj8cf+cO1R64TCe4q8OQxqKs7QrV/0iW0lZcP/ovahj3uNvYx74HfrjAsac5gnYII2KA==", "requires": { "@rdfjs/term-map": "^1.0.0", "@rdfjs/term-set": "^1.0.1", @@ -2076,6 +3047,12 @@ "rdf-data-factory": "^1.0.4" } }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, "sshpk": { "version": "1.16.1", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", @@ -2165,6 +3142,17 @@ "readable-stream": "^2.0.2" } }, + "string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, "string.prototype.trimend": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", @@ -2194,6 +3182,21 @@ "safe-buffer": "~5.2.0" } }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, "subarg": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", @@ -2203,6 +3206,15 @@ "minimist": "^1.1.0" } }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, "symbol-tree": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", @@ -2217,6 +3229,49 @@ "acorn-node": "^1.2.0" } }, + "table": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/table/-/table-6.0.9.tgz", + "integrity": "sha512-F3cLs9a3hL1Z7N4+EkSscsel3z55XT950AvB05bwayrNg5T1/gykXtigioTAjbltvbMSJvvhFCbnf6mX+ntnJQ==", + "dev": true, + "requires": { + "ajv": "^8.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "lodash.clonedeep": "^4.5.0", + "lodash.flatten": "^4.4.0", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.0" + }, + "dependencies": { + "ajv": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.0.5.tgz", + "integrity": "sha512-RkiLa/AeJx7+9OvniQ/qeWu0w74A8DiPPBclQ6ji3ZQkv5KamO+QGpqmi7O4JIw3rHGUXZ6CoP9tsAkn3gyazg==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + } + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -2242,6 +3297,15 @@ "process": "~0.11.0" } }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, "tough-cookie": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", @@ -2260,6 +3324,21 @@ "punycode": "^2.1.1" } }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, "tty-browserify": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", @@ -2287,6 +3366,12 @@ "prelude-ls": "~1.1.2" } }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", @@ -2407,6 +3492,12 @@ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" }, + "v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", @@ -2467,6 +3558,15 @@ "webidl-conversions": "^6.1.0" } }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, "which-boxed-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", @@ -2526,6 +3626,12 @@ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true } } } diff --git a/demo/package.json b/demo/package.json index f86d40c1..55002b1a 100644 --- a/demo/package.json +++ b/demo/package.json @@ -1,21 +1,24 @@ { "homepage": "https://langsamu.github.io/sparql-blockly/", "scripts": { - "start": "http-server wwwroot", - "build": "tsc --build && browserify transpiled/index.js --debug > transpiled/bundle.js && uglifyjs --compress -- transpiled/bundle.js > wwwroot/app.js", + "start": "http-server ../docs", + "build": "tsc --build && browserify transpiled/index.js --debug > transpiled/bundle.js && uglifyjs --compress -- transpiled/bundle.js > ../docs/app.js", "clean": "tsc --build --clean", - "deploy-docs": "ncp wwwroot ../docs" + "lint": "eslint --cache --ext .ts --ignore-path .gitignore ." }, "devDependencies": { "@types/node": "^14.14.37", "typescript": "^4.2.3", + "@typescript-eslint/eslint-plugin": "^4.20.0", + "@typescript-eslint/parser": "^4.20.0", + "eslint": "^7.23.0", "browserify": "^17.0.0", "uglify-js": "^3.13.3", "http-server": "^0.12.3", "ncp": "^2.0.0" }, "dependencies": { - "sparql-blockly": "^0.0.4-5", + "sparql-blockly": "^0.0.4-13", "sparqljs": "^3.4.1", "blockly": "^5.20210325.0" } diff --git a/demo/src/AppMain.ts b/demo/src/AppMain.ts index d81390ad..c948a3ed 100644 --- a/demo/src/AppMain.ts +++ b/demo/src/AppMain.ts @@ -34,12 +34,12 @@ export class AppMain extends HTMLElement { } private updateUrl() { - window.location.hash = this.sparql.value + window.location.hash = encodeURIComponent(this.sparql.value) } private blocksLoaded() { - const h = window.location.hash.split("#")[1] - if (h) - this.sparql.setAndNotify(decodeURI(h)) + const hash = window.location.hash.split("#")[1] + if (hash) + this.sparql.setAndNotify(decodeURIComponent(hash)) } } diff --git a/demo/src/SparqlEditor.ts b/demo/src/SparqlEditor.ts index 5cd302ce..353f3dba 100644 --- a/demo/src/SparqlEditor.ts +++ b/demo/src/SparqlEditor.ts @@ -18,7 +18,7 @@ export class SparqlEditor extends HTMLElement { this.errorElement.innerText = value } - public get value() { + public get value(): string { return this.editorElement.value } @@ -27,7 +27,7 @@ export class SparqlEditor extends HTMLElement { this.validate() } - public setAndNotify(value: string) { + public setAndNotify(value: string): void { this.editorElement.value = value this.input() } diff --git a/demo/wwwroot/browserconfig.xml b/demo/wwwroot/browserconfig.xml deleted file mode 100644 index b7eb296d..00000000 --- a/demo/wwwroot/browserconfig.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - #ffffff - - - diff --git a/demo/wwwroot/icons/android-chrome-192x192.png b/demo/wwwroot/icons/android-chrome-192x192.png deleted file mode 100644 index 137245bda0aa0f3df38af8a834ef78c43dc41427..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1860 zcmV-K2fO%*P)Px#icm~cMNDaN!;p}OOiWvnWP?nJ%%i55Yih!ek+!n4 zrmdZ%cY9WiV3Jjsm28QQ!I#96l8af9jJ%X-n{k<8VZV~ZlUZ4xaio>Lov&3n+@P@HM8r2o000Hh zNkl5VnL%ET5ZVy^OazYLtieyVj@=Y%mILp0!+XG0MMxmAw3=N z9S3uOt{{LomIz>tCzG**L;}RKSu>UeK!au<6xwVmBnE)SANo$ne}4Cy7GH7bT(9v<|57Frf!|46b zuy_YTnQO3O5Yl({P!2)>@TUNL0Qm4jEE53z0RUKpeRv(;&>Y}A8$B!d0<0Ab-9|>C%`>5S* z=0Alv)t}4D$=AAkCfslLv7T57`SXXpd)V4dMod@d61}MT$({x!;x<1ylTVJ)R zQP4+H0gAMy%k8wPZJJh0;O(xP-70gjRDe9LWldb$OB2fUKaPKz$OVY=`0GPCnGipn ze(3-|#m`MBMx`gyFTD%Jv*Z2vxe0r!XVWj;0cOCDkx>(JEuW2FF2ExLa)eydrAJR#0H--LvPG8eWC0|Jz^s1+z{LOn0KWn-5dZ)H0O$;m={^em9RSqt zV;uoV;uqhAN9i&^Is#;DI*p^0RR{vCAHbBD2uGc~_Cj=A&`|O41&^r`0j8(Yk*)xr zs?3Q8$aDut006qsA9a9`tRix6TA?NY$&xG86VPTZMqKIuu=07bKYUlUCv}+a_khb% z27qOM|Gl}nH8_pmRg1 z3c!yB68%Z)gbMsaBnS6`-d*00IC200000002-5;PBF9 zuAE9BOT_8#j{zWSu-RCO0GO|>$k-GVw^@y1=O85jg25|`dT&I-9~3nfMb-mB`y~s$ zMuW0Mq{xaaz=PN7DyIsOB5UHnc+mpIDszcxPz!eY0%Rtl1R4Vn_N5~p=nF8-*w%X7 z(-(l`+h_2|^E3sRlK!buU3*#YN5#Y#LKi(drBKwy_)p*eD$`REz>mW*PZq+>gd(~m?P<*bD*Ct^#-szqAifzg|Ki7Bs+jnB$z<%%^pqLz=AuG_E&ehR3G90Fz<31Eu@jrW2;bJwPHyVxZt>)$Vfcyl?o_eJu zK+bSS$Ku2f8(og zaB^>EX>4U6ba`-PAZc)PV*mhnoa6Eg2ys>@D9TUE%t_@^00ScnE@KN5BNI!L6ay0= yM1VBIWCJ6!R3OXP)X2ol#2my2%YaCrN-hBE7ZG&wLN%2D0000bGxZjVE8Du*IDUD&4* zr=(pHa+{*)hHff~Eh$Apxs-kRO`U&!??3P7oq0YpYt77B``O=Teb-tue|UQ?RZ-Mc z1OSy~?yf!n7%gJJWYDMjb2FOg6TZpi7Z-rb8A{@HaQ zw(PuJT3&Uh^4OM5ZMPeC3lozrrv2`b_NeJDmHy}5yu9q>^dk)?sI1)Lu&~o9h0RwQ z3j+fK&uz{RJeTV3ej`2o5OvgjzfX1gjqoBI;5N z4G{sP0VCq7_d1Ni0jQicP z4*`istnE~VlR4tWtOy4r%>>nolXo1!om`akJf(YQ>DC0_yOFRfD=P)B=#kBuQ~PJn zIXP61CMt`xkh(xecC=>cLo>Yd(j5@{d4Ql^cDyc~lesh*xhEzL8UgfLSrpf1NBFbR zx_MCWxjWv`*+c~!VLL(*iqODr+~$Ef%G|I*Aus6F^h|!AJ-i;*Cf72X&fI_?u|=0u z>CL$|B@@U@AF|Q6F&itCHh%JD>dm#EEoHg?1ax=Q#V%~n_HyiGjX=Z9> zPI(Th)b+5OsGwyn8g*Ug7y^01Af{iqTC>86xqB_yp)ER&{d0xCN2=iFM}{^Oo+9U2 z2RU?N8*JnFpZFPa3g)VPw2_I8Y z5Y%!wO|NcA2Lep65^L^&(0M_LP3SYS-AZ64eRg`v{@LHiw=u{=+){8Xd`hC#M1xL& z(wu|*t^C!AD@>!~HXI7!U*1%0IoXsOHbp0G*M#BX-X5(|m(ftLZgqSpP(K%heYAMrRWdf^b9Rv=~oP2*f3-#EmWd5{HA#4hUcAE}nX&=&Zz z*Ez}}=20R{SVH3dSuu}f`Gzo|4@Yjpr!((LvYDS86+tw0GV4vGz2u`2Ul~0ucoY_2 zvzVX22DgsTukYd?JlzyLCteLG!7$(Fe#W;uhU(bdv!gZ5JjwDhAdQme4X0keq~2g#)g5(56(DscDHDKuoArOt=ZF~M- z`i-yh5oHYVS!g0)mI=B&Mw$eW`~xBCyq9D8@(fP!gNz<+3n3 zKrDk72@})fWEMkh2Tz1r$|4;ZP=(S;cF1CG2B?{tFx6pj9ON0^Z|X+IHgTVFnot^0 zop=*k{iIW-+Mt!R+zH4s&{X4B-N-Ia`@HY(<;lWaL_URybhW&FM43GosCEPH_EqF8 z-2BQJEE7)6C0^R!yRe9-2IMPsd(0PQd zHdCiQRME)llF{_!3K0iHk!%1}Q^HB<3sCRXIdb$BY>qob#Q|^;P{~4klc?g9 zg8WE-tlOz2{S9B>S8IV2+izg}OjCIwn~Sbb7ucu_H3Ue~?uHo0fKZ!UeM-J5aPo16 zF@n8}h#I3}ZGM@n(7*VWBN4juA%1p@?|&Ie8Hcu4?8X1qt+2fPl7-(SAH2YY(-^~KFuIDBMrp51p2FHikVH<{S;k8h*@UIcw| zM42q|!}UBVOuA zYhGD!`lexX>+AYcF|yV`bZw?yXx$;PH6>g#TuZfB^TN>233iL{eCPEwFdS%4eprz7`D>>1Cz&p7z8ScQS+W*I=;fM#q9jDdMSv zNf`2w+1}I$DXW{wm2FdkPlL!)gCU$!*_iY^yq^hVFDqiI?DSPT&Iw(##2%=Oi!9+b zJAI}#K9UgyJX@Ij=46>yVUv6;KKCJGwF(v9@XknBtc$bYnh90FsFvt5Dt+4&u5IJ2 zvxSZvHG`%HT9BoxB~MQABd=&Y{|%!U5Ee(q886HXsj|J#SLe|r984Qe$#$bbH-_iB z*QT0%M+#AY8;C@Re9RIar;l{&8KFx$LPZDN(X)gv=|ln`GKWBjsQPdGhQ#f|4gH* ze%(7nnt+&vHoq|BmOCG10^!9TS_$~B00YZSLGroB;qxn31-Gkn@a(Zoa8i!WX2gmq zX!Kd~y)Vw1rpklL{dl?@;klZj3E1T-M_!~BP?K@wdvIq}tkrMYFL}|pP4gck6zXe@ zCeJHvyDYOY0#OaD&_t&TCT7F7=X2IFAVwwkt*FB4O~EsJ@q?;gH*8~De%`BLFfHa? zL`?l&wRyHE^tI*t_cz`xb|Ceqo>3x~84ExZ-^rjhzzPHOZuh(7dKels;2nNYR+vu4 zdHu#U9C%o_I^n}~PRC3~(ia-;F63UqI(m=b z5lphEO+Iv7&gNbQ0dVyTOhu#2+?cA@_Y}ZZoqM3?#3l>IV}V(JRdwJ z`J$fhAP4r4_IgRr!7(c%Ax_?jqm!*9$JP?7{BVcr7*K$@tW3$5OKnjR*iQ}XIvB}O zbTD3rJ}!47_1Q<*i850q>M8U{A4d5xC8Hch(`S%z4@=qcDE_f&IaqXa&PwuFc%z zNP7y|Ff5a>EPc4kpV{-&u<4D#DNs0Zj_4=!@M)LKS5C~pQ~s<|Mu#{RTQWZe&%98_ zLhB_h^}df0{l5EHbM-IP8_3Jz(a{@Bkq>tN7Nz@kF{Lk?kJ-(pGTu;6$jafRuvD%h z$T%_89CzbKxn=an5(l6;k~9<_xpPylGd47TdWoD}E`0KBxmcGcC8nViMN18A^rfmC zlj~15a*9S-sQNvO>sw0Is8U?mepa6D4N#sE$C&Jz21xu1IcqUol6!6hn0t5(tW#jtX4TA8SenT3<$jj-WJEZL6Frs{)8b0(xC`kT zqC&ty=4SKBu@pXs@Z4 z+37^`u*XkWvjIoDJZl^2LslS4oW&umtsc3h3VY1 zvFrYXF=>ivK3I(7>vW?UOODdI0<8~ro6US!>l~|HeKAeiu89lh5stMRE)d1CBrLXP zbSdbauRh*+&-jl=HLs$#ZfZ0{#eI1ayQq`)3S%}G&Q6=g$Av}~4%&nLIWtyfpKBQ# z4i3=%bnnvmiN7&i=uU2AnCr%S>DHByKTA!uOim<0j+(bYTi4^+%wSctTfFgASMQV@ zs``V9UG2^@1ydID7D|hUWQlsKmF2SyKfQc8ypO{Z|EeL{O2iqs+py8?E*G?2K0Ec= z;c#8-P+b-lbdczhYx^FNhw3h1I!3Mb5ev<Z@KwUT}f)8DXyrqm$1614JqJ+GYf5S{<0FZASf$ z9z?iqeBre@)*{N+yN&b zM+ebaY6fuWy%o`A;`?q-zhE=TAA?XJ=qB}hRMVpmm<0W0Lc+?ACGA#T5QaFCC22;_Yp$Z-@&F3Rnkp&o+)6fN6Aw`obT1?zi-z>7AU;cUac)Z zh<-32)^ByB&$=jX#I7BoTefZFM#e;J7m9(ngz%VZLPx#T~JI^MW*VN)iF2LAq^5j)aj|@bPK?*z*s5``lUJI} zv9pMZkBwqmzS+WUhji&R;zs}g1o25kK~#9!?cIHMvLF-y@WdeV6(mDV`~DyE0ko!R z%`HNCcJKDbI`f?Uy5|nLinI$Hj2)l>4QN0E8qk0SG@tr0a4nu4LjS#Yi#`SI&ckI-EE5G}uV_QHoE%oL30Q>Kt_j{kQ zx4w=v@62S{MYQEi#|~yXb+D!}plx0EFm@Whjnmiyx}Pw~c@8phMr3u$ zK9BCkJUKPnpWZ4IJ@>$2>c{@a=N_`Cd$M@1ypi9LMk{pmFGAqg(Mz-qmB+MJv%9i0WkPf6)1NwIW*P@u^59J8$y*+ceup=TEb!lda-g zvSqYN^b1R*99N0D5vbd=`n{fJ}9R!2*- z%wc&PM>$A#m*)Es)p>O^Rpv)>$Ck-f(Wm*iA#^51bLKADdMvq)-_`nPna3nK&WEaO z6%WO;K013+9QR}=lX_ntEff9RJRhs0>C=jy#Q9up2))?czr78hFH6xC3$Q5lPuLN3 zbx!o`R#P5=#PKm+<$XG9l=yy}RT zEk>|}UNoPsy3;rdlZ360CJUPYHBG{y>b+iG_OOHI;llc;vFO^xDp?=R7N%PE=6&a~ zb`x;$IIfc)Hn!F3mk>z6e%Oz1;JQbFrP?txjif+0hCXEKmS*S}ni4e@h_b3GchHAO z-#x}*c^*VHXT8Vz=z_C;Rw3%I+ZW}Gx$1vccyaL{Vu@wzLW%B8vU!mi01D zbGWUwrs}}}&fCY}mqD5@yxrOY*{CSUOk64*$}C^CPApQ1B6`)M#g(dO9h|v0PWAm; z3ODo@p)W3?Q(icTZjGec?h{3|Acb@2G%%8C+i1)UsO>)5cajYiaV*n%QyNjYh2A0c z2sbUL%4RgLQ0EHXW^Un+dy__QTtCTJaTx&MaaR zuY%b`OLaZ{gSZ_ozEf$Ae)@3PN6}K9)**Y`kwFx6m}X*Rw?C6xWyHSkPj<=nbNW@y zd79#lq4gd>(`c@GT=2Z>Nxt&M=Fn;vpz)VJ_2_}2acuh+WOJ`xQ)t*|2he~9G@t?f z-=JB&Hxo9|0XvzA&?Y+A&PV6K2P**@(0~RspaBhNKm!`kzmI<#D`QWYpmv@B0038d zR9JLUVRs;Ka&Km7Y-J#Hd2nSQX>fF7004NLPx#Y*0*8MNDaNT%>8ESXriATaa8znM}i?BPRw4xr2A z^%HGv3;Y6iv%>%Y09SfcSaechcOY6Cgx@G{a;ABePT>%h=S&#LUDT#0SfONT5nC0O}VJ Ubn-$ql>h($07*qoM6N<$fPx#bx=%HMNDaNkC%p@S67~BrLSpe%AK8On{T3ATe5F& zhg@BkS)HI{e4K1*VV-MQqGnc?Vw_=LS)pgFVq#^ibAFI;Wu|YiZEa(#aCMk@ai(>a zT%4L%p`Bc$pLC_1R#vB5TU(}RS*B;7Tc&fEZJK3Xf_jULc4B60@u~m-03UQxPE!CN z%l^&~{{EH>v`Az*^-*=^?&5~`u*uxChw|LE%SI&dyZ`_I{YgYYR5;6(lk1j(AQVO= z4N_3i@K(*pLG=9}ad2v_NDr;rf6rbYAGav_jP&S(2r}{E+c6=h@d;ycE3}8&n@h1x zI3}YX!1oPW#(aUKTY<~gi%4p*&v=w%*0Qw)SwRFlQ93PlY0i!=-wABe0J@Hy2`lpZ*K)- zGQy+xLSUOuf#V6f`nd}xP*NA_l4UnzuGs|_bkhw(KhHgK7rpktZc}wd;f@*pL4+|8 zN(~gKDpykE$<+?K*zlWtAoqeec>D_N_r4H)!5`LiGc$90GYS9z09SfcSaechcOY6Cgx@ wG{a;ABePT>%h=S&#LUDT#0SfONT5nC0O}VJbn-$ql>h($07*qoM6N<$g8UW&2mk;8 diff --git a/demo/wwwroot/icons/favicon.ico b/demo/wwwroot/icons/favicon.ico deleted file mode 100644 index 74f93949c87b5337ba04eb621affb40b4d8c73a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15086 zcmeI3U1%It6vwBu&_aduNqi8J2L&H|2q+@>5WyE;d=M$k?j|wWd~Vv1=1UXOnxr4W zwDik1-)XizOCKU6tp0_Jfw`kxr<>iX#O&W^=J9d!*ew|DpVnYAaXEHrc-e{kg8 znK!+8FZWhn{0~PsvDRx(g}QarpAP-hl!%z1F%dTF^==>mNb}hudWi1sde%d_nhtuFEy?clY z*1F)-f$4oyq2b>Xk!cgmh9>V%RgGMOKWjMGb)0Se68~QK3val=R{&q(F4D3g)n+tw zVl0<=2!cO(2|q71o%>rjdX?C_lKicFsQBwKl8w7HM~XN0uC)K*&zhWTiCgiVjXSY3 z5=LbifH)n3NK{~aQ_96?J|1JLN9a#9uIRX;C`q?$_ z%9gF_yoDT@3G6?e@`>Mj+47Hmu5R&zV+wkmUe5RVEw*zeNFMORU*~8qGY>Ks`Q{I2 z^m8r?>|B;}4QIyXY&zF>l58=Aj^%K4>q9)rcSb?QwVMr$pHKd7dV{>5PyX^fW{`aC zWAX05TEh;$Q;~J&79ZK}C*x;yoP5Cdm=a5Ny+K{G4`hwutDy3ao>TLke{??t#b2MJ zLh@%Gh@l{n@BFFzpBN%11qprp_43;FfN6aU<1x8pY&1=Ef63V3B2)Fn1IhYQ)zE71 zCW{7=^-mdP$#!pUR5CC;TEP`y!EvrX4#@-|!3i1;L@U_3DWJT=HJdzy4@+ z;jWH~x8r6_`wBRk%* zgE;atFHZgshiCsm=kA5t>*y26c?44K=@MSeQ`N5op}%dsJN=s%U2mpxQ2LqQmeKa~ zdAhE%ZK3`b{K9;Iy|eAN4)qL}pm(V4&cTtRCAr$~reEfrxR?r!EP|Qv%i+A__5!Mey@6^ zUC{c8zm>3`c_IEJ2J5c~|C#jr@wwAzNF@_fcL9~wpG zeZeNmM%g2j7OQg6qid^CTexY#*l>OWgGb!RRV|937NHz_A-;s?FiQ*)sOEOLl9H`8yf6?&8vR#zcmLb-`jOF)?@w~-DUY-^vWDI#KU96 zXeRx{PfhE|hr|sMFo*3I>wAH{Ke}tG=Z-~G+(`VTrMgF5clYAccAav~cvkGW^e0~I zI;F2j#%KMg@4ddUgR!%%AI3ok<2b>|=k(!h^vALkHY*7>+GJ7cy4Wz5RNJLKb*&_Q F{{ulQz&QW_ diff --git a/demo/wwwroot/icons/mstile-150x150.png b/demo/wwwroot/icons/mstile-150x150.png deleted file mode 100644 index 6f5672e778f280f5135e134e34ef6443a8b7a820..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1256 zcmeAS@N?(olHy`uVBq!ia0y~yVB`Z~4rZW;e?I4QAjOjI=U}oXkrg$1lJq#MLLWa9V#?XF|l$>2nYC^e*q|?ha0?-`2ik=8S;;=+2=2O|?7f z`s!jPrc5|EV^Uber0$uqGc%S)M@KKqm><1tQ$fMBz`(>+d7<-?JL|L8XS`qnnk-Zj z+RjUWs3|%91{7ZIG_4Q zJ68M`pUZNEjl0b8cDLot`)Ajf#_hb$sj7MFF3?-pz=!TNH}e&vie+Z$W(CfET-$tY zLbJ@14&!#wjnPG0w2C7x?~zX}?c26Cd#Ytk+pQg1uZylIxyQTS^ zo7gNL5FMmH;HhCXxc=;e?xzEqYYMBM zDs0pd3s*j`-}uK&A@;+m+lG@~zPMAp&u1s&ORN1&e*J#0igbM4r`cYYU_ZjyrZx>I z%Mp`S#iJ+qY{u%3t~%XMUr$Y*b+9wjYTsGKq(A%HWWKMQuz2;Mq)MMw(_==mcJ0?T zU-G^D@mt!|XE!WlpL8Ty-J8iL#%=kpWaEj7+XqYT6h~}6Uo3pOWKR71jQ&mErE5#g zUwU5-d>8*+!rwOO=AqK`lf~z(o7lyDdMu~)^%>ukEUM{i->oGfcDlKK-ck7vch1W2 zTW$0??jCh_-^NE3pGA`YoX@D^F85u1GIF|UVz1S%^uvFi?_YJQW|d$6MGHykXg={L zzrH-Yc_`NDkLY5L;KPfH-aYqynEc@jzyJRuKXW2tmpnO_udSQ+Hz<8Lee|s=EsH(lh^VlD?k2 zi;+`Lb)DPFFWpwt_e-wICy&nOiTJTUc4x zd$I_#u!2j2$>9`c<;@`qr*B+2apcSqnIr6{8$1?x=`p+#7cBYYWI7e(0#8>zmvv4F FO#mxII_m%c diff --git a/demo/wwwroot/icons/mstile-310x150.png b/demo/wwwroot/icons/mstile-310x150.png deleted file mode 100644 index 29ba5eb7916b4ea20fe7dfea8cb18b6a5c78fddf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1378 zcmaJ=`BM`I6kZxp1kXk%N&yiRafGGCV$|AFkPvY(NWu|v5D+nd%CUq?fmjqBTyAI= z)B-{vihv@A-3U^YIDt()0tT%z4oE-o9}9($w4( z0DzTV2RxVn@C^t6MypInM5px02~Q#|5xO061AxXnv(KT%1U8Ci(%pfEM;2oQa6Rnp zNAr%1Ls(&G5h6$b^v&V^ot-1Ocrh=4b*A;gt*EFhX5Q`eJDJ%TyrS^@&XTCQL@Afc zt%)e-*0dxivo43!unVOG)fy3#!2)u3Nar7fFBlAS2E!jE^D3I3fRNzs<>BU+{O{zz z%iPL?zE3=|K6MY}LXR)-Ml&jU3Y zRhi*)0^dix##C23C4++UXp?lQ!>D&9XSlEku?>{Sg_zQE52i52tSJV%R0bE|OW^Ij z^Wn0n@wO|5nCVN=k(dMl#!R1d1t#pLdf#YOLy>u&3AI}pZC!KgSq^Et);)v#t05ID zCM1FzD8W8n609G5Mw$HX%zjLA@RA@py-BPXbZ|lYdQMebU)Ev1Ffx8i z2YZ)dq85?Z@csr^;zob)nrDf^+g;F?TUPO%q`f84oO>M_8`Rfv_K=9AJHq)ETXzZ4 zMYye!?ktuzvQaob<(JK?_ZL8&*sF4^t(EZ2oRZaTJBh=T`wY|r+Qnh7_LQkL zX<(XN=jqUT=+Sk=zY&BxWgq(c<&!JaG;nv);LVPAHWaP13wmqzHj>b-+&a;JoZ1_N zI&7{v{eGW4QC#R8X<-7ktI;ybvt`jHWlPac9p!xrF5HB%(aSumXD}U9YlKgN)%NWNVi z!s2V4f1n6R$N5u&8U&dPa8g$2t%ZK&5F{q569?SFMe@IUeHCu-9v z*l+{x&_e@X%#NQADn@wlYhiJjUO@v(-|yUe&am_vqQC1zCX^e@dS^z_p^11ee zzmKFIpJ!Fhyb*TC`5}xte3IhaFsn~)iAk5MlH297ee<3VJE`7D((lKztMyoL9j^B= zic&StrBbv*y;TYhdN$8_%W3}1ajpA|%md3Whvp)JhnZ2};MpdMmN{|use>X@$-6hw z6!hFu;~oGC##Fj@FGd~30@tjR3jI}HkFq-WBU+Y3p*Buf6+u_Es)nJrF`E*rI2OCH z?AdC*w<96kW_t(nFAFEL13J+Ry5`A^7|JdUNnYBgL_EE|Ir?N9RL6T diff --git a/demo/wwwroot/icons/mstile-310x310.png b/demo/wwwroot/icons/mstile-310x310.png deleted file mode 100644 index 9261db794764ff091fa31c15f2e4247986bdaa10..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2717 zcmcImX;f238%|BNR#dRmrXZpM@z^Ri?5IUhAOuVljZ{!>2m%o()If+p*j*8WKtOUq z7Pk^Wq7e}BvII43;UX!E7EquS0*18^1Sybw7f=6u|G#hM%$f7d%z0S8pU6PQAzfgM{Rlv z6xbi5xDhFVp(ps>O&aFsk;uj;e(v)#kR8dD!SnHV%XN zI>yEEkXvN$MBhaCy=L8n_B&b)>D{Gr74swJz5DKKruz%Mr}FI%X#1bN;$Q2w>5iQ( zYVLnn8V%wJ1AiA4l+SmN-@$wO4+HHZWzmHTph@V+%*Uexr$%!C9Na9QXRvr&g#ix! z)9uurvVgKc+MOOCJlDk5g^O^ZxP^{T$l;^)V zfZ*T6Dj)3%rx(U}Wgvg4_%_1ws2%1JTH`s@GGd|4gD;f7D!$3=2}*QP{|wvY$u5N* zPu|@ZA@?apPfB6>&gO%{;HEOubPY8f?zTqccfpIyDv*MMYy2kOKgb33vjEgDaOk~X zeSBQ@QD9TFTJwwG-{dm~fh)|Y`m=Fo>qD4z2Mz;+J-RfTRkOG9W_zj|I<)r04EE_V zAXiN7PH1o$;8=Elccq%{LmRWwOnyj@wfcoAZj}TdherF6?(YcIT*AqFsMstQ0=mE#R-^^AI^K#jdDu&o*cEO1lRg4ws+WgsQ-CLU0Zm1v_j;dswy22Gns8AByH;32B*z8$FW>V5`lk$_4;Q6B0rinvwKTy>Wtpk!Hp`SYga%-* z&Y7z1xZLFLPXRraaC5=^%&9G9)r4&s$d_UJx=O{YsS{&q8%MrcH+oyc&^9-I`-Lb>bzb6iviNW3;*8E;;te}=X-`S2HI;=P) zX5WWr*4W_?{FMKFB2YS#J~2{%$ALCawQ`?qk!uF=$g}XxOQ}l>t8cz?0y>cb9YB&g zS6UFvB;7kSmNi+#Ti^uQN_ zdIm6iB;CULZ9$3TacC14jA|oJSV$#11FzlyhdT1eteOmKnkC{DG1r)bln|;><|rRO zxXR6Zr0B>%7Sx`T{paA>;m_1+mRoKy-0cakzYSQ~hdbHzl6kwrLv)WUg0D;-?7Rfa z=TIh$E(O`y$<1cKbNcfo-c?SB+`WY{4!^UVT*mHH9Hsz<13LJL3+hghj){vpfQNi4 zL>`~sh#ii!6bz2zq0kZP>a_L61sjGVV+DieES(78b?G(_L=0uvv9dwHCG7Nqc~_pt zkO7qQg8jw-GM!4km5JOQFoce~LZn3G;X!ojMQK-VvVcdPc`hz8hwgp4iMR=n6L41s z{+04c8saBF!XyP8TGNiK2l{Ywl>e+BK+GZO&y8ihoHnCXB_ciC4P2Sz@tOJ{XhcSw zNO0l4EV)2|#6bX#ocZo$16!wz{erEN&XxH3TiD=&Hm_VTnqxjy-YeDL2=`wDCMkLC z=Cz+T4L(74b}h&oc%Bx;`|HymfHb2MZ`Vkz%RWl*rB}D+d)ADv=!EJ;ppr5E)BV5S z^%S+?nNDP-$dvA6OY0b6eLcbXAbQwg6z-%Lhy6z#_QqdG%!we`(q?9Rtiy8&`~wYp zXDZ0IWO36Q2>Cqy1*iSX&T5qxfu(aEkUs70y*w~R1Po;by)8@qie`*QBhF?93W@TwZBy&-|Z?lfbyqVk;^AG zzmkgyQM;sEq7)dOrWbZr{*1j!F&Lb&#1}!JSTV7GjONayAc=ArpN#Kad-T5L^MJ57569jy+xi^2u#J+6s zE8i!SFn{(sL6SgHwp4SyKq&5IXZN$=wSvx(pN-FZZT#IRteC3^6#PTVDHC6v=XBdx z(`!zxenGK-h7FiaqGdZ9nzu_zM5|Cp7vvyY8J#UrdBLcU+bD)GCFI|0gCPW5$q|th zUsHjD9rMXQq5+ZN>EiMggpkruff=U83{8!r8s!S5&fX|AgzIw=_dIg!{?jc)0NaS{ zXGWoXFf)RLaGkO6a~NCaZ=aSD0SB4Wc>*d+tU74!T=N6S2z_oQ1DX(${>ir!RttYD zyNhjnc0FlDe{#z??*JQ@=*NAXl@zTcV!2O0xNf|8#*#vIdoUKv3?{hsTE_0!t z6}YC==ev$4%Jr<*NL*6&;n!xhV6XQBzp6}J^yqR@kx(V}+L=Y(O!1^tn!$R;4DBp% zXEtJ+?KL(r?c>SlTdEbI-vaGda@FQP2VXz^IGvK+`o&}p=K}Hhk%tg=(7fKGd2k{STCe&{}spFWD{DXz5aF4_>G}&7GtF10T+NLgBGHt zD}S;7fB9sr#ty9eGpjlr--Yhx9_8l2rk;t|9>QXt4Gd;%XLCXr+XF+`z8Fko?%>S& zwV@|>?P_sFT3zH+4AxKs@YT>Z)Fx+qi`Cxlm|!9C!y1;mZAZGhn(JHZ_3FPu5}fZG Z1~8+zP3#$a%ghyrT!=>C00004XF*Lt006O% z3;baP00001b5ch_0Itp)=>Px#giuUWMNDaNb+dq$e}kx|n_#JIj#E>@j*h66jJkh+ zQjuMdTY7-BidKvlbDQDlZaG~v3<6zqmr3dppsEht9P-RTx(pGW|E4Tm5zj` zTU%SEXrEiAr&?N_RaIG~XOLD?t!8F|r-4@~Ds)m#Qvm)u5&oR9BH{OLRjkxw_Kx(4{_VHLg8Q@o|NsC0|NsC0|NsC0 z|Ns8j5YtTn00R94?3VRwEXyHz7faWZ`J6;LXe70H~ zxyIxMvl$d?Mywg@?S^@p{>^s$vp_MB>k%l*vKzP?d-ooYC6JfpxdH>{{`qsIGkC<4 zBv6zUunFxUpz2t$D$1?`!_XB{FXadnY_8-B8=SkcI|G}N2c!vf;Cmnd*aIQYND|1) z^W$Xg=h!usC{WpCgxc9|ZLI<dHMwC z7Dqm?J#7NSX5mS#uMkOYM!!_xx((4IKx^khO>PR*Sz#`*-Hs&@Qq1@ONY_zi0S ztyFZwp9+y{t>Q373IyK6R{~iavxaa`QHZ?wWeT!JRX6nD>lCPJ$8>2ytpdb`7L0>K z&*p9w^6!C)4A?%aIneD{$G5o$2_Jw8GC+VIL5wcIc$j{$R``a*2Ee~j1sfLrqw=9T z0k##lzaXcNj}x)!A3d6-Z~pUJS+xQY(3}A%XdvxnwTpeN0{P6sOZt2of4DB7RF*)x zhZgdd*W>up3H=Lc0t>#+L6`%#x6`<@#gE9kwAvr%(dx>3e;Q}U;YiM<*(-sZDcsTV zba%(ZRVI*r`)gC0mR(o;yPH!Z@Sg2U!C){L3aB^>EX>4U6ba`-PAZc)PV*mhnoa6Eg2ys>@D9TUE%t_@^ z00ScnE@KN5BNI!L6ay0=M1VBIWCJ6!R3OXP)X2ol#2my2%YaCrN-hBE7ZG&wLN%2D O0000 - - - - - image/svg+xml - - - - - - - - - diff --git a/demo/wwwroot/index.html b/demo/wwwroot/index.html deleted file mode 100644 index e1d4618d..00000000 --- a/demo/wwwroot/index.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - SPARQL Blockly - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/demo/wwwroot/manifest.webmanifest b/demo/wwwroot/manifest.webmanifest deleted file mode 100644 index 453df31b..00000000 --- a/demo/wwwroot/manifest.webmanifest +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "SPARQL Blockly", - "short_name": "SPARQLViz", - "start_url": "index.html", - "icons": [ - { - "src": "icons/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "icons/android-chrome-512x512.png", - "sizes": "512x512", - "type": "image/png" - } - ], - "theme_color": "#ffffff", - "background_color": "#ffffff", - "display": "standalone" -} diff --git a/demo/wwwroot/style.css b/demo/wwwroot/style.css deleted file mode 100644 index b4e7d19a..00000000 --- a/demo/wwwroot/style.css +++ /dev/null @@ -1,72 +0,0 @@ -@media screen and (min-height : 800px) { - sparql-editor textarea { - height: 200px - } - - sparql-editor span { - height: 80px - } -} - -@media screen and (max-height : 800px) { - sparql-editor textarea { - height: 100px - } - - sparql-editor span { - height: 50px - } -} - -body { - margin: 0; - min-width: 320px; -} - -app-main { - height: 100vh; - display: flex; - flex-direction: column; -} - - app-main blockly-canvas { - flex-grow: 1; - min-height: 300px; - } - - app-main blockly-canvas div.injectionDiv { - min-width: 300px; - min-height: 300px; - } - - app-main sparql-editor { - flex-grow: 0; - display: flex; - flex-direction: column; - margin: 10px; - } - - app-main sparql-editor textarea:placeholder-shown { - text-align: center; - font-size: 250%; - } - - app-main sparql-editor span { - font-family: monospace; - display: none; - border: 1px solid; - border-top: none; - overflow: auto; - } - - app-main sparql-editor.valid textarea { - background-color: #eeffee; - } - - app-main sparql-editor.invalid textarea { - background-color: #ffeeee; - } - - app-main sparql-editor.invalid span { - display: initial; - } diff --git a/demo/wwwroot/toolbox.xml b/demo/wwwroot/toolbox.xml deleted file mode 100644 index 069379dd..00000000 --- a/demo/wwwroot/toolbox.xml +++ /dev/null @@ -1,757 +0,0 @@ - \ No newline at end of file diff --git a/docs/app.js b/docs/app.js index 8c279c5f..04fa1130 100644 --- a/docs/app.js +++ b/docs/app.js @@ -1 +1 @@ -!function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var p="function"==typeof require&&require;if(!f&&p)return p(i,!0);if(u)return u(i,!0);throw(p=new Error("Cannot find module '"+i+"'")).code="MODULE_NOT_FOUND",p}p=n[i]={exports:{}},e[i][0].call(p.exports,function(r){return o(e[i][1][r]||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i"}},{}],8:[function(require,module,exports){const term=require("./term");module.exports=function(graphString){var subjectString=term(graphString.subject),predicateString=term(graphString.predicate),objectString=term(graphString.object),graphString=term(graphString.graph);return`${subjectString} ${predicateString} ${objectString} ${graphString?graphString+" ":""}.`}},{"./term":9}],9:[function(require,module,exports){const blankNode=require("./blankNode"),defaultGraph=require("./defaultGraph"),literal=require("./literal"),namedNode=require("./namedNode"),variable=require("./variable");module.exports=function(term){switch(term.termType){case"BlankNode":return blankNode(term);case"DefaultGraph":return defaultGraph(term);case"Literal":return literal(term);case"NamedNode":return namedNode(term);case"Variable":return variable(term);default:return}}},{"./blankNode":4,"./defaultGraph":5,"./literal":6,"./namedNode":7,"./variable":10}],10:[function(require,module,exports){module.exports=function(variable){return"?"+variable.value}},{}],11:[function(require,module,exports){var root,factory;root=this,factory=function(Blockly){"use strict";return Blockly},"function"==typeof define&&define.amd?define(["./blockly_compressed"],factory):"object"==typeof exports?module.exports=factory(require("./blockly_compressed")):root.Blockly=factory(root.Blockly)},{"./blockly_compressed":12}],12:[function(require,module,exports){!function(global){!function(){var root,factory;root=this,factory=function(){"use strict";var Blockly={connectionTypes:{INPUT_VALUE:1,OUTPUT_VALUE:2,NEXT_STATEMENT:3,PREVIOUS_STATEMENT:4},constants:{},LINE_MODE_MULTIPLIER:40,PAGE_MODE_MULTIPLIER:125,DRAG_RADIUS:5,FLYOUT_DRAG_RADIUS:10,SNAP_RADIUS:28};return Blockly.CONNECTING_SNAP_RADIUS=Blockly.SNAP_RADIUS,Blockly.CURRENT_CONNECTION_PREFERENCE=8,Blockly.BUMP_DELAY=250,Blockly.BUMP_RANDOMNESS=10,Blockly.COLLAPSE_CHARS=30,Blockly.LONGPRESS=750,Blockly.SOUND_LIMIT=100,Blockly.DRAG_STACK=!0,Blockly.HSV_SATURATION=.45,Blockly.HSV_VALUE=.65,Blockly.SPRITE={width:96,height:124,url:"sprites.png"},Blockly.constants.ALIGN={LEFT:-1,CENTRE:0,RIGHT:1},Blockly.DRAG_NONE=0,Blockly.DRAG_STICKY=1,Blockly.DRAG_BEGIN=1,Blockly.DRAG_FREE=2,Blockly.OPPOSITE_TYPE=[],Blockly.OPPOSITE_TYPE[Blockly.connectionTypes.INPUT_VALUE]=Blockly.connectionTypes.OUTPUT_VALUE,Blockly.OPPOSITE_TYPE[Blockly.connectionTypes.OUTPUT_VALUE]=Blockly.connectionTypes.INPUT_VALUE,Blockly.OPPOSITE_TYPE[Blockly.connectionTypes.NEXT_STATEMENT]=Blockly.connectionTypes.PREVIOUS_STATEMENT,Blockly.OPPOSITE_TYPE[Blockly.connectionTypes.PREVIOUS_STATEMENT]=Blockly.connectionTypes.NEXT_STATEMENT,Blockly.DELETE_AREA_NONE=null,Blockly.DELETE_AREA_TRASH=1,Blockly.DELETE_AREA_TOOLBOX=2,Blockly.VARIABLE_CATEGORY_NAME="VARIABLE",Blockly.VARIABLE_DYNAMIC_CATEGORY_NAME="VARIABLE_DYNAMIC",Blockly.PROCEDURE_CATEGORY_NAME="PROCEDURE",Blockly.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID",Blockly.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID",Blockly.constants.COLLAPSED_INPUT_NAME="_TEMP_COLLAPSED_INPUT",Blockly.constants.COLLAPSED_FIELD_NAME="_TEMP_COLLAPSED_FIELD",Blockly.utils={},Blockly.utils.global=function(){return"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:this}(),Blockly.Msg={},Blockly.utils.global.Blockly||(Blockly.utils.global.Blockly={}),Blockly.utils.global.Blockly.Msg||(Blockly.utils.global.Blockly.Msg=Blockly.Msg),Blockly.utils.colour={},Blockly.utils.colour.parse=function(a){a=String(a).toLowerCase().trim();var b=Blockly.utils.colour.names[a];if(b)return b;if(b="#"==(b="0x"==a.substring(0,2)?"#"+a.substring(2):a)[0]?b:"#"+b,/^#[0-9a-f]{6}$/.test(b))return b;if(/^#[0-9a-f]{3}$/.test(b))return["#",b[1],b[1],b[2],b[2],b[3],b[3]].join("");var c=a.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return c&&(a=Number(c[1]),b=Number(c[2]),c=Number(c[3]),0<=a&&a<256&&0<=b&&b<256&&0<=c&&c<256)?Blockly.utils.colour.rgbToHex(a,b,c):null},Blockly.utils.colour.rgbToHex=function(a,b,c){return b=a<<16|b<<8|c,a<16?"#"+(16777216|b).toString(16).substr(1):"#"+b.toString(16)},Blockly.utils.colour.hexToRgb=function(a){return(a=Blockly.utils.colour.parse(a))?[(a=parseInt(a.substr(1),16))>>16,a>>8&255,255&a]:[0,0,0]},Blockly.utils.colour.hsvToHex=function(a,b,c){var d=0,e=0,f=0;if(0==b)f=e=d=c;else{var g=Math.floor(a/60),h=a/60-g;a=c*(1-b);var k=c*(1-b*h);switch(b=c*(1-b*(1-h)),g){case 1:d=k,e=c,f=a;break;case 2:d=a,e=c,f=b;break;case 3:d=a,e=k,f=c;break;case 4:d=b,e=a,f=c;break;case 5:d=c,e=a,f=k;break;case 6:case 0:d=c,e=b,f=a}}return Blockly.utils.colour.rgbToHex(Math.floor(d),Math.floor(e),Math.floor(f))},Blockly.utils.colour.blend=function(a,b,c){return(a=Blockly.utils.colour.parse(a))&&(b=Blockly.utils.colour.parse(b))?(a=Blockly.utils.colour.hexToRgb(a),b=Blockly.utils.colour.hexToRgb(b),Blockly.utils.colour.rgbToHex(Math.round(b[0]+c*(a[0]-b[0])),Math.round(b[1]+c*(a[1]-b[1])),Math.round(b[2]+c*(a[2]-b[2])))):null},Blockly.utils.colour.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00"},Blockly.utils.Coordinate=function(a,b){this.x=a,this.y=b},Blockly.utils.Coordinate.equals=function(a,b){return a==b||!(!a||!b)&&(a.x==b.x&&a.y==b.y)},Blockly.utils.Coordinate.distance=function(a,b){var c=a.x-b.x;return a=a.y-b.y,Math.sqrt(c*c+a*a)},Blockly.utils.Coordinate.magnitude=function(a){return Math.sqrt(a.x*a.x+a.y*a.y)},Blockly.utils.Coordinate.difference=function(a,b){return new Blockly.utils.Coordinate(a.x-b.x,a.y-b.y)},Blockly.utils.Coordinate.sum=function(a,b){return new Blockly.utils.Coordinate(a.x+b.x,a.y+b.y)},Blockly.utils.Coordinate.prototype.scale=function(a){return this.x*=a,this.y*=a,this},Blockly.utils.Coordinate.prototype.translate=function(a,b){return this.x+=a,this.y+=b,this},Blockly.utils.Rect=function(a,b,c,d){this.top=a,this.bottom=b,this.left=c,this.right=d},Blockly.utils.Rect.prototype.contains=function(a,b){return a>=this.left&&a<=this.right&&b>=this.top&&b<=this.bottom},Blockly.utils.Rect.prototype.intersects=function(a){return!(this.left>a.right||this.righta.bottom||this.bottomb&&(b=c[d].length);d=-1/0;var e=1;do{var f=d,g=a;a=[];for(var h=c.length/e,k=1,d=0;d/g,"<$1$2>")},Blockly.Xml.domToPrettyText=function(a){a=Blockly.Xml.domToText(a).split("<");for(var b="",c=1;c"!=d.slice(-2)&&(b+=" ")}return(a=(a=a.join("\n")).replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1")).replace(/^\n/,"")},Blockly.Xml.textToDom=function(a){var b=Blockly.utils.xml.textToDomDocument(a);if(!b||!b.documentElement||b.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+a);return b.documentElement},Blockly.Xml.clearWorkspaceAndLoadFromXml=function(a,b){return b.setResizesEnabled(!1),b.clear(),a=Blockly.Xml.domToWorkspace(a,b),b.setResizesEnabled(!0),a},Blockly.Xml.domToWorkspace=function(a,b){var c,d;a instanceof Blockly.Workspace&&(c=a,a=b,b=c,console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")),b.RTL&&(d=b.getWidth()),c=[],Blockly.utils.dom.startTextWidthCache();var e=Blockly.Events.getGroup();e||Blockly.Events.setGroup(!0),b.setResizesEnabled&&b.setResizesEnabled(!1);var f=!0;try{for(var h,g=0;h=a.childNodes[g];g++){var k=h.nodeName.toLowerCase(),l=h;if("block"==k||"shadow"==k&&!Blockly.Events.recordUndo){var m=Blockly.Xml.domToBlock(l,b);c.push(m.id);var n=l.hasAttribute("x")?parseInt(l.getAttribute("x"),10):10,p=l.hasAttribute("y")?parseInt(l.getAttribute("y"),10):10;isNaN(n)||isNaN(p)||m.moveBy(b.RTL?d-n:n,p),f=!1}else{if("shadow"==k)throw TypeError("Shadow block cannot be a top-level block.");if("comment"==k)b.rendered?Blockly.WorkspaceCommentSvg?Blockly.WorkspaceCommentSvg.fromXml(l,b,d):console.warn("Missing require for Blockly.WorkspaceCommentSvg, ignoring workspace comment."):Blockly.WorkspaceComment?Blockly.WorkspaceComment.fromXml(l,b):console.warn("Missing require for Blockly.WorkspaceComment, ignoring workspace comment.");else if("variables"==k){if(!f)throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");Blockly.Xml.domToVariables(l,b),f=!1}}}}finally{e||Blockly.Events.setGroup(!1),Blockly.utils.dom.stopTextWidthCache()}return b.setResizesEnabled&&b.setResizesEnabled(!0),Blockly.Events.fire(new(Blockly.Events.get(Blockly.Events.FINISHED_LOADING))(b)),c},Blockly.Xml.appendDomToWorkspace=function(a,b){if(Object.prototype.hasOwnProperty.call(b,"scale")&&(c=b.getBlocksBoundingBox()),a=Blockly.Xml.domToWorkspace(a,b),c&&c.top!=c.bottom){for(var d=c.bottom,e=b.RTL?c.right:c.left,f=1/0,g=-1/0,h=1/0,c=0;cg&&(g=k.x)}for(d=d-h+10,e=b.RTL?e-g:e-f,c=0;c"),b.domToMutation(d)),Blockly.Events.fire(new(Blockly.Events.get(Blockly.Events.CHANGE))(b,"mutation",null,c,a));break;default:console.warn("Unknown change type: "+this.element)}else console.warn("Can't change non-existent block: "+this.blockId)},Blockly.Events.Create=function(a){Blockly.Events.Create.superClass_.constructor.call(this,a),a&&(a.isShadow()&&(this.recordUndo=!1),this.xml=a.workspace.rendered?Blockly.Xml.blockToDomWithXY(a):Blockly.Xml.blockToDom(a),this.ids=Blockly.Events.getDescendantIds(a))},Blockly.utils.object.inherits(Blockly.Events.Create,Blockly.Events.BlockBase),Blockly.Events.BlockCreate=Blockly.Events.Create,Blockly.Events.Create.prototype.type=Blockly.Events.CREATE,Blockly.Events.Create.prototype.toJson=function(){var a=Blockly.Events.Create.superClass_.toJson.call(this);return a.xml=Blockly.Xml.domToText(this.xml),a.ids=this.ids,this.recordUndo||(a.recordUndo=this.recordUndo),a},Blockly.Events.Create.prototype.fromJson=function(a){Blockly.Events.Create.superClass_.fromJson.call(this,a),this.xml=Blockly.Xml.textToDom(a.xml),this.ids=a.ids,void 0!==a.recordUndo&&(this.recordUndo=a.recordUndo)},Blockly.Events.Create.prototype.run=function(a){var c,b=this.getEventWorkspace_();if(a)(a=Blockly.utils.xml.createElement("xml")).appendChild(this.xml),Blockly.Xml.domToWorkspace(a,b);else{a=0;for(;c=this.ids[a];a++){var d=b.getBlockById(c);d?d.dispose(!1):c==this.blockId&&console.warn("Can't uncreate non-existent block: "+c)}}},Blockly.Events.Delete=function(a){if(Blockly.Events.Delete.superClass_.constructor.call(this,a),a){if(a.getParent())throw Error("Connected blocks cannot be deleted.");a.isShadow()&&(this.recordUndo=!1),this.oldXml=a.workspace.rendered?Blockly.Xml.blockToDomWithXY(a):Blockly.Xml.blockToDom(a),this.ids=Blockly.Events.getDescendantIds(a)}},Blockly.utils.object.inherits(Blockly.Events.Delete,Blockly.Events.BlockBase),Blockly.Events.BlockDelete=Blockly.Events.Delete,Blockly.Events.Delete.prototype.type=Blockly.Events.DELETE,Blockly.Events.Delete.prototype.toJson=function(){var a=Blockly.Events.Delete.superClass_.toJson.call(this);return a.oldXml=Blockly.Xml.domToText(this.oldXml),a.ids=this.ids,this.recordUndo||(a.recordUndo=this.recordUndo),a},Blockly.Events.Delete.prototype.fromJson=function(a){Blockly.Events.Delete.superClass_.fromJson.call(this,a),this.oldXml=Blockly.Xml.textToDom(a.oldXml),this.ids=a.ids,void 0!==a.recordUndo&&(this.recordUndo=a.recordUndo)},Blockly.Events.Delete.prototype.run=function(a){var c,b=this.getEventWorkspace_();if(a){a=0;for(;c=this.ids[a];a++){var d=b.getBlockById(c);d?d.dispose(!1):c==this.blockId&&console.warn("Can't delete non-existent block: "+c)}}else(a=Blockly.utils.xml.createElement("xml")).appendChild(this.oldXml),Blockly.Xml.domToWorkspace(a,b)},Blockly.Events.Move=function(a){Blockly.Events.Move.superClass_.constructor.call(this,a),a&&(a.isShadow()&&(this.recordUndo=!1),a=this.currentLocation_(),this.oldParentId=a.parentId,this.oldInputName=a.inputName,this.oldCoordinate=a.coordinate)},Blockly.utils.object.inherits(Blockly.Events.Move,Blockly.Events.BlockBase),Blockly.Events.BlockMove=Blockly.Events.Move,Blockly.Events.Move.prototype.type=Blockly.Events.MOVE,Blockly.Events.Move.prototype.toJson=function(){var a=Blockly.Events.Move.superClass_.toJson.call(this);return this.newParentId&&(a.newParentId=this.newParentId),this.newInputName&&(a.newInputName=this.newInputName),this.newCoordinate&&(a.newCoordinate=Math.round(this.newCoordinate.x)+","+Math.round(this.newCoordinate.y)),this.recordUndo||(a.recordUndo=this.recordUndo),a},Blockly.Events.Move.prototype.fromJson=function(a){var b;Blockly.Events.Move.superClass_.fromJson.call(this,a),this.newParentId=a.newParentId,this.newInputName=a.newInputName,a.newCoordinate&&(b=a.newCoordinate.split(","),this.newCoordinate=new Blockly.utils.Coordinate(Number(b[0]),Number(b[1]))),void 0!==a.recordUndo&&(this.recordUndo=a.recordUndo)},Blockly.Events.Move.prototype.recordNew=function(){var a=this.currentLocation_();this.newParentId=a.parentId,this.newInputName=a.inputName,this.newCoordinate=a.coordinate},Blockly.Events.Move.prototype.currentLocation_=function(){var a=this.getEventWorkspace_().getBlockById(this.blockId),b={},c=a.getParent();return c?(b.parentId=c.id,(a=c.getInputWithBlock(a))&&(b.inputName=a.name)):b.coordinate=a.getRelativeToSurfaceXY(),b},Blockly.Events.Move.prototype.isNull=function(){return this.oldParentId==this.newParentId&&this.oldInputName==this.newInputName&&Blockly.utils.Coordinate.equals(this.oldCoordinate,this.newCoordinate)},Blockly.Events.Move.prototype.run=function(a){var d,e,f,g,b=this.getEventWorkspace_(),c=b.getBlockById(this.blockId);c?(d=a?this.newParentId:this.oldParentId,e=a?this.newInputName:this.oldInputName,f=a?this.newCoordinate:this.oldCoordinate,a=null,!d||(a=b.getBlockById(d))?(c.getParent()&&c.unplug(),f?(e=c.getRelativeToSurfaceXY(),c.moveBy(f.x-e.x,f.y-e.y)):(b=(c=c.outputConnection||c.previousConnection).type,e?(a=a.getInput(e))&&(g=a.connection):b==Blockly.connectionTypes.PREVIOUS_STATEMENT&&(g=a.nextConnection),g?c.connect(g):console.warn("Can't connect to non-existent input: "+e))):console.warn("Can't connect to non-existent block: "+d)):console.warn("Can't move non-existent block: "+this.blockId)},Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.CREATE,Blockly.Events.Create),Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.DELETE,Blockly.Events.Delete),Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.CHANGE,Blockly.Events.Change),Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.MOVE,Blockly.Events.Move),Blockly.Events.FinishedLoading=function(a){this.isBlank=void 0===a,this.workspaceId=a?a.id:"",this.group=Blockly.Events.getGroup(),this.recordUndo=!1},Blockly.utils.object.inherits(Blockly.Events.FinishedLoading,Blockly.Events.Abstract),Blockly.Events.FinishedLoading.prototype.type=Blockly.Events.FINISHED_LOADING,Blockly.Events.FinishedLoading.prototype.toJson=function(){var a={type:this.type};return this.group&&(a.group=this.group),this.workspaceId&&(a.workspaceId=this.workspaceId),a},Blockly.Events.FinishedLoading.prototype.fromJson=function(a){this.isBlank=!1,this.workspaceId=a.workspaceId,this.group=a.group},Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.FINISHED_LOADING,Blockly.Events.FinishedLoading),Blockly.Events.UiBase=function(a){Blockly.Events.UiBase.superClass_.constructor.call(this),this.isBlank=void 0===a,this.workspaceId=a||"",this.recordUndo=!1},Blockly.utils.object.inherits(Blockly.Events.UiBase,Blockly.Events.Abstract),Blockly.Events.UiBase.prototype.isUiEvent=!0,Blockly.Events.Ui=function(a,b,c,d){Blockly.Events.Ui.superClass_.constructor.call(this,a?a.workspace.id:void 0),this.blockId=a?a.id:null,this.element=void 0===b?"":b,this.oldValue=void 0===c?"":c,this.newValue=void 0===d?"":d},Blockly.utils.object.inherits(Blockly.Events.Ui,Blockly.Events.UiBase),Blockly.Events.Ui.prototype.type=Blockly.Events.UI,Blockly.Events.Ui.prototype.toJson=function(){var a=Blockly.Events.Ui.superClass_.toJson.call(this);return a.element=this.element,void 0!==this.newValue&&(a.newValue=this.newValue),this.blockId&&(a.blockId=this.blockId),a},Blockly.Events.Ui.prototype.fromJson=function(a){Blockly.Events.Ui.superClass_.fromJson.call(this,a),this.element=a.element,this.newValue=a.newValue,this.blockId=a.blockId},Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.UI,Blockly.Events.Ui),Blockly.Events.VarBase=function(a){Blockly.Events.VarBase.superClass_.constructor.call(this),this.varId=(this.isBlank=void 0===a)?"":a.getId(),this.workspaceId=this.isBlank?"":a.workspace.id},Blockly.utils.object.inherits(Blockly.Events.VarBase,Blockly.Events.Abstract),Blockly.Events.VarBase.prototype.toJson=function(){var a=Blockly.Events.VarBase.superClass_.toJson.call(this);return a.varId=this.varId,a},Blockly.Events.VarBase.prototype.fromJson=function(a){Blockly.Events.VarBase.superClass_.toJson.call(this),this.varId=a.varId},Blockly.Events.VarCreate=function(a){Blockly.Events.VarCreate.superClass_.constructor.call(this,a),a&&(this.varType=a.type,this.varName=a.name)},Blockly.utils.object.inherits(Blockly.Events.VarCreate,Blockly.Events.VarBase),Blockly.Events.VarCreate.prototype.type=Blockly.Events.VAR_CREATE,Blockly.Events.VarCreate.prototype.toJson=function(){var a=Blockly.Events.VarCreate.superClass_.toJson.call(this);return a.varType=this.varType,a.varName=this.varName,a},Blockly.Events.VarCreate.prototype.fromJson=function(a){Blockly.Events.VarCreate.superClass_.fromJson.call(this,a),this.varType=a.varType,this.varName=a.varName},Blockly.Events.VarCreate.prototype.run=function(a){var b=this.getEventWorkspace_();a?b.createVariable(this.varName,this.varType,this.varId):b.deleteVariableById(this.varId)},Blockly.Events.VarDelete=function(a){Blockly.Events.VarDelete.superClass_.constructor.call(this,a),a&&(this.varType=a.type,this.varName=a.name)},Blockly.utils.object.inherits(Blockly.Events.VarDelete,Blockly.Events.VarBase),Blockly.Events.VarDelete.prototype.type=Blockly.Events.VAR_DELETE,Blockly.Events.VarDelete.prototype.toJson=function(){var a=Blockly.Events.VarDelete.superClass_.toJson.call(this);return a.varType=this.varType,a.varName=this.varName,a},Blockly.Events.VarDelete.prototype.fromJson=function(a){Blockly.Events.VarDelete.superClass_.fromJson.call(this,a),this.varType=a.varType,this.varName=a.varName},Blockly.Events.VarDelete.prototype.run=function(a){var b=this.getEventWorkspace_();a?b.deleteVariableById(this.varId):b.createVariable(this.varName,this.varType,this.varId)},Blockly.Events.VarRename=function(a,b){Blockly.Events.VarRename.superClass_.constructor.call(this,a),a&&(this.oldName=a.name,this.newName=void 0===b?"":b)},Blockly.utils.object.inherits(Blockly.Events.VarRename,Blockly.Events.VarBase),Blockly.Events.VarRename.prototype.type=Blockly.Events.VAR_RENAME,Blockly.Events.VarRename.prototype.toJson=function(){var a=Blockly.Events.VarRename.superClass_.toJson.call(this);return a.oldName=this.oldName,a.newName=this.newName,a},Blockly.Events.VarRename.prototype.fromJson=function(a){Blockly.Events.VarRename.superClass_.fromJson.call(this,a),this.oldName=a.oldName,this.newName=a.newName},Blockly.Events.VarRename.prototype.run=function(a){var b=this.getEventWorkspace_();a?b.renameVariableById(this.varId,this.newName):b.renameVariableById(this.varId,this.oldName)},Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.VAR_CREATE,Blockly.Events.VarCreate),Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.VAR_DELETE,Blockly.Events.VarDelete),Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.VAR_RENAME,Blockly.Events.VarRename),Blockly.BlockDragSurfaceSvg=function(a){this.container_=a,this.createDom()},Blockly.BlockDragSurfaceSvg.prototype.SVG_=null,Blockly.BlockDragSurfaceSvg.prototype.dragGroup_=null,Blockly.BlockDragSurfaceSvg.prototype.container_=null,Blockly.BlockDragSurfaceSvg.prototype.scale_=1,Blockly.BlockDragSurfaceSvg.prototype.surfaceXY_=null,Blockly.BlockDragSurfaceSvg.prototype.createDom=function(){this.SVG_||(this.SVG_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.SVG,{xmlns:Blockly.utils.dom.SVG_NS,"xmlns:html":Blockly.utils.dom.HTML_NS,"xmlns:xlink":Blockly.utils.dom.XLINK_NS,version:"1.1",class:"blocklyBlockDragSurface"},this.container_),this.dragGroup_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.G,{},this.SVG_))},Blockly.BlockDragSurfaceSvg.prototype.setBlocksAndShow=function(a){if(this.dragGroup_.childNodes.length)throw Error("Already dragging a block.");this.dragGroup_.appendChild(a),this.SVG_.style.display="block",this.surfaceXY_=new Blockly.utils.Coordinate(0,0)},Blockly.BlockDragSurfaceSvg.prototype.translateAndScaleGroup=function(a,b,c){this.scale_=c,a=a.toFixed(0),b=b.toFixed(0),this.dragGroup_.setAttribute("transform","translate("+a+","+b+") scale("+c+")")},Blockly.BlockDragSurfaceSvg.prototype.translateSurfaceInternal_=function(){var a=this.surfaceXY_.x,b=this.surfaceXY_.y,a=a.toFixed(0),b=b.toFixed(0);this.SVG_.style.display="block",Blockly.utils.dom.setCssTransform(this.SVG_,"translate3d("+a+"px, "+b+"px, 0px)")},Blockly.BlockDragSurfaceSvg.prototype.translateSurface=function(a,b){this.surfaceXY_=new Blockly.utils.Coordinate(a*this.scale_,b*this.scale_),this.translateSurfaceInternal_()},Blockly.BlockDragSurfaceSvg.prototype.getSurfaceTranslation=function(){var a=Blockly.utils.getRelativeXY(this.SVG_);return new Blockly.utils.Coordinate(a.x/this.scale_,a.y/this.scale_)},Blockly.BlockDragSurfaceSvg.prototype.getGroup=function(){return this.dragGroup_},Blockly.BlockDragSurfaceSvg.prototype.getCurrentBlock=function(){return this.dragGroup_.firstChild},Blockly.BlockDragSurfaceSvg.prototype.clearAndHide=function(a){if(a?a.appendChild(this.getCurrentBlock()):this.dragGroup_.removeChild(this.getCurrentBlock()),this.SVG_.style.display="none",this.dragGroup_.childNodes.length)throw Error("Drag group was not cleared.");this.surfaceXY_=null},Blockly.Css={},Blockly.Css.injected_=!1,Blockly.Css.register=function(a){if(Blockly.Css.injected_)throw Error("CSS already injected");Array.prototype.push.apply(Blockly.Css.CONTENT,a),a.length=0},Blockly.Css.inject=function(a,b){var c;Blockly.Css.injected_||(Blockly.Css.injected_=!0,c=Blockly.Css.CONTENT.join("\n"),Blockly.Css.CONTENT.length=0,a&&(a=b.replace(/[\\/]$/,""),c=c.replace(/<<>>/g,a),(a=document.createElement("style")).id="blockly-common-style",c=document.createTextNode(c),a.appendChild(c),document.head.insertBefore(a,document.head.firstChild)))},Blockly.Css.CONTENT=[".blocklySvg {","background-color: #fff;","outline: none;","overflow: hidden;","position: absolute;","display: block;","}",".blocklyWidgetDiv {","display: none;","position: absolute;","z-index: 99999;","}",".injectionDiv {","height: 100%;","position: relative;","overflow: hidden;","touch-action: none;","}",".blocklyNonSelectable {","user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","}",".blocklyWsDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;","}",".blocklyWsDragSurface.blocklyOverflowVisible {","overflow: visible;","}",".blocklyBlockDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;","right: 0;","bottom: 0;","overflow: visible !important;","z-index: 50;","}",".blocklyBlockCanvas.blocklyCanvasTransitioning,",".blocklyBubbleCanvas.blocklyCanvasTransitioning {","transition: transform .5s;","}",".blocklyTooltipDiv {","background-color: #ffffc7;","border: 1px solid #ddc;","box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);","color: #000;","display: none;","font: 9pt sans-serif;","opacity: .9;","padding: 2px;","position: absolute;","z-index: 100000;","}",".blocklyDropDownDiv {","position: absolute;","left: 0;","top: 0;","z-index: 1000;","display: none;","border: 1px solid;","border-color: #dadce0;","background-color: #fff;","border-radius: 2px;","padding: 4px;","box-shadow: 0 0 3px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv.blocklyFocused {","box-shadow: 0 0 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownContent {","max-height: 300px;","overflow: auto;","overflow-x: hidden;","position: relative;","}",".blocklyDropDownArrow {","position: absolute;","left: 0;","top: 0;","width: 16px;","height: 16px;","z-index: -1;","background-color: inherit;","border-color: inherit;","}",".blocklyDropDownButton {","display: inline-block;","float: left;","padding: 0;","margin: 4px;","border-radius: 4px;","outline: none;","border: 1px solid;","transition: box-shadow .1s;","cursor: pointer;","}",".blocklyArrowTop {","border-top: 1px solid;","border-left: 1px solid;","border-top-left-radius: 4px;","border-color: inherit;","}",".blocklyArrowBottom {","border-bottom: 1px solid;","border-right: 1px solid;","border-bottom-right-radius: 4px;","border-color: inherit;","}",".blocklyResizeSE {","cursor: se-resize;","fill: #aaa;","}",".blocklyResizeSW {","cursor: sw-resize;","fill: #aaa;","}",".blocklyResizeLine {","stroke: #515A5A;","stroke-width: 1;","}",".blocklyHighlightedConnectionPath {","fill: none;","stroke: #fc3;","stroke-width: 4px;","}",".blocklyPathLight {","fill: none;","stroke-linecap: round;","stroke-width: 1;","}",".blocklySelected>.blocklyPathLight {","display: none;","}",".blocklyDraggable {",'cursor: url("<<>>/handopen.cur"), auto;',"cursor: grab;","cursor: -webkit-grab;","}",".blocklyDragging {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDraggable:active {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyBlockDragSurface .blocklyDraggable {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDragging.blocklyDraggingDelete {",'cursor: url("<<>>/handdelete.cur"), auto;',"}",".blocklyDragging>.blocklyPath,",".blocklyDragging>.blocklyPathLight {","fill-opacity: .8;","stroke-opacity: .8;","}",".blocklyDragging>.blocklyPathDark {","display: none;","}",".blocklyDisabled>.blocklyPath {","fill-opacity: .5;","stroke-opacity: .5;","}",".blocklyDisabled>.blocklyPathLight,",".blocklyDisabled>.blocklyPathDark {","display: none;","}",".blocklyInsertionMarker>.blocklyPath,",".blocklyInsertionMarker>.blocklyPathLight,",".blocklyInsertionMarker>.blocklyPathDark {","fill-opacity: .2;","stroke: none;","}",".blocklyMultilineText {","font-family: monospace;","}",".blocklyNonEditableText>text {","pointer-events: none;","}",".blocklyFlyout {","position: absolute;","z-index: 20;","}",".blocklyText text {","cursor: default;","}",".blocklySvg text,",".blocklyBlockDragSurface text {","user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","cursor: inherit;","}",".blocklyHidden {","display: none;","}",".blocklyFieldDropdown:not(.blocklyHidden) {","display: block;","}",".blocklyIconGroup {","cursor: default;","}",".blocklyIconGroup:not(:hover),",".blocklyIconGroupReadonly {","opacity: .6;","}",".blocklyIconShape {","fill: #00f;","stroke: #fff;","stroke-width: 1px;","}",".blocklyIconSymbol {","fill: #fff;","}",".blocklyMinimalBody {","margin: 0;","padding: 0;","}",".blocklyHtmlInput {","border: none;","border-radius: 4px;","height: 100%;","margin: 0;","outline: none;","padding: 0;","width: 100%;","text-align: center;","display: block;","box-sizing: border-box;","}",".blocklyHtmlInput::-ms-clear {","display: none;","}",".blocklyMainBackground {","stroke-width: 1;","stroke: #c6c6c6;","}",".blocklyMutatorBackground {","fill: #fff;","stroke: #ddd;","stroke-width: 1;","}",".blocklyFlyoutBackground {","fill: #ddd;","fill-opacity: .8;","}",".blocklyMainWorkspaceScrollbar {","z-index: 20;","}",".blocklyFlyoutScrollbar {","z-index: 30;","}",".blocklyScrollbarHorizontal,",".blocklyScrollbarVertical {","position: absolute;","outline: none;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarHandle {","fill: #ccc;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyScrollbarHandle:hover {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarHandle {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyFlyout .blocklyScrollbarHandle:hover {","fill: #aaa;","}",".blocklyInvalidInput {","background: #faa;","}",".blocklyVerticalMarker {","stroke-width: 3px;","fill: rgba(255,255,255,.5);","pointer-events: none;","}",".blocklyComputeCanvas {","position: absolute;","width: 0;","height: 0;","}",".blocklyNoPointerEvents {","pointer-events: none;","}",".blocklyContextMenu {","border-radius: 4px;","max-height: 100%;","}",".blocklyDropdownMenu {","border-radius: 2px;","padding: 0 !important;","}",".blocklyDropdownMenu .blocklyMenuItem {","padding-left: 28px;","}",".blocklyDropdownMenu .blocklyMenuItemRtl {","padding-left: 5px;","padding-right: 28px;","}",".blocklyWidgetDiv .blocklyMenu {","background: #fff;","border: 1px solid transparent;","box-shadow: 0 0 3px 1px rgba(0,0,0,.3);","font: normal 13px Arial, sans-serif;","margin: 0;","outline: none;","padding: 4px 0;","position: absolute;","overflow-y: auto;","overflow-x: hidden;","max-height: 100%;","z-index: 20000;","}",".blocklyWidgetDiv .blocklyMenu.blocklyFocused {","box-shadow: 0 0 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv .blocklyMenu {","background: inherit;","border: inherit;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;',"outline: none;","position: relative;","z-index: 20000;","}",".blocklyMenuItem {","border: none;","color: #000;","cursor: pointer;","list-style: none;","margin: 0;","min-width: 7em;","padding: 6px 15px;","white-space: nowrap;","}",".blocklyMenuItemDisabled {","color: #ccc;","cursor: inherit;","}",".blocklyMenuItemHighlight {","background-color: rgba(0,0,0,.1);","}",".blocklyMenuItemCheckbox {","height: 16px;","position: absolute;","width: 16px;","}",".blocklyMenuItemSelected .blocklyMenuItemCheckbox {","background: url(<<>>/sprites.png) no-repeat -48px -16px;","float: left;","margin-left: -24px;","position: static;","}",".blocklyMenuItemRtl .blocklyMenuItemCheckbox {","float: right;","margin-right: -24px;","}"],Blockly.utils.math={},Blockly.utils.math.toRadians=function(a){return a*Math.PI/180},Blockly.utils.math.toDegrees=function(a){return 180*a/Math.PI},Blockly.utils.math.clamp=function(a,b,c){var d;return ce.top?Blockly.DropDownDiv.getPositionAboveMetrics_(c,d,e,f):b+f.heightdocument.documentElement.clientTop?Blockly.DropDownDiv.getPositionAboveMetrics_(c,d,e,f):Blockly.DropDownDiv.getPositionTopOfPageMetrics_(a,e,f)},Blockly.DropDownDiv.getPositionBelowMetrics_=function(a,b,c,d){return{initialX:(a=Blockly.DropDownDiv.getPositionX(a,c.left,c.right,d.width)).divX,initialY:b,finalX:a.divX,finalY:b+Blockly.DropDownDiv.PADDING_Y,arrowX:a.arrowX,arrowY:-(Blockly.DropDownDiv.ARROW_SIZE/2+Blockly.DropDownDiv.BORDER_SIZE),arrowAtTop:!0,arrowVisible:!0}},Blockly.DropDownDiv.getPositionAboveMetrics_=function(a,b,c,d){return{initialX:(a=Blockly.DropDownDiv.getPositionX(a,c.left,c.right,d.width)).divX,initialY:b-d.height,finalX:a.divX,finalY:b-d.height-Blockly.DropDownDiv.PADDING_Y,arrowX:a.arrowX,arrowY:d.height-2*Blockly.DropDownDiv.BORDER_SIZE-Blockly.DropDownDiv.ARROW_SIZE/2,arrowAtTop:!1,arrowVisible:!0}},Blockly.DropDownDiv.getPositionTopOfPageMetrics_=function(a,b,c){return{initialX:(a=Blockly.DropDownDiv.getPositionX(a,b.left,b.right,c.width)).divX,initialY:0,finalX:a.divX,finalY:0,arrowAtTop:null,arrowX:null,arrowY:null,arrowVisible:!1}},Blockly.DropDownDiv.getPositionX=function(a,b,c,d){var e=a;return a=Blockly.utils.math.clamp(b,a-d/2,c-d),e-=Blockly.DropDownDiv.ARROW_SIZE/2,b=Blockly.DropDownDiv.ARROW_HORIZONTAL_PADDING,{arrowX:d=Blockly.utils.math.clamp(b,e-a,d-b-Blockly.DropDownDiv.ARROW_SIZE),divX:a}},Blockly.DropDownDiv.isVisible=function(){return!!Blockly.DropDownDiv.owner_},Blockly.DropDownDiv.hideIfOwner=function(a,b){return Blockly.DropDownDiv.owner_===a&&(b?Blockly.DropDownDiv.hideWithoutAnimation():Blockly.DropDownDiv.hide(),!0)},Blockly.DropDownDiv.hide=function(){var a=Blockly.DropDownDiv.DIV_;a.style.transform="translate(0, 0)",a.style.opacity=0,Blockly.DropDownDiv.animateOutTimer_=setTimeout(function(){Blockly.DropDownDiv.hideWithoutAnimation()},1e3*Blockly.DropDownDiv.ANIMATION_TIME),Blockly.DropDownDiv.onHide_&&(Blockly.DropDownDiv.onHide_(),Blockly.DropDownDiv.onHide_=null)},Blockly.DropDownDiv.hideWithoutAnimation=function(){var a;Blockly.DropDownDiv.isVisible()&&(Blockly.DropDownDiv.animateOutTimer_&&clearTimeout(Blockly.DropDownDiv.animateOutTimer_),(a=Blockly.DropDownDiv.DIV_).style.transform="",a.style.left="",a.style.top="",a.style.opacity=0,a.style.display="none",a.style.backgroundColor="",a.style.borderColor="",Blockly.DropDownDiv.onHide_&&(Blockly.DropDownDiv.onHide_(),Blockly.DropDownDiv.onHide_=null),Blockly.DropDownDiv.clearContent(),Blockly.DropDownDiv.owner_=null,Blockly.DropDownDiv.rendererClassName_&&(Blockly.utils.dom.removeClass(a,Blockly.DropDownDiv.rendererClassName_),Blockly.DropDownDiv.rendererClassName_=""),Blockly.DropDownDiv.themeClassName_&&(Blockly.utils.dom.removeClass(a,Blockly.DropDownDiv.themeClassName_),Blockly.DropDownDiv.themeClassName_=""),Blockly.getMainWorkspace().markFocused())},Blockly.DropDownDiv.positionInternal_=function(a,b,c,d){(a=Blockly.DropDownDiv.getPositionMetrics_(a,b,c,d)).arrowVisible?(Blockly.DropDownDiv.arrow_.style.display="",Blockly.DropDownDiv.arrow_.style.transform="translate("+a.arrowX+"px,"+a.arrowY+"px) rotate(45deg)",Blockly.DropDownDiv.arrow_.setAttribute("class",a.arrowAtTop?"blocklyDropDownArrow blocklyArrowTop":"blocklyDropDownArrow blocklyArrowBottom")):Blockly.DropDownDiv.arrow_.style.display="none",b=Math.floor(a.initialX),c=Math.floor(a.initialY),d=Math.floor(a.finalX);var e=Math.floor(a.finalY),f=Blockly.DropDownDiv.DIV_;return f.style.left=b+"px",f.style.top=c+"px",f.style.display="block",f.style.opacity=1,f.style.transform="translate("+(d-b)+"px,"+(e-c)+"px)",!!a.arrowAtTop},Blockly.DropDownDiv.repositionForWindowResize=function(){var a,b;Blockly.DropDownDiv.owner_?(b=(a=Blockly.DropDownDiv.owner_).getSourceBlock(),b=(a=Blockly.DropDownDiv.positionToField_?Blockly.DropDownDiv.getScaledBboxOfField_(a):Blockly.DropDownDiv.getScaledBboxOfBlock_(b)).left+(a.right-a.left)/2,Blockly.DropDownDiv.positionInternal_(b,a.bottom,b,a.top)):Blockly.DropDownDiv.hide()},Blockly.Grid=function(a,b){this.gridPattern_=a,this.spacing_=b.spacing,this.length_=b.length,this.line2_=(this.line1_=a.firstChild)&&this.line1_.nextSibling,this.snapToGrid_=b.snap},Blockly.Grid.prototype.scale_=1,Blockly.Grid.prototype.dispose=function(){this.gridPattern_=null},Blockly.Grid.prototype.shouldSnap=function(){return this.snapToGrid_},Blockly.Grid.prototype.getSpacing=function(){return this.spacing_},Blockly.Grid.prototype.getPatternId=function(){return this.gridPattern_.id},Blockly.Grid.prototype.update=function(a){this.scale_=a;var b=this.spacing_*a||100;this.gridPattern_.setAttribute("width",b),this.gridPattern_.setAttribute("height",b);var c=(b=Math.floor(this.spacing_/2)+.5)-this.length_/2,d=b+this.length_/2;this.setLineAttributes_(this.line1_,a,c*=a,d*=a,b*=a,b),this.setLineAttributes_(this.line2_,a,b,b,c,d)},Blockly.Grid.prototype.setLineAttributes_=function(a,b,c,d,e,f){a&&(a.setAttribute("stroke-width",b),a.setAttribute("x1",c),a.setAttribute("y1",e),a.setAttribute("x2",d),a.setAttribute("y2",f))},Blockly.Grid.prototype.moveTo=function(a,b){this.gridPattern_.setAttribute("x",a),this.gridPattern_.setAttribute("y",b),(Blockly.utils.userAgent.IE||Blockly.utils.userAgent.EDGE)&&this.update(this.scale_)},Blockly.Grid.createDom=function(a,b,c){return a=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.PATTERN,{id:"blocklyGridPattern"+a,patternUnits:"userSpaceOnUse"},c),0 document.")}else a=null;return a},Blockly.Options=function(a){var f,g,h,k,c,d,e,l,b=!!a.readOnly;b?(c=null,k=h=g=f=e=d=!1):(c=Blockly.utils.toolbox.convertToolboxDefToJson(a.toolbox),d=Blockly.utils.toolbox.hasCategories(c),e=a.trashcan,l=a.maxTrashcanContents,(e=void 0===e?d:e)?void 0===l&&(l=32):l=0,void 0===(f=a.collapse)&&(f=d),void 0===(g=a.comments)&&(g=d),void 0===(h=a.disable)&&(h=d),void 0===(k=a.sounds)&&(k=!0));var m=!!a.rtl,n=a.horizontalLayout,p="end"!==(p=a.toolboxPosition);p=(n=void 0===n?!1:n)?p?Blockly.utils.toolbox.Position.TOP:Blockly.utils.toolbox.Position.BOTTOM:p==m?Blockly.utils.toolbox.Position.RIGHT:Blockly.utils.toolbox.Position.LEFT;var q=a.css;void 0===q&&(q=!0);var t="https://blockly-demo.appspot.com/static/media/";a.media?t=a.media:a.path&&(t=a.path+"media/");var r=void 0===a.oneBasedIndex||!!a.oneBasedIndex,u=a.renderer||"geras",v=a.plugins||{};this.RTL=m,this.oneBasedIndex=r,this.collapse=f,this.comments=g,this.disable=h,this.readOnly=b,this.maxBlocks=a.maxBlocks||1/0,this.maxInstances=a.maxInstances,this.pathToMedia=t,this.hasCategories=d,this.moveOptions=Blockly.Options.parseMoveOptions_(a,d),this.hasScrollbars=!!this.moveOptions.scrollbars,this.hasTrashcan=e,this.maxTrashcanContents=l,this.hasSounds=k,this.hasCss=q,this.horizontalLayout=n,this.languageTree=c,this.gridOptions=Blockly.Options.parseGridOptions_(a),this.zoomOptions=Blockly.Options.parseZoomOptions_(a),this.toolboxPosition=p,this.theme=Blockly.Options.parseThemeOptions_(a),this.renderer=u,this.rendererOverrides=a.rendererOverrides,this.gridPattern=null,this.parentWorkspace=a.parentWorkspace,this.plugins=v},Blockly.BlocklyOptions=function(){},Blockly.Options.parseMoveOptions_=function(a,b){var c=a.move||{},d={};return void 0===c.scrollbars&&void 0===a.scrollbars?d.scrollbars=b:"object"==typeof c.scrollbars?(d.scrollbars={},d.scrollbars.horizontal=!!c.scrollbars.horizontal,d.scrollbars.vertical=!!c.scrollbars.vertical,d.scrollbars.horizontal&&d.scrollbars.vertical?d.scrollbars=!0:d.scrollbars.horizontal||d.scrollbars.vertical||(d.scrollbars=!1)):d.scrollbars=!!c.scrollbars||!!a.scrollbars,d.wheel=d.scrollbars&&void 0!==c.wheel?!!c.wheel:"object"==typeof d.scrollbars,d.drag=!!d.scrollbars&&(void 0===c.drag||!!c.drag),d},Blockly.Options.parseZoomOptions_=function(a){a=a.zoom||{};var b={};return b.controls=void 0!==a.controls&&!!a.controls,b.wheel=void 0!==a.wheel&&!!a.wheel,b.startScale=void 0===a.startScale?1:Number(a.startScale),b.maxScale=void 0===a.maxScale?3:Number(a.maxScale),b.minScale=void 0===a.minScale?.3:Number(a.minScale),b.scaleSpeed=void 0===a.scaleSpeed?1.2:Number(a.scaleSpeed),b.pinch=void 0===a.pinch?b.wheel||b.controls:!!a.pinch,b},Blockly.Options.parseGridOptions_=function(a){a=a.grid||{};var b={};return b.spacing=Number(a.spacing)||0,b.colour=a.colour||"#888",b.length=void 0===a.length?1:Number(a.length),b.snap=0=a.scrollWidth?(this.setHandleLength_(this.scrollbarLength_),this.setHandlePosition(0),this.pair_||this.setVisible(!1)):(this.pair_||this.setVisible(!0),b=this.scrollbarLength_*a.viewWidth/a.scrollWidth,b=this.constrainHandleLength_(b),this.setHandleLength_(b),b=a.scrollWidth-a.viewWidth,c=this.scrollbarLength_-this.handleLength_,a=(a.viewLeft-a.scrollLeft)/b*c,a=this.constrainHandlePosition_(a),this.setHandlePosition(a),this.ratio=c/b)},Blockly.Scrollbar.prototype.resizeVertical_=function(a){this.requiresViewResize_(a)?this.resizeViewVertical(a):this.resizeContentVertical(a)},Blockly.Scrollbar.prototype.resizeViewVertical=function(a){var b=a.viewHeight-2*Blockly.Scrollbar.SCROLLBAR_MARGIN;this.pair_&&(b-=Blockly.Scrollbar.scrollbarThickness),this.setScrollbarLength_(Math.max(0,b)),this.setPosition(this.workspace_.RTL?a.absoluteLeft+Blockly.Scrollbar.SCROLLBAR_MARGIN:a.absoluteLeft+a.viewWidth-Blockly.Scrollbar.scrollbarThickness-Blockly.Scrollbar.SCROLLBAR_MARGIN,a.absoluteTop+Blockly.Scrollbar.SCROLLBAR_MARGIN),this.resizeContentVertical(a)},Blockly.Scrollbar.prototype.resizeContentVertical=function(a){var b,c;a.viewHeight>=a.scrollHeight?(this.setHandleLength_(this.scrollbarLength_),this.setHandlePosition(0),this.pair_||this.setVisible(!1)):(this.pair_||this.setVisible(!0),b=this.scrollbarLength_*a.viewHeight/a.scrollHeight,b=this.constrainHandleLength_(b),this.setHandleLength_(b),b=a.scrollHeight-a.viewHeight,c=this.scrollbarLength_-this.handleLength_,a=(a.viewTop-a.scrollTop)/b*c,a=this.constrainHandlePosition_(a),this.setHandlePosition(a),this.ratio=c/b)},Blockly.Scrollbar.prototype.createDom_=function(a){var b="blocklyScrollbar"+(this.horizontal_?"Horizontal":"Vertical");a&&(b+=" "+a),this.outerSvg_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.SVG,{class:b},null),this.svgGroup_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.G,{},this.outerSvg_),this.svgBackground_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.RECT,{class:"blocklyScrollbarBackground"},this.svgGroup_),a=Math.floor((Blockly.Scrollbar.scrollbarThickness-5)/2),this.svgHandle_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.RECT,{class:"blocklyScrollbarHandle",rx:a,ry:a},this.svgGroup_),this.workspace_.getThemeManager().subscribe(this.svgHandle_,"scrollbarColour","fill"),this.workspace_.getThemeManager().subscribe(this.svgHandle_,"scrollbarOpacity","fill-opacity"),Blockly.utils.dom.insertAfter(this.outerSvg_,this.workspace_.getParentSvg())},Blockly.Scrollbar.prototype.isVisible=function(){return this.isVisible_},Blockly.Scrollbar.prototype.setContainerVisible=function(a){var b=a!=this.containerVisible_;this.containerVisible_=a,b&&this.updateDisplay_()},Blockly.Scrollbar.prototype.setVisible=function(a){var b=a!=this.isVisible();if(this.pair_)throw Error("Unable to toggle visibility of paired scrollbars.");this.isVisible_=a,b&&this.updateDisplay_()},Blockly.Scrollbar.prototype.updateDisplay_=function(){this.containerVisible_&&this.isVisible()?this.outerSvg_.setAttribute("display","block"):this.outerSvg_.setAttribute("display","none")},Blockly.Scrollbar.prototype.onMouseDownBar_=function(a){var b,c,d,e;this.workspace_.markFocused(),Blockly.Touch.clearTouchIdentifier(),this.cleanUp_(),Blockly.utils.isRightButton(a)?a.stopPropagation():(b=Blockly.utils.mouseToSvg(a,this.workspace_.getParentSvg(),this.workspace_.getInverseScreenCTM()),b=this.horizontal_?b.x:b.y,c=Blockly.utils.getInjectionDivXY_(this.svgHandle_),c=this.horizontal_?c.x:c.y,d=this.handlePosition_,e=.95*this.handleLength_,b<=c?d-=e:b>=c+this.handleLength_&&(d+=e),this.setHandlePosition(this.constrainHandlePosition_(d)),this.updateMetrics_(),a.stopPropagation(),a.preventDefault())},Blockly.Scrollbar.prototype.onMouseDownHandle_=function(a){this.workspace_.markFocused(),this.cleanUp_(),Blockly.utils.isRightButton(a)?a.stopPropagation():(this.startDragHandle=this.handlePosition_,this.workspace_.setupDragSurface(),this.startDragMouse_=this.horizontal_?a.clientX:a.clientY,Blockly.Scrollbar.onMouseUpWrapper_=Blockly.browserEvents.conditionalBind(document,"mouseup",this,this.onMouseUpHandle_),Blockly.Scrollbar.onMouseMoveWrapper_=Blockly.browserEvents.conditionalBind(document,"mousemove",this,this.onMouseMoveHandle_),a.stopPropagation(),a.preventDefault())},Blockly.Scrollbar.prototype.onMouseMoveHandle_=function(a){this.setHandlePosition(this.constrainHandlePosition_(this.startDragHandle+((this.horizontal_?a.clientX:a.clientY)-this.startDragMouse_))),this.updateMetrics_()},Blockly.Scrollbar.prototype.onMouseUpHandle_=function(){this.workspace_.resetDragSurface(),Blockly.Touch.clearTouchIdentifier(),this.cleanUp_()},Blockly.Scrollbar.prototype.cleanUp_=function(){Blockly.hideChaff(!0),Blockly.Scrollbar.onMouseUpWrapper_&&(Blockly.browserEvents.unbind(Blockly.Scrollbar.onMouseUpWrapper_),Blockly.Scrollbar.onMouseUpWrapper_=null),Blockly.Scrollbar.onMouseMoveWrapper_&&(Blockly.browserEvents.unbind(Blockly.Scrollbar.onMouseMoveWrapper_),Blockly.Scrollbar.onMouseMoveWrapper_=null)},Blockly.Scrollbar.prototype.getRatio_=function(){var a=this.handlePosition_/(this.scrollbarLength_-this.handleLength_);return a=isNaN(a)?0:a},Blockly.Scrollbar.prototype.updateMetrics_=function(){var a=this.getRatio_(),b={};this.horizontal_?b.x=a:b.y=a,this.workspace_.setMetrics(b)},Blockly.Scrollbar.prototype.set=function(a,b){this.setHandlePosition(this.constrainHandlePosition_(a*this.ratio)),!b&&void 0!==b||this.updateMetrics_()},Blockly.Scrollbar.prototype.setOrigin=function(a,b){this.origin_=new Blockly.utils.Coordinate(a,b)},Blockly.Tooltip={},Blockly.Tooltip.visible=!1,Blockly.Tooltip.blocked_=!1,Blockly.Tooltip.LIMIT=50,Blockly.Tooltip.mouseOutPid_=0,Blockly.Tooltip.showPid_=0,Blockly.Tooltip.lastX_=0,Blockly.Tooltip.lastY_=0,Blockly.Tooltip.element_=null,Blockly.Tooltip.poisonedElement_=null,Blockly.Tooltip.OFFSET_X=0,Blockly.Tooltip.OFFSET_Y=10,Blockly.Tooltip.RADIUS_OK=10,Blockly.Tooltip.HOVER_MS=750,Blockly.Tooltip.MARGINS=5,Blockly.Tooltip.DIV=null,Blockly.Tooltip.getTooltipOfObject=function(a){if(a=Blockly.Tooltip.getTargetObject_(a)){for(a=a.tooltip;"function"==typeof a;)a=a();if("string"!=typeof a)throw Error("Tooltip function must return a string.");return a}return""},Blockly.Tooltip.getTargetObject_=function(a){for(;a&&a.tooltip;){if("string"==typeof a.tooltip||"function"==typeof a.tooltip)return a;a=a.tooltip}return null},Blockly.Tooltip.createDom=function(){Blockly.Tooltip.DIV||(Blockly.Tooltip.DIV=document.createElement("div"),Blockly.Tooltip.DIV.className="blocklyTooltipDiv",(Blockly.parentContainer||document.body).appendChild(Blockly.Tooltip.DIV))},Blockly.Tooltip.bindMouseEvents=function(a){a.mouseOverWrapper_=Blockly.browserEvents.bind(a,"mouseover",null,Blockly.Tooltip.onMouseOver_),a.mouseOutWrapper_=Blockly.browserEvents.bind(a,"mouseout",null,Blockly.Tooltip.onMouseOut_),a.addEventListener("mousemove",Blockly.Tooltip.onMouseMove_,!1)},Blockly.Tooltip.unbindMouseEvents=function(a){a&&(Blockly.browserEvents.unbind(a.mouseOverWrapper_),Blockly.browserEvents.unbind(a.mouseOutWrapper_),a.removeEventListener("mousemove",Blockly.Tooltip.onMouseMove_))},Blockly.Tooltip.onMouseOver_=function(a){Blockly.Tooltip.blocked_||(a=Blockly.Tooltip.getTargetObject_(a.currentTarget),Blockly.Tooltip.element_!=a&&(Blockly.Tooltip.hide(),Blockly.Tooltip.poisonedElement_=null,Blockly.Tooltip.element_=a),clearTimeout(Blockly.Tooltip.mouseOutPid_))},Blockly.Tooltip.onMouseOut_=function(a){Blockly.Tooltip.blocked_||(Blockly.Tooltip.mouseOutPid_=setTimeout(function(){Blockly.Tooltip.element_=null,Blockly.Tooltip.poisonedElement_=null,Blockly.Tooltip.hide()},1),clearTimeout(Blockly.Tooltip.showPid_))},Blockly.Tooltip.onMouseMove_=function(a){var b;Blockly.Tooltip.element_&&Blockly.Tooltip.element_.tooltip&&!Blockly.Tooltip.blocked_&&(Blockly.Tooltip.visible?(b=Blockly.Tooltip.lastX_-a.pageX,a=Blockly.Tooltip.lastY_-a.pageY,Math.sqrt(b*b+a*a)>Blockly.Tooltip.RADIUS_OK&&Blockly.Tooltip.hide()):Blockly.Tooltip.poisonedElement_!=Blockly.Tooltip.element_&&(clearTimeout(Blockly.Tooltip.showPid_),Blockly.Tooltip.lastX_=a.pageX,Blockly.Tooltip.lastY_=a.pageY,Blockly.Tooltip.showPid_=setTimeout(Blockly.Tooltip.show_,Blockly.Tooltip.HOVER_MS)))},Blockly.Tooltip.dispose=function(){Blockly.Tooltip.element_=null,Blockly.Tooltip.poisonedElement_=null,Blockly.Tooltip.hide()},Blockly.Tooltip.hide=function(){Blockly.Tooltip.visible&&(Blockly.Tooltip.visible=!1,Blockly.Tooltip.DIV&&(Blockly.Tooltip.DIV.style.display="none")),Blockly.Tooltip.showPid_&&clearTimeout(Blockly.Tooltip.showPid_)},Blockly.Tooltip.block=function(){Blockly.Tooltip.hide(),Blockly.Tooltip.blocked_=!0},Blockly.Tooltip.unblock=function(){Blockly.Tooltip.blocked_=!1},Blockly.Tooltip.show_=function(){if(!Blockly.Tooltip.blocked_&&(Blockly.Tooltip.poisonedElement_=Blockly.Tooltip.element_,Blockly.Tooltip.DIV)){Blockly.Tooltip.DIV.textContent="";var a=Blockly.Tooltip.getTooltipOfObject(Blockly.Tooltip.element_);a=(a=Blockly.utils.string.wrap(a,Blockly.Tooltip.LIMIT)).split("\n");for(var b=0;bc+window.scrollY&&(e-=Blockly.Tooltip.DIV.offsetHeight+2*Blockly.Tooltip.OFFSET_Y),a?d=Math.max(Blockly.Tooltip.MARGINS-window.scrollX,d):d+Blockly.Tooltip.DIV.offsetWidth>b+window.scrollX-2*Blockly.Tooltip.MARGINS&&(d=b-Blockly.Tooltip.DIV.offsetWidth-2*Blockly.Tooltip.MARGINS),Blockly.Tooltip.DIV.style.top=e+"px",Blockly.Tooltip.DIV.style.left=d+"px"}},Blockly.utils.aria={},Blockly.utils.aria.ARIA_PREFIX_="aria-",Blockly.utils.aria.ROLE_ATTRIBUTE_="role",Blockly.utils.aria.Role={GRID:"grid",GRIDCELL:"gridcell",GROUP:"group",LISTBOX:"listbox",MENU:"menu",MENUITEM:"menuitem",MENUITEMCHECKBOX:"menuitemcheckbox",OPTION:"option",PRESENTATION:"presentation",ROW:"row",TREE:"tree",TREEITEM:"treeitem"},Blockly.utils.aria.State={ACTIVEDESCENDANT:"activedescendant",COLCOUNT:"colcount",DISABLED:"disabled",EXPANDED:"expanded",INVALID:"invalid",LABEL:"label",LABELLEDBY:"labelledby",LEVEL:"level",ORIENTATION:"orientation",POSINSET:"posinset",ROWCOUNT:"rowcount",SELECTED:"selected",SETSIZE:"setsize",VALUEMAX:"valuemax",VALUEMIN:"valuemin"},Blockly.utils.aria.setRole=function(a,b){a.setAttribute(Blockly.utils.aria.ROLE_ATTRIBUTE_,b)},Blockly.utils.aria.setState=function(a,b,c){Array.isArray(c)&&(c=c.join(" ")),a.setAttribute(Blockly.utils.aria.ARIA_PREFIX_+b,c)},Blockly.WorkspaceDragSurfaceSvg=function(a){this.container_=a,this.createDom()},Blockly.WorkspaceDragSurfaceSvg.prototype.SVG_=null,Blockly.WorkspaceDragSurfaceSvg.prototype.container_=null,Blockly.WorkspaceDragSurfaceSvg.prototype.createDom=function(){this.SVG_||(this.SVG_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.SVG,{xmlns:Blockly.utils.dom.SVG_NS,"xmlns:html":Blockly.utils.dom.HTML_NS,"xmlns:xlink":Blockly.utils.dom.XLINK_NS,version:"1.1",class:"blocklyWsDragSurface blocklyOverflowVisible"},null),this.container_.appendChild(this.SVG_))},Blockly.WorkspaceDragSurfaceSvg.prototype.translateSurface=function(a,b){a=a.toFixed(0),b=b.toFixed(0),this.SVG_.style.display="block",Blockly.utils.dom.setCssTransform(this.SVG_,"translate3d("+a+"px, "+b+"px, 0px)")},Blockly.WorkspaceDragSurfaceSvg.prototype.getSurfaceTranslation=function(){return Blockly.utils.getRelativeXY(this.SVG_)},Blockly.WorkspaceDragSurfaceSvg.prototype.clearAndHide=function(a){if(!a)throw Error("Couldn't clear and hide the drag surface: missing new surface.");var b=this.SVG_.childNodes[0],c=this.SVG_.childNodes[1];if(!(b&&c&&Blockly.utils.dom.hasClass(b,"blocklyBlockCanvas")&&Blockly.utils.dom.hasClass(c,"blocklyBubbleCanvas")))throw Error("Couldn't clear and hide the drag surface. A node was missing.");if(null!=this.previousSibling_?Blockly.utils.dom.insertAfter(b,this.previousSibling_):a.insertBefore(b,a.firstChild),Blockly.utils.dom.insertAfter(c,b),this.SVG_.style.display="none",this.SVG_.childNodes.length)throw Error("Drag surface was not cleared.");Blockly.utils.dom.setCssTransform(this.SVG_,""),this.previousSibling_=null},Blockly.WorkspaceDragSurfaceSvg.prototype.setContentsAndShow=function(a,b,c,d,e,f){if(this.SVG_.childNodes.length)throw Error("Already dragging a block.");this.previousSibling_=c,a.setAttribute("transform","translate(0, 0) scale("+f+")"),b.setAttribute("transform","translate(0, 0) scale("+f+")"),this.SVG_.setAttribute("width",d),this.SVG_.setAttribute("height",e),this.SVG_.appendChild(a),this.SVG_.appendChild(b),this.SVG_.style.display="block"},Blockly.blockRendering={},Blockly.blockRendering.useDebugger=!1,Blockly.blockRendering.register=function(a,b){Blockly.registry.register(Blockly.registry.Type.RENDERER,a,b)},Blockly.blockRendering.unregister=function(a){Blockly.registry.unregister(Blockly.registry.Type.RENDERER,a)},Blockly.blockRendering.startDebugger=function(){Blockly.blockRendering.useDebugger=!0},Blockly.blockRendering.stopDebugger=function(){Blockly.blockRendering.useDebugger=!1},Blockly.blockRendering.init=function(a,b,c){return(a=new(Blockly.registry.getClass(Blockly.registry.Type.RENDERER,a))(a)).init(b,c),a},Blockly.ASTNode=function(a,b,c){if(!b)throw Error("Cannot create a node without a location.");this.type_=a,this.isConnection_=Blockly.ASTNode.isConnectionType_(a),this.location_=b,this.wsCoordinate_=null,this.processParams_(c||null)},Blockly.ASTNode.types={FIELD:"field",BLOCK:"block",INPUT:"input",OUTPUT:"output",NEXT:"next",PREVIOUS:"previous",STACK:"stack",WORKSPACE:"workspace"},Blockly.ASTNode.NAVIGATE_ALL_FIELDS=!1,Blockly.ASTNode.DEFAULT_OFFSET_Y=-20,Blockly.ASTNode.isConnectionType_=function(a){switch(a){case Blockly.ASTNode.types.PREVIOUS:case Blockly.ASTNode.types.NEXT:case Blockly.ASTNode.types.INPUT:case Blockly.ASTNode.types.OUTPUT:return!0}return!1},Blockly.ASTNode.createFieldNode=function(a){return a?new Blockly.ASTNode(Blockly.ASTNode.types.FIELD,a):null},Blockly.ASTNode.createConnectionNode=function(a){if(!a)return null;var b=a.type;return b==Blockly.connectionTypes.INPUT_VALUE||b==Blockly.connectionTypes.NEXT_STATEMENT&&a.getParentInput()?Blockly.ASTNode.createInputNode(a.getParentInput()):b==Blockly.connectionTypes.NEXT_STATEMENT?new Blockly.ASTNode(Blockly.ASTNode.types.NEXT,a):b==Blockly.connectionTypes.OUTPUT_VALUE?new Blockly.ASTNode(Blockly.ASTNode.types.OUTPUT,a):b==Blockly.connectionTypes.PREVIOUS_STATEMENT?new Blockly.ASTNode(Blockly.ASTNode.types.PREVIOUS,a):null},Blockly.ASTNode.createInputNode=function(a){return a&&a.connection?new Blockly.ASTNode(Blockly.ASTNode.types.INPUT,a.connection):null},Blockly.ASTNode.createBlockNode=function(a){return a?new Blockly.ASTNode(Blockly.ASTNode.types.BLOCK,a):null},Blockly.ASTNode.createStackNode=function(a){return a?new Blockly.ASTNode(Blockly.ASTNode.types.STACK,a):null},Blockly.ASTNode.createWorkspaceNode=function(a,b){return b&&a?new Blockly.ASTNode(Blockly.ASTNode.types.WORKSPACE,a,{wsCoordinate:b}):null},Blockly.ASTNode.createTopNode=function(a){var b=a.previousConnection||a.outputConnection;return b?Blockly.ASTNode.createConnectionNode(b):Blockly.ASTNode.createBlockNode(a)},Blockly.ASTNode.prototype.processParams_=function(a){a&&a.wsCoordinate&&(this.wsCoordinate_=a.wsCoordinate)},Blockly.ASTNode.prototype.getLocation=function(){return this.location_},Blockly.ASTNode.prototype.getType=function(){return this.type_},Blockly.ASTNode.prototype.getWsCoordinate=function(){return this.wsCoordinate_},Blockly.ASTNode.prototype.isConnection=function(){return this.isConnection_},Blockly.ASTNode.prototype.findNextForInput_=function(){for(var c,b=(a=this.location_.getParentInput()).getSourceBlock(),a=b.inputList.indexOf(a)+1;c=b.inputList[a];a++){for(var f,d=c.fieldRow,e=0;f=d[e];e++)if(f.isClickable()||Blockly.ASTNode.NAVIGATE_ALL_FIELDS)return Blockly.ASTNode.createFieldNode(f);if(c.connection)return Blockly.ASTNode.createInputNode(c)}return null},Blockly.ASTNode.prototype.findNextForField_=function(){for(var b=(a=this.location_).getParentInput(),c=a.getSourceBlock(),d=c.inputList.indexOf(b),a=b.fieldRow.indexOf(a)+1;b=c.inputList[d];d++){for(var e=b.fieldRow;ab-Blockly.CURRENT_CONNECTION_PREFERENCE)):((this.localConnection_||this.closestConnection_)&&(console.error("Only one of localConnection_ and closestConnection_ was set."),console.error("Returning true from shouldUpdatePreviews, but it's not clear why.")),!0):!(!this.localConnection_||!this.closestConnection_)},Blockly.InsertionMarkerManager.prototype.getCandidate_=function(a){for(var b=this.getStartRadius_(),c=null,d=null,e=0;ec||b.getSourceBlock().isInsertionMarker())return!1;switch(b.type){case Blockly.connectionTypes.PREVIOUS_STATEMENT:return this.canConnectToPrevious_(a,b);case Blockly.connectionTypes.OUTPUT_VALUE:if(b.isConnected()&&!b.targetBlock().isInsertionMarker()||a.isConnected())return!1;break;case Blockly.connectionTypes.INPUT_VALUE:if(b.isConnected()&&!b.targetBlock().isMovable()&&!b.targetBlock().isShadow())return!1;break;case Blockly.connectionTypes.NEXT_STATEMENT:if(b.isConnected()&&!a.getSourceBlock().nextConnection&&!b.targetBlock().isShadow()&&b.targetBlock().nextConnection)return!1;break;default:return!1}return-1==Blockly.draggingConnections.indexOf(b)},Blockly.ConnectionChecker.prototype.canConnectToPrevious_=function(a,b){return!a.targetConnection&&-1==Blockly.draggingConnections.indexOf(b)&&(!b.targetConnection||!!(a=b.targetBlock()).isInsertionMarker()&&!a.getPreviousBlock())},Blockly.registry.register(Blockly.registry.Type.CONNECTION_CHECKER,Blockly.registry.DEFAULT,Blockly.ConnectionChecker),Blockly.VariableMap=function(a){this.variableMap_=Object.create(null),this.workspace=a},Blockly.VariableMap.prototype.clear=function(){this.variableMap_=Object.create(null)},Blockly.VariableMap.prototype.renameVariable=function(a,b){var c=this.getVariable(b,a.type),d=this.workspace.getAllBlocks(!1);Blockly.Events.setGroup(!0);try{c&&c.getId()!=a.getId()?this.renameVariableWithConflict_(a,b,c,d):this.renameVariableAndUses_(a,b,d)}finally{Blockly.Events.setGroup(!1)}},Blockly.VariableMap.prototype.renameVariableById=function(a,b){var c=this.getVariableById(a);if(!c)throw Error("Tried to rename a variable that didn't exist. ID: "+a);this.renameVariable(c,b)},Blockly.VariableMap.prototype.renameVariableAndUses_=function(a,b,c){for(Blockly.Events.fire(new(Blockly.Events.get(Blockly.Events.VAR_RENAME))(a,b)),a.name=b,b=0;bthis.remainingCapacityOfType(c))return!1;b+=a[c]}return!(b>this.remainingCapacity())},Blockly.Workspace.prototype.hasBlockLimits=function(){return 1/0!=this.options.maxBlocks||!!this.options.maxInstances},Blockly.Workspace.prototype.getUndoStack=function(){return this.undoStack_},Blockly.Workspace.prototype.getRedoStack=function(){return this.redoStack_},Blockly.Workspace.prototype.undo=function(a){var b=a?this.redoStack_:this.undoStack_,c=a?this.undoStack_:this.redoStack_,d=b.pop();if(d){for(var e=[d];b.length&&d.group&&d.group==b[b.length-1].group;)e.push(b.pop());for(b=0;d=e[b];b++)c.push(d);e=Blockly.Events.filter(e,a),Blockly.Events.recordUndo=!1;try{for(b=0;d=e[b];b++)d.run(a)}finally{Blockly.Events.recordUndo=!0}}},Blockly.Workspace.prototype.clearUndo=function(){this.undoStack_.length=0,this.redoStack_.length=0,Blockly.Events.clearPendingUndo()},Blockly.Workspace.prototype.addChangeListener=function(a){return this.listeners_.push(a),a},Blockly.Workspace.prototype.removeChangeListener=function(a){Blockly.utils.arrayRemove(this.listeners_,a)},Blockly.Workspace.prototype.fireChangeListener=function(a){if(a.recordUndo)for(this.undoStack_.push(a),this.redoStack_.length=0;this.undoStack_.length>this.MAX_UNDO&&0<=this.MAX_UNDO;)this.undoStack_.shift();for(var c,b=0;c=this.listeners_[b];b++)c(a)},Blockly.Workspace.prototype.getBlockById=function(a){return this.blockDB_[a]||null},Blockly.Workspace.prototype.setBlockById=function(a,b){this.blockDB_[a]=b},Blockly.Workspace.prototype.removeBlockById=function(a){delete this.blockDB_[a]},Blockly.Workspace.prototype.getCommentById=function(a){return this.commentDB_[a]||null},Blockly.Workspace.prototype.allInputsFilled=function(a){for(var d,b=this.getTopBlocks(!1),c=0;d=b[c];c++)if(!d.allInputsFilled(a))return!1;return!0},Blockly.Workspace.prototype.getPotentialVariableMap=function(){return this.potentialVariableMap_},Blockly.Workspace.prototype.createPotentialVariableMap=function(){this.potentialVariableMap_=new Blockly.VariableMap(this)},Blockly.Workspace.prototype.getVariableMap=function(){return this.variableMap_},Blockly.Workspace.prototype.setVariableMap=function(a){this.variableMap_=a},Blockly.Workspace.WorkspaceDB_=Object.create(null),Blockly.Workspace.getById=function(a){return Blockly.Workspace.WorkspaceDB_[a]||null},Blockly.Workspace.getAll=function(){var b,a=[];for(b in Blockly.Workspace.WorkspaceDB_)a.push(Blockly.Workspace.WorkspaceDB_[b]);return a},Blockly.Bubble=function(a,b,c,d,e,f){this.workspace_=a,this.content_=b,this.shape_=c,this.onMouseDownResizeWrapper_=this.onMouseDownBubbleWrapper_=this.moveCallback_=this.resizeCallback_=null,this.disposed=!1,c=Blockly.Bubble.ARROW_ANGLE,this.workspace_.RTL&&(c=-c),this.arrow_radians_=Blockly.utils.math.toRadians(c),a.getBubbleCanvas().appendChild(this.createDom_(b,!(!e||!f))),this.setAnchorLocation(d),e&&f||(e=(a=this.content_.getBBox()).width+2*Blockly.Bubble.BORDER_WIDTH,f=a.height+2*Blockly.Bubble.BORDER_WIDTH),this.setBubbleSize(e,f),this.positionBubble_(),this.renderArrow_(),this.rendered_=!0},Blockly.Bubble.BORDER_WIDTH=6,Blockly.Bubble.ARROW_THICKNESS=5,Blockly.Bubble.ARROW_ANGLE=20,Blockly.Bubble.ARROW_BEND=4,Blockly.Bubble.ANCHOR_RADIUS=8,Blockly.Bubble.onMouseUpWrapper_=null,Blockly.Bubble.onMouseMoveWrapper_=null,Blockly.Bubble.unbindDragEvents_=function(){Blockly.Bubble.onMouseUpWrapper_&&(Blockly.browserEvents.unbind(Blockly.Bubble.onMouseUpWrapper_),Blockly.Bubble.onMouseUpWrapper_=null),Blockly.Bubble.onMouseMoveWrapper_&&(Blockly.browserEvents.unbind(Blockly.Bubble.onMouseMoveWrapper_),Blockly.Bubble.onMouseMoveWrapper_=null)},Blockly.Bubble.bubbleMouseUp_=function(a){Blockly.Touch.clearTouchIdentifier(),Blockly.Bubble.unbindDragEvents_()},Blockly.Bubble.prototype.rendered_=!1,Blockly.Bubble.prototype.anchorXY_=null,Blockly.Bubble.prototype.relativeLeft_=0,Blockly.Bubble.prototype.relativeTop_=0,Blockly.Bubble.prototype.width_=0,Blockly.Bubble.prototype.height_=0,Blockly.Bubble.prototype.autoLayout_=!0,Blockly.Bubble.prototype.createDom_=function(a,b){this.bubbleGroup_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.G,{},null);var c={filter:"url(#"+this.workspace_.getRenderer().getConstants().embossFilterId+")"};return Blockly.utils.userAgent.JAVA_FX&&(c={}),c=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.G,c,this.bubbleGroup_),this.bubbleArrow_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.PATH,{},c),this.bubbleBack_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.RECT,{class:"blocklyDraggable",x:0,y:0,rx:Blockly.Bubble.BORDER_WIDTH,ry:Blockly.Bubble.BORDER_WIDTH},c),b?(this.resizeGroup_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.G,{class:this.workspace_.RTL?"blocklyResizeSW":"blocklyResizeSE"},this.bubbleGroup_),b=2*Blockly.Bubble.BORDER_WIDTH,Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.POLYGON,{points:"0,x x,x x,0".replace(/x/g,b.toString())},this.resizeGroup_),Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.LINE,{class:"blocklyResizeLine",x1:b/3,y1:b-1,x2:b-1,y2:b/3},this.resizeGroup_),Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.LINE,{class:"blocklyResizeLine",x1:2*b/3,y1:b-1,x2:b-1,y2:2*b/3},this.resizeGroup_)):this.resizeGroup_=null,this.workspace_.options.readOnly||(this.onMouseDownBubbleWrapper_=Blockly.browserEvents.conditionalBind(this.bubbleBack_,"mousedown",this,this.bubbleMouseDown_),this.resizeGroup_&&(this.onMouseDownResizeWrapper_=Blockly.browserEvents.conditionalBind(this.resizeGroup_,"mousedown",this,this.resizeMouseDown_))),this.bubbleGroup_.appendChild(a),this.bubbleGroup_},Blockly.Bubble.prototype.getSvgRoot=function(){return this.bubbleGroup_},Blockly.Bubble.prototype.setSvgId=function(a){this.bubbleGroup_.dataset&&(this.bubbleGroup_.dataset.blockId=a)},Blockly.Bubble.prototype.bubbleMouseDown_=function(a){var b=this.workspace_.getGesture(a);b&&b.handleBubbleStart(a,this)},Blockly.Bubble.prototype.showContextMenu=function(a){},Blockly.Bubble.prototype.isDeletable=function(){return!1},Blockly.Bubble.prototype.setDeleteStyle=function(a){},Blockly.Bubble.prototype.resizeMouseDown_=function(a){this.promote(),Blockly.Bubble.unbindDragEvents_(),Blockly.utils.isRightButton(a)||(this.workspace_.startDrag(a,new Blockly.utils.Coordinate(this.workspace_.RTL?-this.width_:this.width_,this.height_)),Blockly.Bubble.onMouseUpWrapper_=Blockly.browserEvents.conditionalBind(document,"mouseup",this,Blockly.Bubble.bubbleMouseUp_),Blockly.Bubble.onMouseMoveWrapper_=Blockly.browserEvents.conditionalBind(document,"mousemove",this,this.resizeMouseMove_),Blockly.hideChaff()),a.stopPropagation()},Blockly.Bubble.prototype.resizeMouseMove_=function(a){this.autoLayout_=!1,a=this.workspace_.moveDrag(a),this.setBubbleSize(this.workspace_.RTL?-a.x:a.x,a.y),this.workspace_.RTL&&this.positionBubble_()},Blockly.Bubble.prototype.registerResizeEvent=function(a){this.resizeCallback_=a},Blockly.Bubble.prototype.registerMoveEvent=function(a){this.moveCallback_=a},Blockly.Bubble.prototype.promote=function(){var a=this.bubbleGroup_.parentNode;return a.lastChild!==this.bubbleGroup_&&(a.appendChild(this.bubbleGroup_),!0)},Blockly.Bubble.prototype.setAnchorLocation=function(a){this.anchorXY_=a,this.rendered_&&this.positionBubble_()},Blockly.Bubble.prototype.layoutBubble_=function(){var a=this.workspace_.getMetricsManager().getViewMetrics(!0),b=this.getOptimalRelativeLeft_(a),c=this.getOptimalRelativeTop_(a),d=this.shape_.getBBox(),e={x:b,y:-this.height_-this.workspace_.getRenderer().getConstants().MIN_BLOCK_HEIGHT},f={x:-this.width_-30,y:c},c={x:d.width,y:c},g={x:b,y:d.height},b=d.widtha.width||(this.workspace_.RTL?(d=(c=this.anchorXY_.x-b)-this.width_,e=a.left+a.width,f=a.left+Blockly.Scrollbar.scrollbarThickness/this.workspace_.scale):(c=(d=b+this.anchorXY_.x)+this.width_,f=a.left,e=a.left+a.width-Blockly.Scrollbar.scrollbarThickness/this.workspace_.scale),this.workspace_.RTL?da.height)return b;var c=this.anchorXY_.y+b,d=c+this.height_,e=a.top;a=a.top+a.height-Blockly.Scrollbar.scrollbarThickness/this.workspace_.scale;var f=this.anchorXY_.y;return c2*Math.PI&&(h-=2*Math.PI),k=Math.sin(h),l=Math.cos(h),h=((m=this.getBubbleSize()).width+m.height)/Blockly.Bubble.ARROW_THICKNESS,h=Math.min(h,m.width,m.height)/4,d=b+(m=1-Blockly.Bubble.ANCHOR_RADIUS/f)*d,e=c+m*e,m=b+h*l,n=c+h*k,b-=h*l,c-=h*k,(k=g+this.arrow_radians_)>2*Math.PI&&(k-=2*Math.PI),g=Math.sin(k)*f/Blockly.Bubble.ARROW_BEND,f=Math.cos(k)*f/Blockly.Bubble.ARROW_BEND,a.push("M"+m+","+n),a.push("C"+(m+f)+","+(n+g)+" "+d+","+e+" "+d+","+e),a.push("C"+d+","+e+" "+(b+f)+","+(c+g)+" "+b+","+c)),a.push("z"),this.bubbleArrow_.setAttribute("d",a.join(" "))},Blockly.Bubble.prototype.setColour=function(a){this.bubbleBack_.setAttribute("fill",a),this.bubbleArrow_.setAttribute("fill",a)},Blockly.Bubble.prototype.dispose=function(){this.onMouseDownBubbleWrapper_&&Blockly.browserEvents.unbind(this.onMouseDownBubbleWrapper_),this.onMouseDownResizeWrapper_&&Blockly.browserEvents.unbind(this.onMouseDownResizeWrapper_),Blockly.Bubble.unbindDragEvents_(),Blockly.utils.dom.removeNode(this.bubbleGroup_),this.disposed=!0},Blockly.Bubble.prototype.moveDuringDrag=function(a,b){a?a.translateSurface(b.x,b.y):this.moveTo(b.x,b.y),this.relativeLeft_=this.workspace_.RTL?this.anchorXY_.x-b.x-this.width_:b.x-this.anchorXY_.x,this.relativeTop_=b.y-this.anchorXY_.y,this.renderArrow_()},Blockly.Bubble.prototype.getRelativeToSurfaceXY=function(){return new Blockly.utils.Coordinate(this.workspace_.RTL?-this.relativeLeft_+this.anchorXY_.x-this.width_:this.anchorXY_.x+this.relativeLeft_,this.anchorXY_.y+this.relativeTop_)},Blockly.Bubble.prototype.setAutoLayout=function(a){this.autoLayout_=a},Blockly.Bubble.textToDom=function(a){var b=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.TEXT,{class:"blocklyText blocklyBubbleText blocklyNoPointerEvents",y:Blockly.Bubble.BORDER_WIDTH},null);a=a.split("\n");for(var c=0;c(this.flyout_?Blockly.FLYOUT_DRAG_RADIUS:Blockly.DRAG_RADIUS))},Blockly.Gesture.prototype.updateIsDraggingFromFlyout_=function(){return!(!this.targetBlock_||!this.flyout_.isBlockCreatable_(this.targetBlock_))&&(!(this.flyout_.isScrollable()&&!this.flyout_.isDragTowardWorkspace(this.currentDragDeltaXY_))&&(this.startWorkspace_=this.flyout_.targetWorkspace,this.startWorkspace_.updateScreenCalculationsIfScrolled(),Blockly.Events.getGroup()||Blockly.Events.setGroup(!0),this.startBlock_=null,this.targetBlock_=this.flyout_.createBlock(this.targetBlock_),this.targetBlock_.select(),!0))},Blockly.Gesture.prototype.updateIsDraggingBubble_=function(){return!!this.startBubble_&&(this.isDraggingBubble_=!0,this.startDraggingBubble_(),!0)},Blockly.Gesture.prototype.updateIsDraggingBlock_=function(){return!!this.targetBlock_&&(this.flyout_?this.isDraggingBlock_=this.updateIsDraggingFromFlyout_():this.targetBlock_.isMovable()&&(this.isDraggingBlock_=!0),!!this.isDraggingBlock_&&(this.startDraggingBlock_(),!0))},Blockly.Gesture.prototype.updateIsDraggingWorkspace_=function(){(this.flyout_?this.flyout_.isScrollable():this.startWorkspace_&&this.startWorkspace_.isDraggable())&&(this.workspaceDragger_=new Blockly.WorkspaceDragger(this.startWorkspace_),this.isDraggingWorkspace_=!0,this.workspaceDragger_.startDrag())},Blockly.Gesture.prototype.updateIsDragging_=function(){if(this.calledUpdateIsDragging_)throw Error("updateIsDragging_ should only be called once per gesture.");this.calledUpdateIsDragging_=!0,this.updateIsDraggingBubble_()||this.updateIsDraggingBlock_()||this.updateIsDraggingWorkspace_()},Blockly.Gesture.prototype.startDraggingBlock_=function(){this.blockDragger_=new Blockly.BlockDragger(this.targetBlock_,this.startWorkspace_),this.blockDragger_.startBlockDrag(this.currentDragDeltaXY_,this.healStack_),this.blockDragger_.dragBlock(this.mostRecentEvent_,this.currentDragDeltaXY_)},Blockly.Gesture.prototype.startDraggingBubble_=function(){this.bubbleDragger_=new Blockly.BubbleDragger(this.startBubble_,this.startWorkspace_),this.bubbleDragger_.startBubbleDrag(),this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_)},Blockly.Gesture.prototype.doStart=function(a){Blockly.utils.isTargetInput(a)?this.cancel():(this.hasStarted_=!0,Blockly.blockAnimations.disconnectUiStop(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),Blockly.hideChaff(!!this.flyout_),this.startWorkspace_.markFocused(),this.mostRecentEvent_=a,Blockly.Tooltip.block(),this.targetBlock_&&this.targetBlock_.select(),Blockly.utils.isRightButton(a)?this.handleRightClick(a):("touchstart"!=a.type.toLowerCase()&&"pointerdown"!=a.type.toLowerCase()||"mouse"==a.pointerType||Blockly.longStart(a,this),this.mouseDownXY_=new Blockly.utils.Coordinate(a.clientX,a.clientY),this.healStack_=a.altKey||a.ctrlKey||a.metaKey,this.bindMouseEvents(a)))},Blockly.Gesture.prototype.bindMouseEvents=function(a){this.onMoveWrapper_=Blockly.browserEvents.conditionalBind(document,"mousemove",null,this.handleMove.bind(this)),this.onUpWrapper_=Blockly.browserEvents.conditionalBind(document,"mouseup",null,this.handleUp.bind(this)),a.preventDefault(),a.stopPropagation()},Blockly.Gesture.prototype.handleMove=function(a){this.updateFromEvent_(a),this.isDraggingWorkspace_?this.workspaceDragger_.drag(this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.dragBlock(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingBubble_&&this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_),a.preventDefault(),a.stopPropagation()},Blockly.Gesture.prototype.handleUp=function(a){this.updateFromEvent_(a),Blockly.longStop_(),this.isEnding_?console.log("Trying to end a gesture recursively."):(this.isEnding_=!0,this.isDraggingBubble_?this.bubbleDragger_.endBubbleDrag(a,this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.endBlockDrag(a,this.currentDragDeltaXY_):this.isDraggingWorkspace_?this.workspaceDragger_.endDrag(this.currentDragDeltaXY_):this.isBubbleClick_()?this.doBubbleClick_():this.isFieldClick_()?this.doFieldClick_():this.isBlockClick_()?this.doBlockClick_():this.isWorkspaceClick_()&&this.doWorkspaceClick_(a),a.preventDefault(),a.stopPropagation(),this.dispose())},Blockly.Gesture.prototype.cancel=function(){this.isEnding_||(Blockly.longStop_(),this.isDraggingBubble_?this.bubbleDragger_.endBubbleDrag(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.endBlockDrag(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingWorkspace_&&this.workspaceDragger_.endDrag(this.currentDragDeltaXY_),this.dispose())},Blockly.Gesture.prototype.handleRightClick=function(a){this.targetBlock_?(this.bringBlockToFront_(),Blockly.hideChaff(!!this.flyout_),this.targetBlock_.showContextMenu(a)):this.startBubble_?this.startBubble_.showContextMenu(a):this.startWorkspace_&&!this.flyout_&&(Blockly.hideChaff(),this.startWorkspace_.showContextMenu(a)),a.preventDefault(),a.stopPropagation(),this.dispose()},Blockly.Gesture.prototype.handleWsStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");this.setStartWorkspace_(b),this.mostRecentEvent_=a,this.doStart(a)},Blockly.Gesture.prototype.fireWorkspaceClick_=function(a){Blockly.Events.fire(new(Blockly.Events.get(Blockly.Events.CLICK))(null,a.id,"workspace"))},Blockly.Gesture.prototype.handleFlyoutStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");this.setStartFlyout_(b),this.handleWsStart(a,b.getWorkspace())},Blockly.Gesture.prototype.handleBlockStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleBlockStart, but the gesture had already been started.");this.setStartBlock(b),this.mostRecentEvent_=a},Blockly.Gesture.prototype.handleBubbleStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");this.setStartBubble(b),this.mostRecentEvent_=a},Blockly.Gesture.prototype.doBubbleClick_=function(){this.startBubble_.setFocus&&this.startBubble_.setFocus(),this.startBubble_.select&&this.startBubble_.select()},Blockly.Gesture.prototype.doFieldClick_=function(){this.startField_.showEditor(this.mostRecentEvent_),this.bringBlockToFront_()},Blockly.Gesture.prototype.doBlockClick_=function(){var a;this.flyout_&&this.flyout_.autoClose?this.targetBlock_.isEnabled()&&(Blockly.Events.getGroup()||Blockly.Events.setGroup(!0),this.flyout_.createBlock(this.targetBlock_).scheduleSnapAndBump()):(a=new(Blockly.Events.get(Blockly.Events.CLICK))(this.startBlock_,this.startWorkspace_.id,"block"),Blockly.Events.fire(a)),this.bringBlockToFront_(),Blockly.Events.setGroup(!1)},Blockly.Gesture.prototype.doWorkspaceClick_=function(a){a=this.creatorWorkspace_,Blockly.selected&&Blockly.selected.unselect(),this.fireWorkspaceClick_(this.startWorkspace_||a)},Blockly.Gesture.prototype.bringBlockToFront_=function(){this.targetBlock_&&!this.flyout_&&this.targetBlock_.bringToFront()},Blockly.Gesture.prototype.setStartField=function(a){if(this.hasStarted_)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");this.startField_||(this.startField_=a)},Blockly.Gesture.prototype.setStartBubble=function(a){this.startBubble_||(this.startBubble_=a)},Blockly.Gesture.prototype.setStartBlock=function(a){this.startBlock_||this.startBubble_||((this.startBlock_=a).isInFlyout&&a!=a.getRootBlock()?this.setTargetBlock_(a.getRootBlock()):this.setTargetBlock_(a))},Blockly.Gesture.prototype.setTargetBlock_=function(a){a.isShadow()?this.setTargetBlock_(a.getParent()):this.targetBlock_=a},Blockly.Gesture.prototype.setStartWorkspace_=function(a){this.startWorkspace_||(this.startWorkspace_=a)},Blockly.Gesture.prototype.setStartFlyout_=function(a){this.flyout_||(this.flyout_=a)},Blockly.Gesture.prototype.isBubbleClick_=function(){return!!this.startBubble_&&!this.hasExceededDragRadius_},Blockly.Gesture.prototype.isBlockClick_=function(){return!!this.startBlock_&&!this.hasExceededDragRadius_&&!this.isFieldClick_()},Blockly.Gesture.prototype.isFieldClick_=function(){return!!this.startField_&&this.startField_.isClickable()&&!this.hasExceededDragRadius_&&(!this.flyout_||!this.flyout_.autoClose)},Blockly.Gesture.prototype.isWorkspaceClick_=function(){return!(this.startBlock_||this.startBubble_||this.startField_||this.hasExceededDragRadius_)},Blockly.Gesture.prototype.isDragging=function(){return this.isDraggingWorkspace_||this.isDraggingBlock_||this.isDraggingBubble_},Blockly.Gesture.prototype.hasStarted=function(){return this.hasStarted_},Blockly.Gesture.prototype.getInsertionMarkers=function(){return this.blockDragger_?this.blockDragger_.getInsertionMarkers():[]},Blockly.Gesture.inProgress=function(){for(var c,a=Blockly.Workspace.getAll(),b=0;c=a[b];b++)if(c.currentGesture_)return!0;return!1},Blockly.Field=function(a,b,c){this.value_=this.DEFAULT_VALUE,this.tooltip_=this.validator_=null,this.size_=new Blockly.utils.Size(0,0),this.constants_=this.mouseDownWrapper_=this.textContent_=this.textElement_=this.borderRect_=this.fieldGroup_=this.markerSvg_=this.cursorSvg_=null,c&&this.configure_(c),this.setValue(a),b&&this.setValidator(b)},Blockly.Field.prototype.DEFAULT_VALUE=null,Blockly.Field.prototype.name=void 0,Blockly.Field.prototype.disposed=!1,Blockly.Field.prototype.maxDisplayLength=50,Blockly.Field.prototype.sourceBlock_=null,Blockly.Field.prototype.isDirty_=!0,Blockly.Field.prototype.visible_=!0,Blockly.Field.prototype.clickTarget_=null,Blockly.Field.NBSP=" ",Blockly.Field.prototype.EDITABLE=!0,Blockly.Field.prototype.SERIALIZABLE=!1,Blockly.Field.prototype.configure_=function(a){var b=a.tooltip;(b="string"==typeof b?Blockly.utils.replaceMessageReferences(a.tooltip):b)&&this.setTooltip(b)},Blockly.Field.prototype.setSourceBlock=function(a){if(this.sourceBlock_)throw Error("Field already bound to a block.");this.sourceBlock_=a},Blockly.Field.prototype.getConstants=function(){return!this.constants_&&this.sourceBlock_&&this.sourceBlock_.workspace&&this.sourceBlock_.workspace.rendered&&(this.constants_=this.sourceBlock_.workspace.getRenderer().getConstants()),this.constants_},Blockly.Field.prototype.getSourceBlock=function(){return this.sourceBlock_},Blockly.Field.prototype.init=function(){this.fieldGroup_||(this.fieldGroup_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.G,{},null),this.isVisible()||(this.fieldGroup_.style.display="none"),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_),this.initView(),this.updateEditable(),this.setTooltip(this.tooltip_),this.bindEvents_(),this.initModel())},Blockly.Field.prototype.initView=function(){this.createBorderRect_(),this.createTextElement_()},Blockly.Field.prototype.initModel=function(){},Blockly.Field.prototype.createBorderRect_=function(){this.borderRect_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.RECT,{rx:this.getConstants().FIELD_BORDER_RECT_RADIUS,ry:this.getConstants().FIELD_BORDER_RECT_RADIUS,x:0,y:0,height:this.size_.height,width:this.size_.width,class:"blocklyFieldRect"},this.fieldGroup_)},Blockly.Field.prototype.createTextElement_=function(){this.textElement_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.TEXT,{class:"blocklyText"},this.fieldGroup_),this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.textElement_.setAttribute("dominant-baseline","central"),this.textContent_=document.createTextNode(""),this.textElement_.appendChild(this.textContent_)},Blockly.Field.prototype.bindEvents_=function(){Blockly.Tooltip.bindMouseEvents(this.getClickTarget_()),this.mouseDownWrapper_=Blockly.browserEvents.conditionalBind(this.getClickTarget_(),"mousedown",this,this.onMouseDown_)},Blockly.Field.prototype.fromXml=function(a){this.setValue(a.textContent)},Blockly.Field.prototype.toXml=function(a){return a.textContent=this.getValue(),a},Blockly.Field.prototype.dispose=function(){Blockly.DropDownDiv.hideIfOwner(this),Blockly.WidgetDiv.hideIfOwner(this),Blockly.Tooltip.unbindMouseEvents(this.getClickTarget_()),this.mouseDownWrapper_&&Blockly.browserEvents.unbind(this.mouseDownWrapper_),Blockly.utils.dom.removeNode(this.fieldGroup_),this.disposed=!0},Blockly.Field.prototype.updateEditable=function(){var a=this.fieldGroup_;this.EDITABLE&&a&&(this.sourceBlock_.isEditable()?(Blockly.utils.dom.addClass(a,"blocklyEditableText"),Blockly.utils.dom.removeClass(a,"blocklyNonEditableText"),a.style.cursor=this.CURSOR):(Blockly.utils.dom.addClass(a,"blocklyNonEditableText"),Blockly.utils.dom.removeClass(a,"blocklyEditableText"),a.style.cursor=""))},Blockly.Field.prototype.isClickable=function(){return!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&!!this.showEditor_&&"function"==typeof this.showEditor_},Blockly.Field.prototype.isCurrentlyEditable=function(){return this.EDITABLE&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()},Blockly.Field.prototype.isSerializable=function(){var a=!1;return this.name&&(this.SERIALIZABLE?a=!0:this.EDITABLE&&(console.warn("Detected an editable field that was not serializable. Please define SERIALIZABLE property as true on all editable custom fields. Proceeding with serialization."),a=!0)),a},Blockly.Field.prototype.isVisible=function(){return this.visible_},Blockly.Field.prototype.setVisible=function(a){var b;this.visible_!=a&&(this.visible_=a,(b=this.getSvgRoot())&&(b.style.display=a?"block":"none"))},Blockly.Field.prototype.setValidator=function(a){this.validator_=a},Blockly.Field.prototype.getValidator=function(){return this.validator_},Blockly.Field.prototype.getSvgRoot=function(){return this.fieldGroup_},Blockly.Field.prototype.applyColour=function(){},Blockly.Field.prototype.render_=function(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_()},Blockly.Field.prototype.showEditor=function(a){this.isClickable()&&this.showEditor_(a)},Blockly.Field.prototype.updateSize_=function(a){var b=this.getConstants(),c=2*(a=null!=a?a:this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0),d=b.FIELD_TEXT_HEIGHT,e=0;this.textElement_&&(c+=e=Blockly.utils.dom.getFastTextWidth(this.textElement_,b.FIELD_TEXT_FONTSIZE,b.FIELD_TEXT_FONTWEIGHT,b.FIELD_TEXT_FONTFAMILY)),this.borderRect_&&(d=Math.max(d,b.FIELD_BORDER_RECT_HEIGHT)),this.size_.height=d,this.size_.width=c,this.positionTextElement_(a,e),this.positionBorderRect_()},Blockly.Field.prototype.positionTextElement_=function(a,b){var c,d;this.textElement_&&(c=this.getConstants(),d=this.size_.height/2,this.textElement_.setAttribute("x",this.sourceBlock_.RTL?this.size_.width-b-a:a),this.textElement_.setAttribute("y",c.FIELD_TEXT_BASELINE_CENTER?d:d-c.FIELD_TEXT_HEIGHT/2+c.FIELD_TEXT_BASELINE))},Blockly.Field.prototype.positionBorderRect_=function(){this.borderRect_&&(this.borderRect_.setAttribute("width",this.size_.width),this.borderRect_.setAttribute("height",this.size_.height),this.borderRect_.setAttribute("rx",this.getConstants().FIELD_BORDER_RECT_RADIUS),this.borderRect_.setAttribute("ry",this.getConstants().FIELD_BORDER_RECT_RADIUS))},Blockly.Field.prototype.getSize=function(){return this.isVisible()?(this.isDirty_?(this.render_(),this.isDirty_=!1):this.visible_&&0==this.size_.width&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.render_()),this.size_):new Blockly.utils.Size(0,0)},Blockly.Field.prototype.getScaledBBox=function(){var b,c,d,a;return this.borderRect_?(a=this.borderRect_.getBoundingClientRect(),c=Blockly.utils.style.getPageOffset(this.borderRect_),d=a.width,a=a.height):(a=this.sourceBlock_.getHeightWidth(),b=this.sourceBlock_.workspace.scale,c=this.getAbsoluteXY_(),d=a.width*b,a=a.height*b,Blockly.utils.userAgent.GECKO?(c.x+=1.5*b,c.y+=1.5*b):Blockly.utils.userAgent.EDGE||Blockly.utils.userAgent.IE||(c.x-=.5*b,c.y-=.5*b),d+=+b,a+=+b),new Blockly.utils.Rect(c.y,c.y+a,c.x,c.x+d)},Blockly.Field.prototype.getDisplayText_=function(){var a=this.getText();return a?(a=(a=a.length>this.maxDisplayLength?a.substring(0,this.maxDisplayLength-2)+"…":a).replace(/\s/g,Blockly.Field.NBSP),this.sourceBlock_&&this.sourceBlock_.RTL&&(a+="‏"),a):Blockly.Field.NBSP},Blockly.Field.prototype.getText=function(){if(this.getText_){var a=this.getText_.call(this);if(null!==a)return String(a)}return String(this.getValue())},Blockly.Field.prototype.markDirty=function(){this.isDirty_=!0,this.constants_=null},Blockly.Field.prototype.forceRerender=function(){this.isDirty_=!0,this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours(),this.updateMarkers_())},Blockly.Field.prototype.setValue=function(a){var c,b;null!==a&&(b=this.doClassValidation_(a),(a=this.processValidation_(a,b))instanceof Error||(b=this.getValidator())&&(b=b.call(this,a),(a=this.processValidation_(a,b))instanceof Error)||(b=this.sourceBlock_)&&b.disposed||((c=this.getValue())===a?this.doValueUpdate_(a):(b&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new(Blockly.Events.get(Blockly.Events.BLOCK_CHANGE))(b,"field",this.name||null,c,a)),this.doValueUpdate_(a),this.isDirty_&&this.forceRerender())))},Blockly.Field.prototype.processValidation_=function(a,b){return null===b?(this.doValueInvalid_(a),this.isDirty_&&this.forceRerender(),Error()):void 0!==b?b:a},Blockly.Field.prototype.getValue=function(){return this.value_},Blockly.Field.prototype.doClassValidation_=function(a){return null==a?null:a},Blockly.Field.prototype.doValueUpdate_=function(a){this.value_=a,this.isDirty_=!0},Blockly.Field.prototype.doValueInvalid_=function(a){},Blockly.Field.prototype.onMouseDown_=function(a){this.sourceBlock_&&this.sourceBlock_.workspace&&(a=this.sourceBlock_.workspace.getGesture(a))&&a.setStartField(this)},Blockly.Field.prototype.setTooltip=function(a){a||""===a||(a=this.sourceBlock_);var b=this.getClickTarget_();b?b.tooltip=a:this.tooltip_=a},Blockly.Field.prototype.getTooltip=function(){var a=this.getClickTarget_();return a?Blockly.Tooltip.getTooltipOfObject(a):Blockly.Tooltip.getTooltipOfObject({tooltip:this.tooltip_})},Blockly.Field.prototype.getClickTarget_=function(){return this.clickTarget_||this.getSvgRoot()},Blockly.Field.prototype.getAbsoluteXY_=function(){return Blockly.utils.style.getPageOffset(this.getClickTarget_())},Blockly.Field.prototype.referencesVariables=function(){return!1},Blockly.Field.prototype.getParentInput=function(){for(var a=null,b=this.sourceBlock_,c=b.inputList,d=0;dthis.fieldRow.length)throw Error("index "+a+" out of bounds.");return(b||""==b&&c)&&((b="string"==typeof b?Blockly.fieldRegistry.fromJson({type:"field_label",text:b}):b).setSourceBlock(this.sourceBlock_),this.sourceBlock_.rendered&&(b.init(),b.applyColour()),b.name=c,b.setVisible(this.isVisible()),b.prefixField&&(a=this.insertFieldAt(a,b.prefixField)),this.fieldRow.splice(a,0,b),++a,b.suffixField&&(a=this.insertFieldAt(a,b.suffixField)),this.sourceBlock_.rendered&&(this.sourceBlock_=this.sourceBlock_,this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours())),a},Blockly.Input.prototype.removeField=function(a,b){for(var d,c=0;d=this.fieldRow[c];c++)if(d.name===a)return d.dispose(),this.fieldRow.splice(c,1),this.sourceBlock_.rendered&&(this.sourceBlock_=this.sourceBlock_,this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours()),!0;if(b)return!1;throw Error('Field "'+a+'" not found.')},Blockly.Input.prototype.isVisible=function(){return this.visible_},Blockly.Input.prototype.setVisible=function(a){var b=[];if(this.visible_==a)return b;this.visible_=a;for(var d,c=0;d=this.fieldRow[c];c++)d.setVisible(a);return this.connection&&(this.connection=this.connection,a?b=this.connection.startTrackingAll():this.connection.stopTrackingAll(),c=this.connection.targetBlock())&&(c.getSvgRoot().style.display=a?"block":"none"),b},Blockly.Input.prototype.markDirty=function(){for(var b,a=0;b=this.fieldRow[a];a++)b.markDirty()},Blockly.Input.prototype.setCheck=function(a){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.setCheck(a),this},Blockly.Input.prototype.setAlign=function(a){return this.align=a,this.sourceBlock_.rendered&&(this.sourceBlock_=this.sourceBlock_,this.sourceBlock_.render()),this},Blockly.Input.prototype.setShadowDom=function(a){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.setShadowDom(a),this},Blockly.Input.prototype.getShadowDom=function(){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.getShadowDom()},Blockly.Input.prototype.init=function(){if(this.sourceBlock_.workspace.rendered)for(var a=0;aa?e.substring(0,a-3)+"...":e},Blockly.Block.prototype.appendValueInput=function(a){return this.appendInput_(Blockly.inputTypes.VALUE,a)},Blockly.Block.prototype.appendStatementInput=function(a){return this.appendInput_(Blockly.inputTypes.STATEMENT,a)},Blockly.Block.prototype.appendDummyInput=function(a){return this.appendInput_(Blockly.inputTypes.DUMMY,a||"")},Blockly.Block.prototype.jsonInit=function(a){var b=a.type?'Block "'+a.type+'": ':"";if(a.output&&a.previousStatement)throw Error(b+"Must not have both an output and a previousStatement.");if(a.style&&a.style.hat&&(this.hat=a.style.hat,a.style=null),a.style&&a.colour)throw Error(b+"Must not have both a colour and a style.");a.style?this.jsonInitStyle_(a,b):this.jsonInitColour_(a,b);for(var c=0;void 0!==a["message"+c];)this.interpolate_(a["message"+c],a["args"+c]||[],a["lastDummyAlign"+c],b),c++;if(void 0!==a.inputsInline&&this.setInputsInline(a.inputsInline),void 0!==a.output&&this.setOutput(!0,a.output),void 0!==a.outputShape&&this.setOutputShape(a.outputShape),void 0!==a.previousStatement&&this.setPreviousStatement(!0,a.previousStatement),void 0!==a.nextStatement&&this.setNextStatement(!0,a.nextStatement),void 0!==a.tooltip&&(c=a.tooltip,c=Blockly.utils.replaceMessageReferences(c),this.setTooltip(c)),void 0!==a.enableContextMenu&&(c=a.enableContextMenu,this.contextMenu=!!c),void 0!==a.helpUrl&&(c=a.helpUrl,c=Blockly.utils.replaceMessageReferences(c),this.setHelpUrl(c)),"string"==typeof a.extensions&&(console.warn(b+"JSON attribute 'extensions' should be an array of strings. Found raw string in JSON for '"+a.type+"' block."),a.extensions=[a.extensions]),void 0!==a.mutator&&Blockly.Extensions.apply(a.mutator,this,!0),Array.isArray(a.extensions))for(a=a.extensions,b=0;b=this.inputList.length)throw RangeError("Input index "+a+" out of bounds.");if(b>this.inputList.length)throw RangeError("Reference input "+b+" out of bounds.");var c=this.inputList[a];this.inputList.splice(a,1),a=a.bottom?b.top-c.height:b.bottom},Blockly.ContextMenu={},Blockly.ContextMenu.currentBlock=null,Blockly.ContextMenu.menu_=null,Blockly.ContextMenu.show=function(a,b,c){var d;Blockly.WidgetDiv.show(Blockly.ContextMenu,c,Blockly.ContextMenu.dispose),b.length?(d=Blockly.ContextMenu.populate_(b,c),Blockly.ContextMenu.menu_=d,Blockly.ContextMenu.position_(d,a,c),setTimeout(function(){d.focus()},1),Blockly.ContextMenu.currentBlock=null):Blockly.ContextMenu.hide()},Blockly.ContextMenu.populate_=function(a,b){var c=new Blockly.Menu;c.setRole(Blockly.utils.aria.Role.MENU);for(var e,d=0;e=a[d];d++){var f=new Blockly.MenuItem(e.text);f.setRightToLeft(b),f.setRole(Blockly.utils.aria.Role.MENUITEM),c.addChild(f),f.setEnabled(e.enabled),e.enabled&&f.onAction(function(g){Blockly.ContextMenu.hide(),this.callback(this.scope)},e)}return c},Blockly.ContextMenu.position_=function(a,b,c){var d=Blockly.utils.getViewportBBox();b=new Blockly.utils.Rect(b.clientY+d.top,b.clientY+d.top,b.clientX+d.left,b.clientX+d.left),Blockly.ContextMenu.createWidget_(a);var e=a.getSize();c&&(b.left+=e.width,b.right+=e.width,d.left+=e.width,d.right+=e.width),Blockly.WidgetDiv.positionWithAnchor(d,b,e,c),a.focus()},Blockly.ContextMenu.createWidget_=function(a){a.render(Blockly.WidgetDiv.DIV);var b=a.getElement();Blockly.utils.dom.addClass(b,"blocklyContextMenu"),Blockly.browserEvents.conditionalBind(b,"contextmenu",null,Blockly.utils.noEvent),a.focus()},Blockly.ContextMenu.hide=function(){Blockly.WidgetDiv.hideIfOwner(Blockly.ContextMenu),Blockly.ContextMenu.currentBlock=null},Blockly.ContextMenu.dispose=function(){Blockly.ContextMenu.menu_&&(Blockly.ContextMenu.menu_.dispose(),Blockly.ContextMenu.menu_=null)},Blockly.ContextMenu.callbackFactory=function(a,b){return function(){Blockly.Events.disable();try{var c=Blockly.Xml.domToBlock(b,a.workspace),d=a.getRelativeToSurfaceXY();d.x=a.RTL?d.x-Blockly.SNAP_RADIUS:d.x+Blockly.SNAP_RADIUS,d.y+=2*Blockly.SNAP_RADIUS,c.moveBy(d.x,d.y)}finally{Blockly.Events.enable()}Blockly.Events.isEnabled()&&!c.isShadow()&&Blockly.Events.fire(new(Blockly.Events.get(Blockly.Events.BLOCK_CREATE))(c)),c.select()}},Blockly.ContextMenu.commentDeleteOption=function(a){return{text:Blockly.Msg.REMOVE_COMMENT,enabled:!0,callback:function(){Blockly.Events.setGroup(!0),a.dispose(!0,!0),Blockly.Events.setGroup(!1)}}},Blockly.ContextMenu.commentDuplicateOption=function(a){return{text:Blockly.Msg.DUPLICATE_COMMENT,enabled:!0,callback:function(){Blockly.duplicate(a)}}},Blockly.ContextMenu.workspaceCommentOption=function(a,b){if(!Blockly.WorkspaceCommentSvg)throw Error("Missing require for Blockly.WorkspaceCommentSvg");var c={enabled:!Blockly.utils.userAgent.IE};return c.text=Blockly.Msg.ADD_COMMENT,c.callback=function(){var d=new Blockly.WorkspaceCommentSvg(a,Blockly.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT,Blockly.WorkspaceCommentSvg.DEFAULT_SIZE,Blockly.WorkspaceCommentSvg.DEFAULT_SIZE),e=a.getInjectionDiv().getBoundingClientRect(),e=new Blockly.utils.Coordinate(b.clientX-e.left,b.clientY-e.top),f=a.getOriginOffsetInPixels();(e=Blockly.utils.Coordinate.difference(e,f)).scale(1/a.scale),d.moveBy(e.x,e.y),a.rendered&&(d.initSvg(),d.render(),d.select())},c},Blockly.ContextMenuRegistry=function(){(Blockly.ContextMenuRegistry.registry=this).registry_={}},Blockly.ContextMenuRegistry.ScopeType={BLOCK:"block",WORKSPACE:"workspace"},Blockly.ContextMenuRegistry.registry=null,Blockly.ContextMenuRegistry.prototype.register=function(a){if(this.registry_[a.id])throw Error('Menu item with id "'+a.id+'" is already registered.');this.registry_[a.id]=a},Blockly.ContextMenuRegistry.prototype.unregister=function(a){if(!this.registry_[a])throw Error('Menu item with id "'+a+'" not found.');delete this.registry_[a]},Blockly.ContextMenuRegistry.prototype.getItem=function(a){return this.registry_[a]||null},Blockly.ContextMenuRegistry.prototype.getContextMenuOptions=function(a,b){var c=[],d=this.registry_;return Object.keys(d).forEach(function(e){var f;e=d[e],a!=e.scopeType||"hidden"!=(f=e.preconditionFn(b))&&(e={text:"function"==typeof e.displayText?e.displayText(b):e.displayText,enabled:"enabled"==f,callback:e.callback,scope:b,weight:e.weight},c.push(e))}),c.sort(function(e,f){return e.weight-f.weight}),c},new Blockly.ContextMenuRegistry,Blockly.Events.Selected=function(a,b,c){Blockly.Events.Selected.superClass_.constructor.call(this,c),this.oldElementId=a,this.newElementId=b},Blockly.utils.object.inherits(Blockly.Events.Selected,Blockly.Events.UiBase),Blockly.Events.Selected.prototype.type=Blockly.Events.SELECTED,Blockly.Events.Selected.prototype.toJson=function(){var a=Blockly.Events.Selected.superClass_.toJson.call(this);return a.oldElementId=this.oldElementId,a.newElementId=this.newElementId,a},Blockly.Events.Selected.prototype.fromJson=function(a){Blockly.Events.Selected.superClass_.fromJson.call(this,a),this.oldElementId=a.oldElementId,this.newElementId=a.newElementId},Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.SELECTED,Blockly.Events.Selected),Blockly.RenderedConnection=function(a,b){Blockly.RenderedConnection.superClass_.constructor.call(this,a,b),this.db_=a.workspace.connectionDBList[b],this.dbOpposite_=a.workspace.connectionDBList[Blockly.OPPOSITE_TYPE[b]],this.offsetInBlock_=new Blockly.utils.Coordinate(0,0),this.trackedState_=Blockly.RenderedConnection.TrackedState.WILL_TRACK,this.targetConnection=null},Blockly.utils.object.inherits(Blockly.RenderedConnection,Blockly.Connection),Blockly.RenderedConnection.TrackedState={WILL_TRACK:-1,UNTRACKED:0,TRACKED:1},Blockly.RenderedConnection.prototype.dispose=function(){Blockly.RenderedConnection.superClass_.dispose.call(this),this.trackedState_==Blockly.RenderedConnection.TrackedState.TRACKED&&this.db_.removeConnection(this,this.y)},Blockly.RenderedConnection.prototype.getSourceBlock=function(){return Blockly.RenderedConnection.superClass_.getSourceBlock.call(this)},Blockly.RenderedConnection.prototype.targetBlock=function(){return Blockly.RenderedConnection.superClass_.targetBlock.call(this)},Blockly.RenderedConnection.prototype.distanceFrom=function(a){var b=this.x-a.x;return a=this.y-a.y,Math.sqrt(b*b+a*a)},Blockly.RenderedConnection.prototype.bumpAwayFrom=function(a){if(!this.sourceBlock_.workspace.isDragging()){var b=this.sourceBlock_.getRootBlock();if(!b.isInFlyout){var c=!1;if(!b.isMovable()){if(!(b=a.getSourceBlock().getRootBlock()).isMovable())return;a=this,c=!0}var d=Blockly.selected==b;d||b.addSelect();var e=a.x+Blockly.SNAP_RADIUS+Math.floor(Math.random()*Blockly.BUMP_RANDOMNESS)-this.x,f=a.y+Blockly.SNAP_RADIUS+Math.floor(Math.random()*Blockly.BUMP_RANDOMNESS)-this.y;c&&(f=-f),b.RTL&&(e=a.x-Blockly.SNAP_RADIUS-Math.floor(Math.random()*Blockly.BUMP_RANDOMNESS)-this.x),b.moveBy(e,f),d||b.removeSelect()}}},Blockly.RenderedConnection.prototype.moveTo=function(a,b){this.trackedState_==Blockly.RenderedConnection.TrackedState.WILL_TRACK?(this.db_.addConnection(this,b),this.trackedState_=Blockly.RenderedConnection.TrackedState.TRACKED):this.trackedState_==Blockly.RenderedConnection.TrackedState.TRACKED&&(this.db_.removeConnection(this,this.y),this.db_.addConnection(this,b)),this.x=a,this.y=b},Blockly.RenderedConnection.prototype.moveBy=function(a,b){this.moveTo(this.x+a,this.y+b)},Blockly.RenderedConnection.prototype.moveToOffset=function(a){this.moveTo(a.x+this.offsetInBlock_.x,a.y+this.offsetInBlock_.y)},Blockly.RenderedConnection.prototype.setOffsetInBlock=function(a,b){this.offsetInBlock_.x=a,this.offsetInBlock_.y=b},Blockly.RenderedConnection.prototype.getOffsetInBlock=function(){return this.offsetInBlock_},Blockly.RenderedConnection.prototype.tighten=function(){var a=this.targetConnection.x-this.x,b=this.targetConnection.y-this.y;if(0!=a||0!=b){var c=this.targetBlock(),d=c.getSvgRoot();if(!d)throw Error("block is not rendered.");d=Blockly.utils.getRelativeXY(d),c.getSvgRoot().setAttribute("transform","translate("+(d.x-a)+","+(d.y-b)+")"),c.moveConnections(-a,-b)}},Blockly.RenderedConnection.prototype.closest=function(a,b){return this.dbOpposite_.searchForClosest(this,a,b)},Blockly.RenderedConnection.prototype.highlight=function(){var b=(a=this.sourceBlock_.workspace.getRenderer().getConstants()).shapeFor(this),b=this.type==Blockly.connectionTypes.INPUT_VALUE||this.type==Blockly.connectionTypes.OUTPUT_VALUE?(a=a.TAB_OFFSET_FROM_TOP,Blockly.utils.svgPaths.moveBy(0,-a)+Blockly.utils.svgPaths.lineOnAxis("v",a)+b.pathDown+Blockly.utils.svgPaths.lineOnAxis("v",a)):(a=a.NOTCH_OFFSET_LEFT-a.CORNER_RADIUS,Blockly.utils.svgPaths.moveBy(-a,0)+Blockly.utils.svgPaths.lineOnAxis("h",a)+b.pathLeft+Blockly.utils.svgPaths.lineOnAxis("h",a)),a=this.sourceBlock_.getRelativeToSurfaceXY();Blockly.Connection.highlightedPath_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.PATH,{class:"blocklyHighlightedConnectionPath",d:b,transform:"translate("+(this.x-a.x)+","+(this.y-a.y)+")"+(this.sourceBlock_.RTL?" scale(-1 1)":"")},this.sourceBlock_.getSvgRoot())},Blockly.RenderedConnection.prototype.unhighlight=function(){Blockly.utils.dom.removeNode(Blockly.Connection.highlightedPath_),delete Blockly.Connection.highlightedPath_},Blockly.RenderedConnection.prototype.setTracking=function(a){a&&this.trackedState_==Blockly.RenderedConnection.TrackedState.TRACKED||!a&&this.trackedState_==Blockly.RenderedConnection.TrackedState.UNTRACKED||this.sourceBlock_.isInFlyout||(a?(this.db_.addConnection(this,this.y),this.trackedState_=Blockly.RenderedConnection.TrackedState.TRACKED):(this.trackedState_==Blockly.RenderedConnection.TrackedState.TRACKED&&this.db_.removeConnection(this,this.y),this.trackedState_=Blockly.RenderedConnection.TrackedState.UNTRACKED))},Blockly.RenderedConnection.prototype.stopTrackingAll=function(){if(this.setTracking(!1),this.targetConnection)for(var a=this.targetBlock().getDescendants(!1),b=0;bb)&&Blockly.RenderedConnection.superClass_.isConnectionAllowed.call(this,a)},Blockly.RenderedConnection.prototype.onFailedConnect=function(a){this.bumpAwayFrom(a)},Blockly.RenderedConnection.prototype.disconnectInternal_=function(a,b){Blockly.RenderedConnection.superClass_.disconnectInternal_.call(this,a,b),a.rendered&&a.render(),b.rendered&&(b.updateDisabled(),b.render(),b.getSvgRoot().style.display="block")},Blockly.RenderedConnection.prototype.respawnShadow_=function(){Blockly.RenderedConnection.superClass_.respawnShadow_.call(this);var a=this.targetBlock();a&&(a.initSvg(),a.render(!1),(a=this.getSourceBlock()).rendered&&a.render())},Blockly.RenderedConnection.prototype.neighbours=function(a){return this.dbOpposite_.getNeighbours(this,a)},Blockly.RenderedConnection.prototype.connect_=function(a){Blockly.RenderedConnection.superClass_.connect_.call(this,a);var b=this.getSourceBlock();a=a.getSourceBlock();var c=b.rendered,d=a.rendered;c&&b.updateDisabled(),d&&a.updateDisabled(),c&&d&&(this.type==Blockly.connectionTypes.NEXT_STATEMENT||this.type==Blockly.connectionTypes.PREVIOUS_STATEMENT?a:b).render(),(b=b.getInputWithBlock(a))&&(b=b.isVisible(),a.getSvgRoot().style.display=b?"block":"none")},Blockly.RenderedConnection.prototype.onCheckChanged_=function(){!this.isConnected()||this.targetConnection&&this.getConnectionChecker().canConnect(this,this.targetConnection,!1)||((this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug(),this.sourceBlock_.bumpNeighbours())},Blockly.Marker=function(){this.drawer_=this.curNode_=this.colour=null,this.type="marker"},Blockly.Marker.prototype.setDrawer=function(a){this.drawer_=a},Blockly.Marker.prototype.getDrawer=function(){return this.drawer_},Blockly.Marker.prototype.getCurNode=function(){return this.curNode_},Blockly.Marker.prototype.setCurNode=function(a){var b=this.curNode_;this.curNode_=a,this.drawer_&&this.drawer_.draw(b,this.curNode_)},Blockly.Marker.prototype.draw=function(){this.drawer_&&this.drawer_.draw(this.curNode_,this.curNode_)},Blockly.Marker.prototype.hide=function(){this.drawer_&&this.drawer_.hide()},Blockly.Marker.prototype.dispose=function(){this.getDrawer()&&this.getDrawer().dispose()},Blockly.Cursor=function(){Blockly.Cursor.superClass_.constructor.call(this),this.type="cursor"},Blockly.utils.object.inherits(Blockly.Cursor,Blockly.Marker),Blockly.Cursor.prototype.next=function(){var a=this.getCurNode();if(!a)return null;for(a=a.next();a&&a.next()&&(a.getType()==Blockly.ASTNode.types.NEXT||a.getType()==Blockly.ASTNode.types.BLOCK);)a=a.next();return a&&this.setCurNode(a),a},Blockly.Cursor.prototype.in=function(){var a=this.getCurNode();return a?((a=(a=a.getType()==Blockly.ASTNode.types.PREVIOUS||a.getType()==Blockly.ASTNode.types.OUTPUT?a.next():a).in())&&this.setCurNode(a),a):null},Blockly.Cursor.prototype.prev=function(){var a=this.getCurNode();if(!a)return null;for(a=a.prev();a&&a.prev()&&(a.getType()==Blockly.ASTNode.types.NEXT||a.getType()==Blockly.ASTNode.types.BLOCK);)a=a.prev();return a&&this.setCurNode(a),a},Blockly.Cursor.prototype.out=function(){var a=this.getCurNode();return a?((a=(a=a.out())&&a.getType()==Blockly.ASTNode.types.BLOCK?a.prev()||a:a)&&this.setCurNode(a),a):null},Blockly.registry.register(Blockly.registry.Type.CURSOR,Blockly.registry.DEFAULT,Blockly.Cursor),Blockly.BasicCursor=function(){Blockly.BasicCursor.superClass_.constructor.call(this)},Blockly.utils.object.inherits(Blockly.BasicCursor,Blockly.Cursor),Blockly.BasicCursor.registrationName="basicCursor",Blockly.BasicCursor.prototype.next=function(){var a=this.getCurNode();return a?((a=this.getNextNode_(a,this.validNode_))&&this.setCurNode(a),a):null},Blockly.BasicCursor.prototype.in=function(){return this.next()},Blockly.BasicCursor.prototype.prev=function(){var a=this.getCurNode();return a?((a=this.getPreviousNode_(a,this.validNode_))&&this.setCurNode(a),a):null},Blockly.BasicCursor.prototype.out=function(){return this.prev()},Blockly.BasicCursor.prototype.getNextNode_=function(a,b){if(!a)return null;var c=a.in()||a.next();return b(c)?c:c?this.getNextNode_(c,b):b(a=this.findSiblingOrParent_(a.out()))?a:a?this.getNextNode_(a,b):null},Blockly.BasicCursor.prototype.getPreviousNode_=function(a,b){if(!a)return null;var c=a.prev();return b(c=c?this.getRightMostChild_(c):a.out())?c:c?this.getPreviousNode_(c,b):null},Blockly.BasicCursor.prototype.validNode_=function(a){var b=!1;return b=(a=a&&a.getType())==Blockly.ASTNode.types.OUTPUT||a==Blockly.ASTNode.types.INPUT||a==Blockly.ASTNode.types.FIELD||a==Blockly.ASTNode.types.NEXT||a==Blockly.ASTNode.types.PREVIOUS||a==Blockly.ASTNode.types.WORKSPACE?!0:b},Blockly.BasicCursor.prototype.findSiblingOrParent_=function(a){if(!a)return null;var b=a.next();return b||this.findSiblingOrParent_(a.out())},Blockly.BasicCursor.prototype.getRightMostChild_=function(a){if(!a.in())return a;for(a=a.in();a.next();)a=a.next();return this.getRightMostChild_(a)},Blockly.registry.register(Blockly.registry.Type.CURSOR,Blockly.BasicCursor.registrationName,Blockly.BasicCursor),Blockly.TabNavigateCursor=function(){Blockly.TabNavigateCursor.superClass_.constructor.call(this)},Blockly.utils.object.inherits(Blockly.TabNavigateCursor,Blockly.BasicCursor),Blockly.TabNavigateCursor.prototype.validNode_=function(a){var b=!1,c=a&&a.getType();return a&&(a=a.getLocation(),c==Blockly.ASTNode.types.FIELD&&a&&a.isTabNavigable()&&a.isClickable()&&(b=!0)),b},Blockly.BlockSvg=function(a,b,c){this.svgGroup_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.G,{},null),this.svgGroup_.translate_="",this.style=a.getRenderer().getConstants().getBlockStyle(null),this.pathObject=a.getRenderer().makePathObject(this.svgGroup_,this.style),this.renderIsInProgress_=this.rendered=!1,this.workspace=a,this.previousConnection=this.nextConnection=this.outputConnection=null,this.useDragSurface_=Blockly.utils.is3dSupported()&&!!a.getBlockDragSurface();var d=this.pathObject.svgPath;d.tooltip=this,Blockly.Tooltip.bindMouseEvents(d),Blockly.BlockSvg.superClass_.constructor.call(this,a,b,c),this.svgGroup_.dataset?this.svgGroup_.dataset.id=this.id:Blockly.utils.userAgent.IE&&this.svgGroup_.setAttribute("data-id",this.id)},Blockly.utils.object.inherits(Blockly.BlockSvg,Blockly.Block),Blockly.BlockSvg.prototype.height=0,Blockly.BlockSvg.prototype.width=0,Blockly.BlockSvg.prototype.warningTextDb_=null,Blockly.BlockSvg.INLINE=-1,Blockly.BlockSvg.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_",Blockly.BlockSvg.prototype.initSvg=function(){if(!this.workspace.rendered)throw TypeError("Workspace is headless.");for(var b,a=0;b=this.inputList[a];a++)b.init();for(b=this.getIcons(),a=0;a=this.connections_.length)return-1;b=a.y;for(var d=c;0<=d&&this.connections_[d].y==b;){if(this.connections_[d]==a)return d;d--}for(;ca)){b=d;break}c=d}}return b},Blockly.ConnectionDB.prototype.removeConnection=function(a,b){if(-1==(a=this.findIndexOfConnection_(a,b)))throw Error("Unable to find connection in connectionDB.");this.connections_.splice(a,1)},Blockly.ConnectionDB.prototype.getNeighbours=function(a,b){function c(l){var m=e-d[l].x,n=f-d[l].y;return Math.sqrt(m*m+n*n)<=b&&k.push(d[l]),nthis.previousScale_&&(c=0<(c=b-this.previousScale_)?c*Blockly.TouchGesture.ZOOM_IN_MULTIPLIER:c*Blockly.TouchGesture.ZOOM_OUT_MULTIPLIER,d=this.startWorkspace_,e=Blockly.utils.mouseToSvg(a,d.getParentSvg(),d.getInverseScreenCTM()),d.zoom(e.x,e.y,c)),this.previousScale_=b,a.preventDefault()},Blockly.TouchGesture.prototype.handleTouchEnd=function(a){a=Blockly.Touch.getTouchIdentifierFromEvent(a),this.cachedPoints_[a]&&delete this.cachedPoints_[a],Object.keys(this.cachedPoints_).length<2&&(this.cachedPoints_=Object.create(null),this.previousScale_=0)},Blockly.TouchGesture.prototype.getTouchPoint=function(a){return this.startWorkspace_?new Blockly.utils.Coordinate(a.pageX||a.changedTouches[0].pageX,a.pageY||a.changedTouches[0].pageY):null},Blockly.WorkspaceAudio=function(a){this.parentWorkspace_=a,this.SOUNDS_=Object.create(null)},Blockly.WorkspaceAudio.prototype.lastSound_=null,Blockly.WorkspaceAudio.prototype.dispose=function(){this.SOUNDS_=this.parentWorkspace_=null},Blockly.WorkspaceAudio.prototype.load=function(a,b){if(a.length){try{var c=new Blockly.utils.global.Audio}catch(h){return}for(var d,e=0;e=this.remainingCapacity()||(this.currentGesture_&&this.currentGesture_.cancel(),"comment"==a.tagName.toLowerCase()?this.pasteWorkspaceComment_(a):this.pasteBlock_(a))},Blockly.WorkspaceSvg.prototype.pasteBlock_=function(a){Blockly.Events.disable();try{var b=Blockly.Xml.domToBlock(a,this),c=parseInt(a.getAttribute("x"),10),d=parseInt(a.getAttribute("y"),10);if(!isNaN(c)&&!isNaN(d)){this.RTL&&(c=-c);do{a=!1;for(var g,e=this.getAllBlocks(!1),f=0;g=e[f];f++){var h=g.getRelativeToSurfaceXY();if(Math.abs(c-h.x)<=1&&Math.abs(d-h.y)<=1){a=!0;break}}if(!a)for(var l,k=b.getConnections_(!1),f=0;l=k[f];f++)if(l.closest(Blockly.SNAP_RADIUS,new Blockly.utils.Coordinate(c,d)).connection){a=!0;break}}while(a&&(c=this.RTL?c-Blockly.SNAP_RADIUS:c+Blockly.SNAP_RADIUS,d+=2*Blockly.SNAP_RADIUS),a);b.moveBy(c,d)}}finally{Blockly.Events.enable()}Blockly.Events.isEnabled()&&!b.isShadow()&&Blockly.Events.fire(new(Blockly.Events.get(Blockly.Events.BLOCK_CREATE))(b)),b.select()},Blockly.WorkspaceSvg.prototype.pasteWorkspaceComment_=function(a){Blockly.Events.disable();try{var b=Blockly.WorkspaceCommentSvg.fromXml(a,this),c=parseInt(a.getAttribute("x"),10),d=parseInt(a.getAttribute("y"),10);isNaN(c)||isNaN(d)||(this.RTL&&(c=-c),b.moveBy(c+50,d+50))}finally{Blockly.Events.enable()}Blockly.Events.isEnabled()&&Blockly.WorkspaceComment.fireCreateEvent(b),b.select()},Blockly.WorkspaceSvg.prototype.refreshToolboxSelection=function(){var a=this.isFlyout?this.targetWorkspace:this;a&&!a.currentGesture_&&a.toolbox_&&a.toolbox_.getFlyout()&&a.toolbox_.refreshSelection()},Blockly.WorkspaceSvg.prototype.renameVariableById=function(a,b){Blockly.WorkspaceSvg.superClass_.renameVariableById.call(this,a,b),this.refreshToolboxSelection()},Blockly.WorkspaceSvg.prototype.deleteVariableById=function(a){Blockly.WorkspaceSvg.superClass_.deleteVariableById.call(this,a),this.refreshToolboxSelection()},Blockly.WorkspaceSvg.prototype.createVariable=function(a,b,c){return a=Blockly.WorkspaceSvg.superClass_.createVariable.call(this,a,b,c),this.refreshToolboxSelection(),a},Blockly.WorkspaceSvg.prototype.recordDeleteAreas=function(){this.deleteAreaTrash_=this.trashcan&&this.svgGroup_.parentNode?this.trashcan.getClientRect():null,this.deleteAreaToolbox_=this.flyout_?this.flyout_.getClientRect():this.toolbox_&&"function"==typeof this.toolbox_.getClientRect?this.toolbox_.getClientRect():null},Blockly.WorkspaceSvg.prototype.isDeleteArea=function(a){return this.deleteAreaTrash_&&this.deleteAreaTrash_.contains(a.clientX,a.clientY)?Blockly.DELETE_AREA_TRASH:this.deleteAreaToolbox_&&this.deleteAreaToolbox_.contains(a.clientX,a.clientY)?Blockly.DELETE_AREA_TOOLBOX:Blockly.DELETE_AREA_NONE},Blockly.WorkspaceSvg.prototype.onMouseDown_=function(a){var b=this.getGesture(a);b&&b.handleWsStart(a,this)},Blockly.WorkspaceSvg.prototype.startDrag=function(a,b){(a=Blockly.utils.mouseToSvg(a,this.getParentSvg(),this.getInverseScreenCTM())).x/=this.scale,a.y/=this.scale,this.dragDeltaXY_=Blockly.utils.Coordinate.difference(b,a)},Blockly.WorkspaceSvg.prototype.moveDrag=function(a){return(a=Blockly.utils.mouseToSvg(a,this.getParentSvg(),this.getInverseScreenCTM())).x/=this.scale,a.y/=this.scale,Blockly.utils.Coordinate.sum(this.dragDeltaXY_,a)},Blockly.WorkspaceSvg.prototype.isDragging=function(){return null!=this.currentGesture_&&this.currentGesture_.isDragging()},Blockly.WorkspaceSvg.prototype.isDraggable=function(){return this.options.moveOptions&&this.options.moveOptions.drag},Blockly.WorkspaceSvg.prototype.isMovable=function(){return this.options.moveOptions&&!!this.options.moveOptions.scrollbars||this.options.moveOptions&&this.options.moveOptions.wheel||this.options.moveOptions&&this.options.moveOptions.drag||this.options.zoomOptions&&this.options.zoomOptions.wheel||this.options.zoomOptions&&this.options.zoomOptions.pinch},Blockly.WorkspaceSvg.prototype.isMovableHorizontally=function(){var a=!!this.scrollbar;return this.isMovable()&&(!a||a&&this.scrollbar.canScrollHorizontally())},Blockly.WorkspaceSvg.prototype.isMovableVertically=function(){var a=!!this.scrollbar;return this.isMovable()&&(!a||a&&this.scrollbar.canScrollVertically())},Blockly.WorkspaceSvg.prototype.onMouseWheel_=function(a){var b,c,d;Blockly.Gesture.inProgress()?(a.preventDefault(),a.stopPropagation()):(b=this.options.zoomOptions&&this.options.zoomOptions.wheel,c=this.options.moveOptions&&this.options.moveOptions.wheel,(b||c)&&(d=Blockly.utils.getScrollDeltaPixels(a),!b||!a.ctrlKey&&c?(b=this.scrollX-d.x,c=this.scrollY-d.y,a.shiftKey&&!d.x&&(b=this.scrollX-d.y,c=this.scrollY),this.scroll(b,c)):(d=-d.y/50,b=Blockly.utils.mouseToSvg(a,this.getParentSvg(),this.getInverseScreenCTM()),this.zoom(b.x,b.y,d)),a.preventDefault()))},Blockly.WorkspaceSvg.prototype.getBlocksBoundingBox=function(){var a=this.getTopBoundedElements();if(!a.length)return new Blockly.utils.Rect(0,0,0,0);for(var b=a[0].getBoundingRectangle(),c=1;cb.bottom&&(b.bottom=d.bottom),d.leftb.right&&(b.right=d.right))}return b},Blockly.WorkspaceSvg.prototype.cleanUp=function(){this.setResizesEnabled(!1),Blockly.Events.setGroup(!0);for(var d,e,a=this.getTopBlocks(!0),b=0,c=0;d=a[c];c++)d.isMovable()&&(e=d.getRelativeToSurfaceXY(),d.moveBy(-e.x,b-e.y),d.snapToGrid(),b=d.getRelativeToSurfaceXY().y+d.getHeightWidth().height+this.renderer_.getConstants().MIN_BLOCK_HEIGHT);Blockly.Events.setGroup(!1),this.setResizesEnabled(!0)},Blockly.WorkspaceSvg.prototype.showContextMenu=function(a){var b;this.options.readOnly||this.isFlyout||(b=Blockly.ContextMenuRegistry.registry.getContextMenuOptions(Blockly.ContextMenuRegistry.ScopeType.WORKSPACE,{workspace:this}),this.configureContextMenu&&this.configureContextMenu(b,a),Blockly.ContextMenu.show(a,b,this.RTL))},Blockly.WorkspaceSvg.prototype.updateToolbox=function(a){if(a=Blockly.utils.toolbox.convertToolboxDefToJson(a)){if(!this.options.languageTree)throw Error("Existing toolbox is null. Can't create new toolbox.");if(Blockly.utils.toolbox.hasCategories(a)){if(!this.toolbox_)throw Error("Existing toolbox has no categories. Can't change mode.");this.options.languageTree=a,this.toolbox_.render(a)}else{if(!this.flyout_)throw Error("Existing toolbox has categories. Can't change mode.");this.options.languageTree=a,this.flyout_.show(a)}}else if(this.options.languageTree)throw Error("Can't nullify an existing toolbox.")},Blockly.WorkspaceSvg.prototype.markFocused=function(){this.options.parentWorkspace?this.options.parentWorkspace.markFocused():(Blockly.mainWorkspace=this).setBrowserFocus()},Blockly.WorkspaceSvg.prototype.setBrowserFocus=function(){document.activeElement&&document.activeElement.blur&&document.activeElement.blur();try{this.getParentSvg().focus({preventScroll:!0})}catch(a){try{this.getParentSvg().parentNode.setActive()}catch(b){this.getParentSvg().parentNode.focus({preventScroll:!0})}}},Blockly.WorkspaceSvg.prototype.zoom=function(a,b,c){c=Math.pow(this.options.zoomOptions.scaleSpeed,c);var e,f,d=this.scale*c;this.scale!=d&&(d>this.options.zoomOptions.maxScale?c=this.options.zoomOptions.maxScale/this.scale:dthis.options.zoomOptions.maxScale?a=this.options.zoomOptions.maxScale:this.options.zoomOptions.minScale&&ab.oldScale&&Blockly.bumpTopObjectsIntoBounds_(a))}},Blockly.bumpObjectIntoBounds_=function(a,b,c){var d=c.getBoundingRectangle(),e=d.right-d.left,f=Blockly.utils.math.clamp(b.top,d.top,b.top+b.height-(d.bottom-d.top))-d.top,g=b.left;return b=b.left+b.width-e,a.RTL?g=Math.min(b,g):b=Math.max(g,b),!(!(a=Blockly.utils.math.clamp(g,d.left,b)-d.left)&&!f)&&(c.moveBy(a,f),!0)},Blockly.init_=function(a){var d,b=a.options,c=a.getParentSvg();Blockly.browserEvents.conditionalBind(c.parentNode,"contextmenu",null,function(e){Blockly.utils.isTargetInput(e)||e.preventDefault()}),c=Blockly.browserEvents.conditionalBind(window,"resize",null,function(){Blockly.hideChaff(!0),Blockly.svgResize(a),Blockly.bumpTopObjectsIntoBounds_(a)}),a.setResizeHandlerWrapper(c),Blockly.inject.bindDocumentEvents_(),b.languageTree&&(c=a.getToolbox(),d=a.getFlyout(!0),c?c.init():d&&(d.init(a),d.show(b.languageTree),"function"==typeof d.scrollToStart&&d.scrollToStart())),c=Blockly.Scrollbar.scrollbarThickness,b.hasTrashcan&&(c=a.trashcan.init(c)),b.zoomOptions&&b.zoomOptions.controls&&a.zoomControls_.init(c),b.moveOptions&&b.moveOptions.scrollbars?(a.scrollbar=new Blockly.ScrollbarPair(a,!0===b.moveOptions.scrollbars||!!b.moveOptions.scrollbars.horizontal,!0===b.moveOptions.scrollbars||!!b.moveOptions.scrollbars.vertical,"blocklyMainWorkspaceScrollbar"),a.scrollbar.resize()):a.setMetrics({x:.5,y:.5}),b.hasSounds&&Blockly.inject.loadSounds_(b.pathToMedia,a)},Blockly.inject.bindDocumentEvents_=function(){Blockly.documentEventsBound_||(Blockly.browserEvents.conditionalBind(document,"scroll",null,function(){for(var c,a=Blockly.Workspace.getAll(),b=0;c=a[b];b++)c.updateInverseScreenCTM&&c.updateInverseScreenCTM()}),Blockly.browserEvents.conditionalBind(document,"keydown",null,Blockly.onKeyDown),Blockly.browserEvents.bind(document,"touchend",null,Blockly.longStop_),Blockly.browserEvents.bind(document,"touchcancel",null,Blockly.longStop_),Blockly.utils.userAgent.IPAD&&Blockly.browserEvents.conditionalBind(window,"orientationchange",document,function(){Blockly.svgResize(Blockly.getMainWorkspace())})),Blockly.documentEventsBound_=!0},Blockly.inject.loadSounds_=function(a,b){var c=b.getAudioManager();c.load([a+"click.mp3",a+"click.wav",a+"click.ogg"],"click"),c.load([a+"disconnect.wav",a+"disconnect.mp3",a+"disconnect.ogg"],"disconnect"),c.load([a+"delete.mp3",a+"delete.ogg",a+"delete.wav"],"delete");var d=[];a=function(){for(;d.length;)Blockly.browserEvents.unbind(d.pop());c.preload()},d.push(Blockly.browserEvents.conditionalBind(document,"mousemove",null,a,!0)),d.push(Blockly.browserEvents.conditionalBind(document,"touchstart",null,a,!0))},Blockly.Names=function(a,b){if(this.variablePrefix_=b||"",this.reservedDict_=Object.create(null),a)for(a=a.split(","),b=0;b1'),d.appendChild(c),b.push(d)),Blockly.Blocks.variables_get){a.sort(Blockly.VariableModel.compareByName),c=0;for(;e=a[c];c++)(d=Blockly.utils.xml.createElement("block")).setAttribute("type","variables_get"),d.setAttribute("gap",8),d.appendChild(Blockly.Variables.generateVariableFieldDom(e)),b.push(d)}}return b},Blockly.Variables.VAR_LETTER_OPTIONS="ijkmnopqrstuvwxyzabcdefgh",Blockly.Variables.generateUniqueName=function(a){return Blockly.Variables.generateUniqueNameFromOptions(Blockly.Variables.VAR_LETTER_OPTIONS.charAt(0),a.getAllVariableNames())},Blockly.Variables.generateUniqueNameFromOptions=function(a,b){if(!b.length)return a;for(var c=Blockly.Variables.VAR_LETTER_OPTIONS,d="",e=c.indexOf(a);;){for(var f=!1,g=0;g>>/sprites.png);","height: 16px;","vertical-align: middle;","visibility: hidden;","width: 16px;","}",".blocklyTreeIconClosed {","background-position: -32px -1px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeIconClosed {',"background-position: 0 -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosed {","background-position: -32px -17px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeSelected>.blocklyTreeIconClosed {',"background-position: 0 -17px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconOpen {","background-position: -16px -17px;","}",".blocklyTreeLabel {","cursor: default;","font: 16px sans-serif;","padding: 0 3px;","vertical-align: middle;","}",".blocklyToolboxDelete .blocklyTreeLabel {",'cursor: url("<<>>/handdelete.cur"), auto;',"}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}"]),Blockly.registry.register(Blockly.registry.Type.TOOLBOX_ITEM,Blockly.ToolboxCategory.registrationName,Blockly.ToolboxCategory),Blockly.ToolboxSeparator=function(a,b){Blockly.ToolboxSeparator.superClass_.constructor.call(this,a,b),this.cssConfig_={container:"blocklyTreeSeparator"},Blockly.utils.object.mixin(this.cssConfig_,a.cssconfig||a.cssConfig)},Blockly.utils.object.inherits(Blockly.ToolboxSeparator,Blockly.ToolboxItem),Blockly.ToolboxSeparator.registrationName="sep",Blockly.ToolboxSeparator.prototype.init=function(){this.createDom_()},Blockly.ToolboxSeparator.prototype.createDom_=function(){var a=document.createElement("div");return Blockly.utils.dom.addClass(a,this.cssConfig_.container),this.htmlDiv_=a},Blockly.ToolboxSeparator.prototype.getDiv=function(){return this.htmlDiv_},Blockly.ToolboxSeparator.prototype.dispose=function(){Blockly.utils.dom.removeNode(this.htmlDiv_)},Blockly.Css.register('.blocklyTreeSeparator {,border-bottom: solid #e5e5e5 1px;,height: 0;,margin: 5px 0;,},.blocklyToolboxDiv[layout="h"] .blocklyTreeSeparator {,border-right: solid #e5e5e5 1px;,border-bottom: none;,height: auto;,margin: 0 5px 0 5px;,padding: 5px 0;,width: 0;,}'.split(",")),Blockly.registry.register(Blockly.registry.Type.TOOLBOX_ITEM,Blockly.ToolboxSeparator.registrationName,Blockly.ToolboxSeparator),Blockly.CollapsibleToolboxCategory=function(a,b,c){this.subcategoriesDiv_=null,this.expanded_=!1,this.toolboxItems_=[],Blockly.CollapsibleToolboxCategory.superClass_.constructor.call(this,a,b,c)},Blockly.utils.object.inherits(Blockly.CollapsibleToolboxCategory,Blockly.ToolboxCategory),Blockly.CollapsibleToolboxCategory.registrationName="collapsibleCategory",Blockly.CollapsibleToolboxCategory.prototype.makeDefaultCssConfig_=function(){var a=Blockly.CollapsibleToolboxCategory.superClass_.makeDefaultCssConfig_.call(this);return a.contents="blocklyToolboxContents",a},Blockly.CollapsibleToolboxCategory.prototype.parseContents_=function(a){var d,b=a.contents,c=!0;if(a.custom)this.flyoutItems_=a.custom;else if(b){a=0;for(;d=b[a];a++)c=!Blockly.registry.hasItem(Blockly.registry.Type.TOOLBOX_ITEM,d.kind)||d.kind.toLowerCase()==Blockly.ToolboxSeparator.registrationName&&c?(this.flyoutItems_.push(d),!0):(this.createToolboxItem_(d),!1)}},Blockly.CollapsibleToolboxCategory.prototype.createToolboxItem_=function(a){var b=a.kind;"CATEGORY"==b.toUpperCase()&&Blockly.utils.toolbox.isCategoryCollapsible(a)&&(b=Blockly.CollapsibleToolboxCategory.registrationName),a=new(Blockly.registry.getClass(Blockly.registry.Type.TOOLBOX_ITEM,b))(a,this.parentToolbox_,this),this.toolboxItems_.push(a)},Blockly.CollapsibleToolboxCategory.prototype.init=function(){Blockly.CollapsibleToolboxCategory.superClass_.init.call(this),this.setExpanded("true"==this.toolboxItemDef_.expanded||this.toolboxItemDef_.expanded)},Blockly.CollapsibleToolboxCategory.prototype.createDom_=function(){Blockly.CollapsibleToolboxCategory.superClass_.createDom_.call(this);var a=this.getChildToolboxItems();return this.subcategoriesDiv_=this.createSubCategoriesDom_(a),Blockly.utils.aria.setRole(this.subcategoriesDiv_,Blockly.utils.aria.Role.GROUP),this.htmlDiv_.appendChild(this.subcategoriesDiv_),this.htmlDiv_},Blockly.CollapsibleToolboxCategory.prototype.createIconDom_=function(){var a=document.createElement("span");return this.parentToolbox_.isHorizontal()||(Blockly.utils.dom.addClass(a,this.cssConfig_.icon),a.style.visibility="visible"),a.style.display="inline-block",a},Blockly.CollapsibleToolboxCategory.prototype.createSubCategoriesDom_=function(a){var b=document.createElement("div");Blockly.utils.dom.addClass(b,this.cssConfig_.contents);for(var c=0;c>>/handdelete.cur"), auto;',"}",".blocklyToolboxGrab {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyToolboxDiv {","background-color: #ddd;","overflow-x: visible;","overflow-y: auto;","padding: 4px 0 4px 0;","position: absolute;","z-index: 70;","-webkit-tap-highlight-color: transparent;","}",".blocklyToolboxContents {","display: flex;","flex-wrap: wrap;","flex-direction: column;","}",".blocklyToolboxContents:focus {","outline: none;","}"]),Blockly.registry.register(Blockly.registry.Type.TOOLBOX,Blockly.registry.DEFAULT,Blockly.Toolbox),Blockly.Events.TrashcanOpen=function(a,b){Blockly.Events.TrashcanOpen.superClass_.constructor.call(this,b),this.isOpen=a},Blockly.utils.object.inherits(Blockly.Events.TrashcanOpen,Blockly.Events.UiBase),Blockly.Events.TrashcanOpen.prototype.type=Blockly.Events.TRASHCAN_OPEN,Blockly.Events.TrashcanOpen.prototype.toJson=function(){var a=Blockly.Events.TrashcanOpen.superClass_.toJson.call(this);return a.isOpen=this.isOpen,a},Blockly.Events.TrashcanOpen.prototype.fromJson=function(a){Blockly.Events.TrashcanOpen.superClass_.fromJson.call(this,a),this.isOpen=a.isOpen},Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.TRASHCAN_OPEN,Blockly.Events.TrashcanOpen),Blockly.IPlugin=function(){},Blockly.IPositionable=function(){},Blockly.Trashcan=function(a){this.workspace_=a,this.contents_=[],this.flyout=null,this.workspace_.options.maxTrashcanContents<=0||(a=new Blockly.Options({scrollbars:!0,parentWorkspace:this.workspace_,rtl:this.workspace_.RTL,oneBasedIndex:this.workspace_.options.oneBasedIndex,renderer:this.workspace_.options.renderer,rendererOverrides:this.workspace_.options.rendererOverrides,move:{scrollbars:!0}}),this.workspace_.horizontalLayout?(a.toolboxPosition=this.workspace_.toolboxPosition==Blockly.utils.toolbox.Position.TOP?Blockly.utils.toolbox.Position.BOTTOM:Blockly.utils.toolbox.Position.TOP,this.flyout=new(Blockly.registry.getClassFromOptions(Blockly.registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,this.workspace_.options,!0))(a)):(a.toolboxPosition=this.workspace_.toolboxPosition==Blockly.utils.toolbox.Position.RIGHT?Blockly.utils.toolbox.Position.LEFT:Blockly.utils.toolbox.Position.RIGHT,this.flyout=new(Blockly.registry.getClassFromOptions(Blockly.registry.Type.FLYOUTS_VERTICAL_TOOLBOX,this.workspace_.options,!0))(a)),this.workspace_.addChangeListener(this.onDelete_.bind(this)))},Blockly.Trashcan.prototype.WIDTH_=47,Blockly.Trashcan.prototype.BODY_HEIGHT_=44,Blockly.Trashcan.prototype.LID_HEIGHT_=16,Blockly.Trashcan.prototype.MARGIN_BOTTOM_=20,Blockly.Trashcan.prototype.MARGIN_SIDE_=20,Blockly.Trashcan.prototype.MARGIN_HOTSPOT_=10,Blockly.Trashcan.prototype.SPRITE_LEFT_=0,Blockly.Trashcan.prototype.SPRITE_TOP_=32,Blockly.Trashcan.prototype.HAS_BLOCKS_LID_ANGLE_=.1,Blockly.Trashcan.ANIMATION_LENGTH_=80,Blockly.Trashcan.ANIMATION_FRAMES_=4,Blockly.Trashcan.OPACITY_MIN_=.4,Blockly.Trashcan.OPACITY_MAX_=.8,Blockly.Trashcan.MAX_LID_ANGLE_=45,Blockly.Trashcan.prototype.isLidOpen=!1,Blockly.Trashcan.prototype.minOpenness_=0,Blockly.Trashcan.prototype.svgGroup_=null,Blockly.Trashcan.prototype.svgLid_=null,Blockly.Trashcan.prototype.lidTask_=0,Blockly.Trashcan.prototype.lidOpen_=0,Blockly.Trashcan.prototype.left_=0,Blockly.Trashcan.prototype.top_=0,Blockly.Trashcan.prototype.createDom=function(){this.svgGroup_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.G,{class:"blocklyTrash"},null);var a=String(Math.random()).substring(2),b=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.CLIPPATH,{id:"blocklyTrashBodyClipPath"+a},this.svgGroup_);Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.RECT,{width:this.WIDTH_,height:this.BODY_HEIGHT_,y:this.LID_HEIGHT_},b);var c=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.IMAGE,{width:Blockly.SPRITE.width,x:-this.SPRITE_LEFT_,height:Blockly.SPRITE.height,y:-this.SPRITE_TOP_,"clip-path":"url(#blocklyTrashBodyClipPath"+a+")"},this.svgGroup_);return c.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+Blockly.SPRITE.url),b=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.CLIPPATH,{id:"blocklyTrashLidClipPath"+a},this.svgGroup_),Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.RECT,{width:this.WIDTH_,height:this.LID_HEIGHT_},b),this.svgLid_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.IMAGE,{width:Blockly.SPRITE.width,x:-this.SPRITE_LEFT_,height:Blockly.SPRITE.height,y:-this.SPRITE_TOP_,"clip-path":"url(#blocklyTrashLidClipPath"+a+")"},this.svgGroup_),this.svgLid_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+Blockly.SPRITE.url),Blockly.browserEvents.bind(this.svgGroup_,"mousedown",this,this.blockMouseDownWhenOpenable_),Blockly.browserEvents.bind(this.svgGroup_,"mouseup",this,this.click),Blockly.browserEvents.bind(c,"mouseover",this,this.mouseOver_),Blockly.browserEvents.bind(c,"mouseout",this,this.mouseOut_),this.animateLid_(),this.svgGroup_},Blockly.Trashcan.prototype.init=function(a){return 0this.minOpenness_&&this.lidOpen_<1&&(this.lidTask_=setTimeout(this.animateLid_.bind(this),Blockly.Trashcan.ANIMATION_LENGTH_/a))},Blockly.Trashcan.prototype.setLidAngle_=function(a){var b=this.workspace_.toolboxPosition==Blockly.utils.toolbox.Position.RIGHT||this.workspace_.horizontalLayout&&this.workspace_.RTL;this.svgLid_.setAttribute("transform","rotate("+(b?-a:a)+","+(b?4:this.WIDTH_-4)+","+(this.LID_HEIGHT_-2)+")")},Blockly.Trashcan.prototype.setMinOpenness_=function(a){this.minOpenness_=a,this.isLidOpen||this.setLidAngle_(a*Blockly.Trashcan.MAX_LID_ANGLE_)},Blockly.Trashcan.prototype.closeLid=function(){this.setLidOpen(!1)},Blockly.Trashcan.prototype.click=function(){this.hasContents_()&&this.openFlyout()},Blockly.Trashcan.prototype.fireUiEvent_=function(a){a=new(Blockly.Events.get(Blockly.Events.TRASHCAN_OPEN))(a,this.workspace_.id),Blockly.Events.fire(a)},Blockly.Trashcan.prototype.blockMouseDownWhenOpenable_=function(a){!this.contentsIsOpen()&&this.hasContents_()&&a.stopPropagation()},Blockly.Trashcan.prototype.mouseOver_=function(){this.hasContents_()&&this.setLidOpen(!0)},Blockly.Trashcan.prototype.mouseOut_=function(){this.setLidOpen(!1)},Blockly.Trashcan.prototype.onDelete_=function(a){if(!(this.workspace_.options.maxTrashcanContents<=0)&&a.type==Blockly.Events.BLOCK_DELETE&&a.oldXml.tagName&&"shadow"!=a.oldXml.tagName.toLowerCase()&&(a=this.cleanBlockXML_(a.oldXml),-1==this.contents_.indexOf(a))){for(this.contents_.unshift(a);this.contents_.length>this.workspace_.options.maxTrashcanContents;)this.contents_.pop();this.setMinOpenness_(this.HAS_BLOCKS_LID_ANGLE_)}},Blockly.Trashcan.prototype.cleanBlockXML_=function(a){for(var b=a=a.cloneNode(!0);b;){b.removeAttribute&&(b.removeAttribute("x"),b.removeAttribute("y"),b.removeAttribute("id"),b.removeAttribute("disabled"),"comment"==b.nodeName&&(b.removeAttribute("h"),b.removeAttribute("w"),b.removeAttribute("pinned")));var c=b.firstChild||b.nextSibling;if(!c)for(c=b.parentNode;c;){if(c.nextSibling){c=c.nextSibling;break}c=c.parentNode}b=c}return Blockly.Xml.domToText(a)},Blockly.VariablesDynamic={},Blockly.VariablesDynamic.onCreateVariableButtonClick_String=function(a){Blockly.Variables.createVariableButtonHandler(a.getTargetWorkspace(),void 0,"String")},Blockly.VariablesDynamic.onCreateVariableButtonClick_Number=function(a){Blockly.Variables.createVariableButtonHandler(a.getTargetWorkspace(),void 0,"Number")},Blockly.VariablesDynamic.onCreateVariableButtonClick_Colour=function(a){Blockly.Variables.createVariableButtonHandler(a.getTargetWorkspace(),void 0,"Colour")},Blockly.VariablesDynamic.flyoutCategory=function(a){var b=[],c=document.createElement("button");return c.setAttribute("text",Blockly.Msg.NEW_STRING_VARIABLE),c.setAttribute("callbackKey","CREATE_VARIABLE_STRING"),b.push(c),(c=document.createElement("button")).setAttribute("text",Blockly.Msg.NEW_NUMBER_VARIABLE),c.setAttribute("callbackKey","CREATE_VARIABLE_NUMBER"),b.push(c),(c=document.createElement("button")).setAttribute("text",Blockly.Msg.NEW_COLOUR_VARIABLE),c.setAttribute("callbackKey","CREATE_VARIABLE_COLOUR"),b.push(c),a.registerButtonCallback("CREATE_VARIABLE_STRING",Blockly.VariablesDynamic.onCreateVariableButtonClick_String),a.registerButtonCallback("CREATE_VARIABLE_NUMBER",Blockly.VariablesDynamic.onCreateVariableButtonClick_Number),a.registerButtonCallback("CREATE_VARIABLE_COLOUR",Blockly.VariablesDynamic.onCreateVariableButtonClick_Colour),a=Blockly.VariablesDynamic.flyoutCategoryBlocks(a),b.concat(a)},Blockly.VariablesDynamic.flyoutCategoryBlocks=function(a){a=a.getAllVariables();var c,d,e,b=[];if(0image, .blocklyZoom>svg>image {","opacity: .4;","}",".blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {","opacity: .6;","}",".blocklyZoom>image:active, .blocklyZoom>svg>image:active {","opacity: .8;","}"]),Blockly.ShortcutItems={},Blockly.ShortcutItems.names={ESCAPE:"escape",DELETE:"delete",COPY:"copy",CUT:"cut",PASTE:"paste",UNDO:"undo",REDO:"redo"},Blockly.ShortcutItems.registerEscape=function(){var a={name:Blockly.ShortcutItems.names.ESCAPE,preconditionFn:function(b){return!b.options.readOnly},callback:function(){return Blockly.hideChaff(),!0}};Blockly.ShortcutRegistry.registry.register(a),Blockly.ShortcutRegistry.registry.addKeyMapping(Blockly.utils.KeyCodes.ESC,a.name)},Blockly.ShortcutItems.registerDelete=function(){var a={name:Blockly.ShortcutItems.names.DELETE,preconditionFn:function(b){return!b.options.readOnly&&Blockly.selected&&Blockly.selected.isDeletable()},callback:function(b,c){return c.preventDefault(),!Blockly.Gesture.inProgress()&&(Blockly.deleteBlock(Blockly.selected),!0)}};Blockly.ShortcutRegistry.registry.register(a),Blockly.ShortcutRegistry.registry.addKeyMapping(Blockly.utils.KeyCodes.DELETE,a.name),Blockly.ShortcutRegistry.registry.addKeyMapping(Blockly.utils.KeyCodes.BACKSPACE,a.name)},Blockly.ShortcutItems.registerCopy=function(){var a={name:Blockly.ShortcutItems.names.COPY,preconditionFn:function(c){return!c.options.readOnly&&!Blockly.Gesture.inProgress()&&Blockly.selected&&Blockly.selected.isDeletable()&&Blockly.selected.isMovable()},callback:function(){return Blockly.hideChaff(),Blockly.copy(Blockly.selected),!0}};Blockly.ShortcutRegistry.registry.register(a);var b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.C,[Blockly.utils.KeyCodes.CTRL]);Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.C,[Blockly.utils.KeyCodes.ALT]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.C,[Blockly.utils.KeyCodes.META]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name)},Blockly.ShortcutItems.registerCut=function(){var a={name:Blockly.ShortcutItems.names.CUT,preconditionFn:function(c){return!c.options.readOnly&&!Blockly.Gesture.inProgress()&&Blockly.selected&&Blockly.selected.isDeletable()&&Blockly.selected.isMovable()&&!Blockly.selected.workspace.isFlyout},callback:function(){return Blockly.copy(Blockly.selected),Blockly.deleteBlock(Blockly.selected),!0}};Blockly.ShortcutRegistry.registry.register(a);var b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.X,[Blockly.utils.KeyCodes.CTRL]);Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.X,[Blockly.utils.KeyCodes.ALT]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.X,[Blockly.utils.KeyCodes.META]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name)},Blockly.ShortcutItems.registerPaste=function(){var a={name:Blockly.ShortcutItems.names.PASTE,preconditionFn:function(c){return!c.options.readOnly&&!Blockly.Gesture.inProgress()},callback:function(){return Blockly.paste()}};Blockly.ShortcutRegistry.registry.register(a);var b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.V,[Blockly.utils.KeyCodes.CTRL]);Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.V,[Blockly.utils.KeyCodes.ALT]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.V,[Blockly.utils.KeyCodes.META]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name)},Blockly.ShortcutItems.registerUndo=function(){var a={name:Blockly.ShortcutItems.names.UNDO,preconditionFn:function(c){return!c.options.readOnly&&!Blockly.Gesture.inProgress()},callback:function(c){return Blockly.hideChaff(),c.undo(!1),!0}};Blockly.ShortcutRegistry.registry.register(a);var b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.Z,[Blockly.utils.KeyCodes.CTRL]);Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.Z,[Blockly.utils.KeyCodes.ALT]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.Z,[Blockly.utils.KeyCodes.META]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name)},Blockly.ShortcutItems.registerRedo=function(){var a={name:Blockly.ShortcutItems.names.REDO,preconditionFn:function(c){return!Blockly.Gesture.inProgress()&&!c.options.readOnly},callback:function(c){return Blockly.hideChaff(),c.undo(!0),!0}};Blockly.ShortcutRegistry.registry.register(a);var b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.Z,[Blockly.utils.KeyCodes.SHIFT,Blockly.utils.KeyCodes.CTRL]);Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.Z,[Blockly.utils.KeyCodes.SHIFT,Blockly.utils.KeyCodes.ALT]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.Z,[Blockly.utils.KeyCodes.SHIFT,Blockly.utils.KeyCodes.META]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.Y,[Blockly.utils.KeyCodes.CTRL]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name)},Blockly.ShortcutItems.registerDefaultShortcuts=function(){Blockly.ShortcutItems.registerEscape(),Blockly.ShortcutItems.registerDelete(),Blockly.ShortcutItems.registerCopy(),Blockly.ShortcutItems.registerCut(),Blockly.ShortcutItems.registerPaste(),Blockly.ShortcutItems.registerUndo(),Blockly.ShortcutItems.registerRedo()},Blockly.ShortcutItems.registerDefaultShortcuts(),Blockly.ContextMenuItems={},Blockly.ContextMenuItems.registerUndo=function(){Blockly.ContextMenuRegistry.registry.register({displayText:function(){return Blockly.Msg.UNDO},preconditionFn:function(a){return 0a||Math.abs(this.workspaceHeight_-d)>a)&&(this.workspaceWidth_=c,this.workspaceHeight_=d,this.bubble_.setBubbleSize(c+a,d+a),this.svgDialog_.setAttribute("width",this.workspaceWidth_),this.svgDialog_.setAttribute("height",this.workspaceHeight_),this.workspace_.setCachedParentSvgSize(this.workspaceWidth_,this.workspaceHeight_)),this.block_.RTL&&(a="translate("+this.workspaceWidth_+",0)",this.workspace_.getCanvas().setAttribute("transform",a)),this.workspace_.resize()},Blockly.Mutator.prototype.onBubbleMove_=function(){this.workspace_&&this.workspace_.recordDeleteAreas()},Blockly.Mutator.prototype.setVisible=function(a){if(a!=this.isVisible())if(Blockly.Events.fire(new(Blockly.Events.get(Blockly.Events.BUBBLE_OPEN))(this.block_,a,"mutator")),a){this.bubble_=new Blockly.Bubble(this.block_.workspace,this.createEditor_(),this.block_.pathObject.svgPath,this.iconXY_,null,null),this.bubble_.setSvgId(this.block_.id),this.bubble_.registerMoveEvent(this.onBubbleMove_.bind(this));var b=this.workspace_.options.languageTree;a=this.workspace_.getFlyout(),b&&(a.init(this.workspace_),a.show(b)),this.rootBlock_=this.block_.decompose(this.workspace_);for(var d,e,f,b=this.rootBlock_.getDescendants(!1),c=0;d=b[c];c++)d.render();this.rootBlock_.setMovable(!1),this.rootBlock_.setDeletable(!1),a=a?(b=2*a.CORNER_RADIUS,this.rootBlock_.RTL?a.getWidth()+b:b):b=16,this.block_.RTL&&(a=-a),this.rootBlock_.moveBy(a,b),this.block_.saveConnections&&((f=(e=this).block_).saveConnections(this.rootBlock_),this.sourceListener_=function(){f.saveConnections(e.rootBlock_)},this.block_.workspace.addChangeListener(this.sourceListener_)),this.resizeBubble_(),this.workspace_.addChangeListener(this.workspaceChanged_.bind(this)),this.applyColour()}else this.svgDialog_=null,this.workspace_.dispose(),this.rootBlock_=this.workspace_=null,this.bubble_.dispose(),this.bubble_=null,this.workspaceHeight_=this.workspaceWidth_=0,this.sourceListener_&&(this.block_.workspace.removeChangeListener(this.sourceListener_),this.sourceListener_=null)},Blockly.Mutator.prototype.workspaceChanged_=function(a){if(!(a.isUiEvent||a.type==Blockly.Events.CHANGE&&"disabled"==a.element)){if(!this.workspace_.isDragging()){a=this.workspace_.getTopBlocks(!1);for(var c,b=0;c=a[b];b++){var e,f,d=c.getRelativeToSurfaceXY();d.y<20&&c.moveBy(0,20-d.y),c.RTL?(e=-20,(f=this.workspace_.getFlyout())&&(e-=f.getWidth()),d.x>e&&c.moveBy(e-d.x,0)):d.x<20&&c.moveBy(20-d.x,0)}}var g;this.rootBlock_.workspace==this.workspace_&&(Blockly.Events.setGroup(!0),a=(a=(c=this.block_).mutationToDom())&&Blockly.Xml.domToText(a),b=c.rendered,c.rendered=!1,c.compose(this.rootBlock_),c.rendered=b,c.initSvg(),c.rendered&&c.render(),a!=(b=(b=c.mutationToDom())&&Blockly.Xml.domToText(b))&&(Blockly.Events.fire(new(Blockly.Events.get(Blockly.Events.BLOCK_CHANGE))(c,"mutation",null,a,b)),g=Blockly.Events.getGroup(),setTimeout(function(){Blockly.Events.setGroup(g),c.bumpNeighbours(),Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY)),this.workspace_.isDragging()||this.resizeBubble_(),Blockly.Events.setGroup(!1))}},Blockly.Mutator.prototype.dispose=function(){this.block_.mutator=null,Blockly.Icon.prototype.dispose.call(this)},Blockly.Mutator.prototype.updateBlockStyle=function(){var a=this.workspace_;if(a&&a.getAllBlocks(!1)){for(var b=a.getAllBlocks(!1),c=0;cthis.wrap_&&(a-=360),a},Blockly.Css.register(".blocklyAngleCircle {,stroke: #444;,stroke-width: 1;,fill: #ddd;,fill-opacity: .8;,},.blocklyAngleMarks {,stroke: #444;,stroke-width: 1;,},.blocklyAngleGauge {,fill: #f88;,fill-opacity: .8;,pointer-events: none;,},.blocklyAngleLine {,stroke: #f00;,stroke-width: 2;,stroke-linecap: round;,pointer-events: none;,}".split(",")),Blockly.fieldRegistry.register("field_angle",Blockly.FieldAngle),Blockly.FieldCheckbox=function(a,b,c){this.checkChar_=null,Blockly.FieldCheckbox.superClass_.constructor.call(this,a,b,c)},Blockly.utils.object.inherits(Blockly.FieldCheckbox,Blockly.Field),Blockly.FieldCheckbox.prototype.DEFAULT_VALUE=!1,Blockly.FieldCheckbox.fromJson=function(a){return new Blockly.FieldCheckbox(a.checked,void 0,a)},Blockly.FieldCheckbox.CHECK_CHAR="✓",Blockly.FieldCheckbox.prototype.SERIALIZABLE=!0,Blockly.FieldCheckbox.prototype.CURSOR="default",Blockly.FieldCheckbox.prototype.configure_=function(a){Blockly.FieldCheckbox.superClass_.configure_.call(this,a),a.checkCharacter&&(this.checkChar_=a.checkCharacter)},Blockly.FieldCheckbox.prototype.initView=function(){Blockly.FieldCheckbox.superClass_.initView.call(this),Blockly.utils.dom.addClass(this.textElement_,"blocklyCheckbox"),this.textElement_.style.display=this.value_?"block":"none"},Blockly.FieldCheckbox.prototype.render_=function(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_(this.getConstants().FIELD_CHECKBOX_X_OFFSET)},Blockly.FieldCheckbox.prototype.getDisplayText_=function(){return this.checkChar_||Blockly.FieldCheckbox.CHECK_CHAR},Blockly.FieldCheckbox.prototype.setCheckCharacter=function(a){this.checkChar_=a,this.forceRerender()},Blockly.FieldCheckbox.prototype.showEditor_=function(){this.setValue(!this.value_)},Blockly.FieldCheckbox.prototype.doClassValidation_=function(a){return!0===a||"TRUE"===a?"TRUE":!1===a||"FALSE"===a?"FALSE":null},Blockly.FieldCheckbox.prototype.doValueUpdate_=function(a){this.value_=this.convertValueToBool_(a),this.textElement_&&(this.textElement_.style.display=this.value_?"block":"none")},Blockly.FieldCheckbox.prototype.getValue=function(){return this.value_?"TRUE":"FALSE"},Blockly.FieldCheckbox.prototype.getValueBoolean=function(){return this.value_},Blockly.FieldCheckbox.prototype.getText=function(){return String(this.convertValueToBool_(this.value_))},Blockly.FieldCheckbox.prototype.convertValueToBool_=function(a){return"string"==typeof a?"TRUE"==a:!!a},Blockly.fieldRegistry.register("field_checkbox",Blockly.FieldCheckbox),Blockly.FieldColour=function(a,b,c){Blockly.FieldColour.superClass_.constructor.call(this,a,b,c),this.onKeyDownWrapper_=this.onMouseLeaveWrapper_=this.onMouseEnterWrapper_=this.onMouseMoveWrapper_=this.onClickWrapper_=this.highlightedIndex_=this.picker_=null},Blockly.utils.object.inherits(Blockly.FieldColour,Blockly.Field),Blockly.FieldColour.fromJson=function(a){return new Blockly.FieldColour(a.colour,void 0,a)},Blockly.FieldColour.prototype.SERIALIZABLE=!0,Blockly.FieldColour.prototype.CURSOR="default",Blockly.FieldColour.prototype.isDirty_=!1,Blockly.FieldColour.prototype.colours_=null,Blockly.FieldColour.prototype.titles_=null,Blockly.FieldColour.prototype.columns_=0,Blockly.FieldColour.prototype.configure_=function(a){Blockly.FieldColour.superClass_.configure_.call(this,a),a.colourOptions&&(this.colours_=a.colourOptions,this.titles_=a.colourTitles),a.columns&&(this.columns_=a.columns)},Blockly.FieldColour.prototype.initView=function(){this.size_=new Blockly.utils.Size(this.getConstants().FIELD_COLOUR_DEFAULT_WIDTH,this.getConstants().FIELD_COLOUR_DEFAULT_HEIGHT),this.getConstants().FIELD_COLOUR_FULL_BLOCK?this.clickTarget_=this.sourceBlock_.getSvgRoot():(this.createBorderRect_(),this.borderRect_.style.fillOpacity="1")},Blockly.FieldColour.prototype.applyColour=function(){this.getConstants().FIELD_COLOUR_FULL_BLOCK?(this.sourceBlock_.pathObject.svgPath.setAttribute("fill",this.getValue()),this.sourceBlock_.pathObject.svgPath.setAttribute("stroke","#fff")):this.borderRect_&&(this.borderRect_.style.fill=this.getValue())},Blockly.FieldColour.prototype.doClassValidation_=function(a){return"string"!=typeof a?null:Blockly.utils.colour.parse(a)},Blockly.FieldColour.prototype.doValueUpdate_=function(a){this.value_=a,this.borderRect_?this.borderRect_.style.fill=a:this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.pathObject.svgPath.setAttribute("fill",a),this.sourceBlock_.pathObject.svgPath.setAttribute("stroke","#fff"))},Blockly.FieldColour.prototype.getText=function(){var a=this.value_;return a=/^#(.)\1(.)\2(.)\3$/.test(a)?"#"+a[1]+a[3]+a[5]:a},Blockly.FieldColour.COLOURS="#ffffff #cccccc #c0c0c0 #999999 #666666 #333333 #000000 #ffcccc #ff6666 #ff0000 #cc0000 #990000 #660000 #330000 #ffcc99 #ff9966 #ff9900 #ff6600 #cc6600 #993300 #663300 #ffff99 #ffff66 #ffcc66 #ffcc33 #cc9933 #996633 #663333 #ffffcc #ffff33 #ffff00 #ffcc00 #999900 #666600 #333300 #99ff99 #66ff99 #33ff33 #33cc00 #009900 #006600 #003300 #99ffff #33ffff #66cccc #00cccc #339999 #336666 #003333 #ccffff #66ffff #33ccff #3366ff #3333ff #000099 #000066 #ccccff #9999ff #6666cc #6633ff #6600cc #333399 #330099 #ffccff #ff99ff #cc66cc #cc33cc #993399 #663366 #330033".split(" "),Blockly.FieldColour.prototype.DEFAULT_VALUE=Blockly.FieldColour.COLOURS[0],Blockly.FieldColour.TITLES=[],Blockly.FieldColour.COLUMNS=7,Blockly.FieldColour.prototype.setColours=function(a,b){return this.colours_=a,b&&(this.titles_=b),this},Blockly.FieldColour.prototype.setColumns=function(a){return this.columns_=a,this},Blockly.FieldColour.prototype.showEditor_=function(){this.picker_=this.dropdownCreate_(),Blockly.DropDownDiv.getContentDiv().appendChild(this.picker_),Blockly.DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this)),this.picker_.focus({preventScroll:!0})},Blockly.FieldColour.prototype.onClick_=function(a){null!==(a=(a=a.target)&&a.label)&&(this.setValue(a),Blockly.DropDownDiv.hideIfOwner(this))},Blockly.FieldColour.prototype.onKeyDown_=function(a){var b=!1;a.keyCode===Blockly.utils.KeyCodes.UP?(this.moveHighlightBy_(0,-1),b=!0):a.keyCode===Blockly.utils.KeyCodes.DOWN?(this.moveHighlightBy_(0,1),b=!0):a.keyCode===Blockly.utils.KeyCodes.LEFT?(this.moveHighlightBy_(-1,0),b=!0):a.keyCode===Blockly.utils.KeyCodes.RIGHT?(this.moveHighlightBy_(1,0),b=!0):a.keyCode===Blockly.utils.KeyCodes.ENTER&&(!(b=this.getHighlighted_())||null!==(b=b&&b.label)&&this.setValue(b),Blockly.DropDownDiv.hideWithoutAnimation(),b=!0),b&&a.stopPropagation()},Blockly.FieldColour.prototype.moveHighlightBy_=function(a,b){var c=this.colours_||Blockly.FieldColour.COLOURS,d=this.columns_||Blockly.FieldColour.COLUMNS,e=this.highlightedIndex_%d,f=Math.floor(this.highlightedIndex_/d);e+=a,f+=b,a<0?e<0&&0Math.floor(c.length/d)-1&&(f=Math.floor(c.length/d)-1),this.setHighlightedCell_(this.picker_.childNodes[f].childNodes[e],f*d+e)},Blockly.FieldColour.prototype.onMouseMove_=function(a){var b=(a=a.target)&&Number(a.getAttribute("data-index"));null!==b&&b!==this.highlightedIndex_&&this.setHighlightedCell_(a,b)},Blockly.FieldColour.prototype.onMouseEnter_=function(){this.picker_.focus({preventScroll:!0})},Blockly.FieldColour.prototype.onMouseLeave_=function(){this.picker_.blur();var a=this.getHighlighted_();a&&Blockly.utils.dom.removeClass(a,"blocklyColourHighlighted")},Blockly.FieldColour.prototype.getHighlighted_=function(){var a=this.columns_||Blockly.FieldColour.COLUMNS,b=this.picker_.childNodes[Math.floor(this.highlightedIndex_/a)];return b?b.childNodes[this.highlightedIndex_%a]:null},Blockly.FieldColour.prototype.setHighlightedCell_=function(a,b){var c=this.getHighlighted_();c&&Blockly.utils.dom.removeClass(c,"blocklyColourHighlighted"),Blockly.utils.dom.addClass(a,"blocklyColourHighlighted"),this.highlightedIndex_=b,Blockly.utils.aria.setState(this.picker_,Blockly.utils.aria.State.ACTIVEDESCENDANT,a.getAttribute("id"))},Blockly.FieldColour.prototype.dropdownCreate_=function(){var a=this.columns_||Blockly.FieldColour.COLUMNS,b=this.colours_||Blockly.FieldColour.COLOURS,c=this.titles_||Blockly.FieldColour.TITLES,d=this.getValue(),e=document.createElement("table");e.className="blocklyColourTable",e.tabIndex=0,e.dir="ltr",Blockly.utils.aria.setRole(e,Blockly.utils.aria.Role.GRID),Blockly.utils.aria.setState(e,Blockly.utils.aria.State.EXPANDED,!0),Blockly.utils.aria.setState(e,Blockly.utils.aria.State.ROWCOUNT,Math.floor(b.length/a)),Blockly.utils.aria.setState(e,Blockly.utils.aria.State.COLCOUNT,a);for(var f,g=0;gtr>td {","border: .5px solid #888;","box-sizing: border-box;","cursor: pointer;","display: inline-block;","height: 20px;","padding: 0;","width: 20px;","}",".blocklyColourTable>tr>td.blocklyColourHighlighted {","border-color: #eee;","box-shadow: 2px 2px 7px 2px rgba(0,0,0,.3);","position: relative;","}",".blocklyColourSelected, .blocklyColourSelected:hover {","border-color: #eee !important;","outline: 1px solid #333;","position: relative;","}"]),Blockly.fieldRegistry.register("field_colour",Blockly.FieldColour),Blockly.FieldDropdown=function(a,b,c){"function"!=typeof a&&Blockly.FieldDropdown.validateOptions_(a),this.menuGenerator_=a,this.suffixField=this.prefixField=this.generatedOptions_=null,this.trimOptions_(),this.selectedOption_=this.getOptions(!1)[0],Blockly.FieldDropdown.superClass_.constructor.call(this,this.selectedOption_[1],b,c),this.svgArrow_=this.arrow_=this.imageElement_=this.menu_=this.selectedMenuItem_=null},Blockly.utils.object.inherits(Blockly.FieldDropdown,Blockly.Field),Blockly.FieldDropdown.fromJson=function(a){return new Blockly.FieldDropdown(a.options,void 0,a)},Blockly.FieldDropdown.prototype.fromXml=function(a){this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(a.textContent)},Blockly.FieldDropdown.prototype.SERIALIZABLE=!0,Blockly.FieldDropdown.CHECKMARK_OVERHANG=25,Blockly.FieldDropdown.MAX_MENU_HEIGHT_VH=.45,Blockly.FieldDropdown.IMAGE_Y_OFFSET=5,Blockly.FieldDropdown.IMAGE_Y_PADDING=2*Blockly.FieldDropdown.IMAGE_Y_OFFSET,Blockly.FieldDropdown.ARROW_CHAR=Blockly.utils.userAgent.ANDROID?"▼":"▾",Blockly.FieldDropdown.prototype.CURSOR="default",Blockly.FieldDropdown.prototype.initView=function(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot(),this.createTextElement_(),this.imageElement_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.IMAGE,{},this.fieldGroup_),this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_(),this.borderRect_&&Blockly.utils.dom.addClass(this.borderRect_,"blocklyDropdownRect")},Blockly.FieldDropdown.prototype.shouldAddBorderRect_=function(){return!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&!this.sourceBlock_.isShadow()},Blockly.FieldDropdown.prototype.createTextArrow_=function(){this.arrow_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.TSPAN,{},this.textElement_),this.arrow_.appendChild(document.createTextNode(this.sourceBlock_.RTL?Blockly.FieldDropdown.ARROW_CHAR+" ":" "+Blockly.FieldDropdown.ARROW_CHAR)),this.sourceBlock_.RTL?this.textElement_.insertBefore(this.arrow_,this.textContent_):this.textElement_.appendChild(this.arrow_)},Blockly.FieldDropdown.prototype.createSVGArrow_=function(){this.svgArrow_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.IMAGE,{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_),this.svgArrow_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI)},Blockly.FieldDropdown.prototype.showEditor_=function(a){var b;this.menu_=this.dropdownCreate_(),this.menu_.openingCoords=a&&"number"==typeof a.clientX?new Blockly.utils.Coordinate(a.clientX,a.clientY):null,this.menu_.render(Blockly.DropDownDiv.getContentDiv()),a=this.menu_.getElement(),Blockly.utils.dom.addClass(a,"blocklyDropdownMenu"),this.getConstants().FIELD_DROPDOWN_COLOURED_DIV&&(a=(this.sourceBlock_.isShadow()?this.sourceBlock_.getParent():this.sourceBlock_).getColour(),b=(this.sourceBlock_.isShadow()?this.sourceBlock_.getParent():this.sourceBlock_).style.colourTertiary,Blockly.DropDownDiv.setColour(a,b)),Blockly.DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this)),this.menu_.focus(),this.selectedMenuItem_&&this.menu_.setHighlighted(this.selectedMenuItem_),this.applyColour()},Blockly.FieldDropdown.prototype.dropdownCreate_=function(){var a=new Blockly.Menu;a.setRole(Blockly.utils.aria.Role.LISTBOX);var b=this.getOptions(!1);this.selectedMenuItem_=null;for(var c=0;cthis.maxDisplayLength?e=e.substring(0,this.maxDisplayLength-4)+"...":this.isOverflowedY_&&d===c-1&&(e=e.substring(0,e.length-3)+"..."),a+=e=e.replace(/\s/g,Blockly.Field.NBSP),d!==c-1&&(a+="\n")}return this.sourceBlock_.RTL&&(a+="‏"),a},Blockly.FieldMultilineInput.prototype.doValueUpdate_=function(a){Blockly.FieldMultilineInput.superClass_.doValueUpdate_.call(this,a),this.isOverflowedY_=this.value_.split("\n").length>this.maxLines_},Blockly.FieldMultilineInput.prototype.render_=function(){for(;a=this.textGroup_.firstChild;)this.textGroup_.removeChild(a);for(var a=this.getDisplayText_().split("\n"),b=0,c=0;cthis.maxDisplayLength&&(a[d]=a[d].substring(0,this.maxDisplayLength)),e.textContent=a[d];var k=Blockly.utils.dom.getFastTextWidth(e,f,g,h);bthis.max_&&Blockly.utils.aria.setState(a,Blockly.utils.aria.State.VALUEMAX,this.max_),a},Blockly.fieldRegistry.register("field_number",Blockly.FieldNumber),Blockly.FieldVariable=function(a,b,c,d,e){this.menuGenerator_=Blockly.FieldVariable.dropdownCreate,this.defaultVariableName="string"==typeof a?a:"",this.size_=new Blockly.utils.Size(0,0),e&&this.configure_(e),b&&this.setValidator(b),e||this.setTypes_(c,d)},Blockly.utils.object.inherits(Blockly.FieldVariable,Blockly.FieldDropdown),Blockly.FieldVariable.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.variable);return new Blockly.FieldVariable(b,void 0,void 0,void 0,a)},Blockly.FieldVariable.prototype.SERIALIZABLE=!0,Blockly.FieldVariable.prototype.configure_=function(a){Blockly.FieldVariable.superClass_.configure_.call(this,a),this.setTypes_(a.variableTypes,a.defaultType)},Blockly.FieldVariable.prototype.initModel=function(){var a;this.variable_||(a=Blockly.Variables.getOrCreateVariablePackage(this.sourceBlock_.workspace,null,this.defaultVariableName,this.defaultType_),this.doValueUpdate_(a.getId()))},Blockly.FieldVariable.prototype.shouldAddBorderRect_=function(){return Blockly.FieldVariable.superClass_.shouldAddBorderRect_.call(this)&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||"variables_get"!=this.sourceBlock_.type)},Blockly.FieldVariable.prototype.fromXml=function(a){var b=a.getAttribute("id"),c=a.textContent,d=a.getAttribute("variabletype")||a.getAttribute("variableType")||"",b=Blockly.Variables.getOrCreateVariablePackage(this.sourceBlock_.workspace,b,c,d);if(null!=d&&d!==b.type)throw Error("Serialized variable type with id '"+b.getId()+"' had type "+b.type+", and does not match variable field that references it: "+Blockly.Xml.domToText(a)+".");this.setValue(b.getId())},Blockly.FieldVariable.prototype.toXml=function(a){return this.initModel(),a.id=this.variable_.getId(),a.textContent=this.variable_.name,this.variable_.type&&a.setAttribute("variabletype",this.variable_.type),a},Blockly.FieldVariable.prototype.setSourceBlock=function(a){if(a.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");Blockly.FieldVariable.superClass_.setSourceBlock.call(this,a)},Blockly.FieldVariable.prototype.getValue=function(){return this.variable_?this.variable_.getId():null},Blockly.FieldVariable.prototype.getText=function(){return this.variable_?this.variable_.name:""},Blockly.FieldVariable.prototype.getVariable=function(){return this.variable_},Blockly.FieldVariable.prototype.getValidator=function(){return this.variable_?this.validator_:null},Blockly.FieldVariable.prototype.doClassValidation_=function(a){if(null===a)return null;var b=Blockly.Variables.getVariable(this.sourceBlock_.workspace,a);return b?(b=b.type,this.typeIsAllowed_(b)?a:(console.warn("Variable type doesn't match this field! Type was "+b),null)):(console.warn("Variable id doesn't point to a real variable! ID was "+a),null)},Blockly.FieldVariable.prototype.doValueUpdate_=function(a){this.variable_=Blockly.Variables.getVariable(this.sourceBlock_.workspace,a),Blockly.FieldVariable.superClass_.doValueUpdate_.call(this,a)},Blockly.FieldVariable.prototype.typeIsAllowed_=function(a){var b=this.getVariableTypes_();if(!b)return!0;for(var c=0;crect,",a+" .blocklyEditableText>rect {","fill: "+this.FIELD_BORDER_RECT_COLOUR+";","fill-opacity: .6;","stroke: none;","}",a+" .blocklyNonEditableText>text,",a+" .blocklyEditableText>text {","fill: #000;","}",a+" .blocklyFlyoutLabelText {","fill: #000;","}",a+" .blocklyText.blocklyBubbleText {","fill: #000;","}",a+" .blocklyEditableText:not(.editing):hover>rect {","stroke: #fff;","stroke-width: 2;","}",a+" .blocklyHtmlInput {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","font-weight: "+this.FIELD_TEXT_FONTWEIGHT+";","}",a+" .blocklySelected>.blocklyPath {","stroke: #fc3;","stroke-width: 3px;","}",a+" .blocklyHighlightedConnectionPath {","stroke: #fc3;","}",a+" .blocklyReplaceable .blocklyPath {","fill-opacity: .5;","}",a+" .blocklyReplaceable .blocklyPathLight,",a+" .blocklyReplaceable .blocklyPathDark {","display: none;","}",a+" .blocklyInsertionMarker>.blocklyPath {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none;","}"]},Blockly.blockRendering.Types={NONE:0,FIELD:1,HAT:2,ICON:4,SPACER:8,BETWEEN_ROW_SPACER:16,IN_ROW_SPACER:32,EXTERNAL_VALUE_INPUT:64,INPUT:128,INLINE_INPUT:256,STATEMENT_INPUT:512,CONNECTION:1024,PREVIOUS_CONNECTION:2048,NEXT_CONNECTION:4096,OUTPUT_CONNECTION:8192,CORNER:16384,LEFT_SQUARE_CORNER:32768,LEFT_ROUND_CORNER:65536,RIGHT_SQUARE_CORNER:131072,RIGHT_ROUND_CORNER:262144,JAGGED_EDGE:524288,ROW:1048576,TOP_ROW:2097152,BOTTOM_ROW:4194304,INPUT_ROW:8388608},Blockly.blockRendering.Types.LEFT_CORNER=Blockly.blockRendering.Types.LEFT_SQUARE_CORNER|Blockly.blockRendering.Types.LEFT_ROUND_CORNER,Blockly.blockRendering.Types.RIGHT_CORNER=Blockly.blockRendering.Types.RIGHT_SQUARE_CORNER|Blockly.blockRendering.Types.RIGHT_ROUND_CORNER,Blockly.blockRendering.Types.nextTypeValue_=16777216,Blockly.blockRendering.Types.getType=function(a){return Object.prototype.hasOwnProperty.call(Blockly.blockRendering.Types,a)||(Blockly.blockRendering.Types[a]=Blockly.blockRendering.Types.nextTypeValue_,Blockly.blockRendering.Types.nextTypeValue_<<=1),Blockly.blockRendering.Types[a]},Blockly.blockRendering.Types.isField=function(a){return a.type&Blockly.blockRendering.Types.FIELD},Blockly.blockRendering.Types.isHat=function(a){return a.type&Blockly.blockRendering.Types.HAT},Blockly.blockRendering.Types.isIcon=function(a){return a.type&Blockly.blockRendering.Types.ICON},Blockly.blockRendering.Types.isSpacer=function(a){return a.type&Blockly.blockRendering.Types.SPACER},Blockly.blockRendering.Types.isInRowSpacer=function(a){return a.type&Blockly.blockRendering.Types.IN_ROW_SPACER},Blockly.blockRendering.Types.isInput=function(a){return a.type&Blockly.blockRendering.Types.INPUT},Blockly.blockRendering.Types.isExternalInput=function(a){return a.type&Blockly.blockRendering.Types.EXTERNAL_VALUE_INPUT},Blockly.blockRendering.Types.isInlineInput=function(a){return a.type&Blockly.blockRendering.Types.INLINE_INPUT},Blockly.blockRendering.Types.isStatementInput=function(a){return a.type&Blockly.blockRendering.Types.STATEMENT_INPUT},Blockly.blockRendering.Types.isPreviousConnection=function(a){return a.type&Blockly.blockRendering.Types.PREVIOUS_CONNECTION},Blockly.blockRendering.Types.isNextConnection=function(a){return a.type&Blockly.blockRendering.Types.NEXT_CONNECTION},Blockly.blockRendering.Types.isPreviousOrNextConnection=function(a){return a.type&(Blockly.blockRendering.Types.PREVIOUS_CONNECTION|Blockly.blockRendering.Types.NEXT_CONNECTION)},Blockly.blockRendering.Types.isLeftRoundedCorner=function(a){return a.type&Blockly.blockRendering.Types.LEFT_ROUND_CORNER},Blockly.blockRendering.Types.isRightRoundedCorner=function(a){return a.type&Blockly.blockRendering.Types.RIGHT_ROUND_CORNER},Blockly.blockRendering.Types.isLeftSquareCorner=function(a){return a.type&Blockly.blockRendering.Types.LEFT_SQUARE_CORNER},Blockly.blockRendering.Types.isRightSquareCorner=function(a){return a.type&Blockly.blockRendering.Types.RIGHT_SQUARE_CORNER},Blockly.blockRendering.Types.isCorner=function(a){return a.type&Blockly.blockRendering.Types.CORNER},Blockly.blockRendering.Types.isJaggedEdge=function(a){return a.type&Blockly.blockRendering.Types.JAGGED_EDGE},Blockly.blockRendering.Types.isRow=function(a){return a.type&Blockly.blockRendering.Types.ROW},Blockly.blockRendering.Types.isBetweenRowSpacer=function(a){return a.type&Blockly.blockRendering.Types.BETWEEN_ROW_SPACER},Blockly.blockRendering.Types.isTopRow=function(a){return a.type&Blockly.blockRendering.Types.TOP_ROW},Blockly.blockRendering.Types.isBottomRow=function(a){return a.type&Blockly.blockRendering.Types.BOTTOM_ROW},Blockly.blockRendering.Types.isTopOrBottomRow=function(a){return a.type&(Blockly.blockRendering.Types.TOP_ROW|Blockly.blockRendering.Types.BOTTOM_ROW)},Blockly.blockRendering.Types.isInputRow=function(a){return a.type&Blockly.blockRendering.Types.INPUT_ROW},Blockly.blockRendering.Measurable=function(a){this.height=this.width=0,this.type=Blockly.blockRendering.Types.NONE,this.centerline=this.xPos=0,this.constants_=a,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT},Blockly.blockRendering.Connection=function(a,b){Blockly.blockRendering.Connection.superClass_.constructor.call(this,a),this.connectionModel=b,this.shape=this.constants_.shapeFor(b),this.isDynamicShape=!!this.shape.isDynamic,this.type|=Blockly.blockRendering.Types.CONNECTION},Blockly.utils.object.inherits(Blockly.blockRendering.Connection,Blockly.blockRendering.Measurable),Blockly.blockRendering.OutputConnection=function(a,b){Blockly.blockRendering.OutputConnection.superClass_.constructor.call(this,a,b),this.type|=Blockly.blockRendering.Types.OUTPUT_CONNECTION,this.height=this.isDynamicShape?0:this.shape.height,this.startX=this.width=this.isDynamicShape?0:this.shape.width,this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP,this.connectionOffsetX=0},Blockly.utils.object.inherits(Blockly.blockRendering.OutputConnection,Blockly.blockRendering.Connection),Blockly.blockRendering.PreviousConnection=function(a,b){Blockly.blockRendering.PreviousConnection.superClass_.constructor.call(this,a,b),this.type|=Blockly.blockRendering.Types.PREVIOUS_CONNECTION,this.height=this.shape.height,this.width=this.shape.width},Blockly.utils.object.inherits(Blockly.blockRendering.PreviousConnection,Blockly.blockRendering.Connection),Blockly.blockRendering.NextConnection=function(a,b){Blockly.blockRendering.NextConnection.superClass_.constructor.call(this,a,b),this.type|=Blockly.blockRendering.Types.NEXT_CONNECTION,this.height=this.shape.height,this.width=this.shape.width},Blockly.utils.object.inherits(Blockly.blockRendering.NextConnection,Blockly.blockRendering.Connection),Blockly.blockRendering.InputConnection=function(a,b){Blockly.blockRendering.InputConnection.superClass_.constructor.call(this,a,b.connection),this.type|=Blockly.blockRendering.Types.INPUT,this.input=b,this.align=b.align,(this.connectedBlock=b.connection&&b.connection.targetBlock()?b.connection.targetBlock():null)?(a=this.connectedBlock.getHeightWidth(),this.connectedBlockWidth=a.width,this.connectedBlockHeight=a.height):this.connectedBlockHeight=this.connectedBlockWidth=0,this.connectionOffsetY=this.connectionOffsetX=0},Blockly.utils.object.inherits(Blockly.blockRendering.InputConnection,Blockly.blockRendering.Connection),Blockly.blockRendering.InlineInput=function(a,b){Blockly.blockRendering.InlineInput.superClass_.constructor.call(this,a,b),this.type|=Blockly.blockRendering.Types.INLINE_INPUT,this.connectedBlock?(this.width=this.connectedBlockWidth,this.height=this.connectedBlockHeight):(this.height=this.constants_.EMPTY_INLINE_INPUT_HEIGHT,this.width=this.constants_.EMPTY_INLINE_INPUT_PADDING),this.connectionHeight=this.isDynamicShape?this.shape.height(this.height):this.shape.height,this.connectionWidth=this.isDynamicShape?this.shape.width(this.height):this.shape.width,this.connectedBlock||(this.width+=this.connectionWidth*(this.isDynamicShape?2:1)),this.connectionOffsetY=this.isDynamicShape?this.shape.connectionOffsetY(this.connectionHeight):this.constants_.TAB_OFFSET_FROM_TOP,this.connectionOffsetX=this.isDynamicShape?this.shape.connectionOffsetX(this.connectionWidth):0},Blockly.utils.object.inherits(Blockly.blockRendering.InlineInput,Blockly.blockRendering.InputConnection),Blockly.blockRendering.StatementInput=function(a,b){Blockly.blockRendering.StatementInput.superClass_.constructor.call(this,a,b),this.type|=Blockly.blockRendering.Types.STATEMENT_INPUT,this.height=this.connectedBlock?this.connectedBlockHeight+this.constants_.STATEMENT_BOTTOM_SPACER:this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT,this.width=this.constants_.STATEMENT_INPUT_NOTCH_OFFSET+this.shape.width},Blockly.utils.object.inherits(Blockly.blockRendering.StatementInput,Blockly.blockRendering.InputConnection),Blockly.blockRendering.ExternalValueInput=function(a,b){Blockly.blockRendering.ExternalValueInput.superClass_.constructor.call(this,a,b),this.type|=Blockly.blockRendering.Types.EXTERNAL_VALUE_INPUT,this.height=this.connectedBlock?this.connectedBlockHeight-this.constants_.TAB_OFFSET_FROM_TOP-this.constants_.MEDIUM_PADDING:this.shape.height,this.width=this.shape.width+this.constants_.EXTERNAL_VALUE_INPUT_PADDING,this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP,this.connectionHeight=this.shape.height,this.connectionWidth=this.shape.width},Blockly.utils.object.inherits(Blockly.blockRendering.ExternalValueInput,Blockly.blockRendering.InputConnection),Blockly.blockRendering.Icon=function(a,b){Blockly.blockRendering.Icon.superClass_.constructor.call(this,a),this.icon=b,this.isVisible=b.isVisible(),this.type|=Blockly.blockRendering.Types.ICON,a=b.getCorrectedSize(),this.height=a.height,this.width=a.width},Blockly.utils.object.inherits(Blockly.blockRendering.Icon,Blockly.blockRendering.Measurable),Blockly.blockRendering.JaggedEdge=function(a){Blockly.blockRendering.JaggedEdge.superClass_.constructor.call(this,a),this.type|=Blockly.blockRendering.Types.JAGGED_EDGE,this.height=this.constants_.JAGGED_TEETH.height,this.width=this.constants_.JAGGED_TEETH.width},Blockly.utils.object.inherits(Blockly.blockRendering.JaggedEdge,Blockly.blockRendering.Measurable),Blockly.blockRendering.Field=function(a,b,c){Blockly.blockRendering.Field.superClass_.constructor.call(this,a),this.field=b,this.isEditable=b.EDITABLE,this.flipRtl=b.getFlipRtl(),this.type|=Blockly.blockRendering.Types.FIELD,a=this.field.getSize(),this.height=a.height,this.width=a.width,this.parentInput=c},Blockly.utils.object.inherits(Blockly.blockRendering.Field,Blockly.blockRendering.Measurable),Blockly.blockRendering.Hat=function(a){Blockly.blockRendering.Hat.superClass_.constructor.call(this,a),this.type|=Blockly.blockRendering.Types.HAT,this.height=this.constants_.START_HAT.height,this.width=this.constants_.START_HAT.width,this.ascenderHeight=this.height},Blockly.utils.object.inherits(Blockly.blockRendering.Hat,Blockly.blockRendering.Measurable),Blockly.blockRendering.SquareCorner=function(a,b){Blockly.blockRendering.SquareCorner.superClass_.constructor.call(this,a),this.type=(b&&"left"!=b?Blockly.blockRendering.Types.RIGHT_SQUARE_CORNER:Blockly.blockRendering.Types.LEFT_SQUARE_CORNER)|Blockly.blockRendering.Types.CORNER,this.width=this.height=this.constants_.NO_PADDING},Blockly.utils.object.inherits(Blockly.blockRendering.SquareCorner,Blockly.blockRendering.Measurable),Blockly.blockRendering.RoundCorner=function(a,b){Blockly.blockRendering.RoundCorner.superClass_.constructor.call(this,a),this.type=(b&&"left"!=b?Blockly.blockRendering.Types.RIGHT_ROUND_CORNER:Blockly.blockRendering.Types.LEFT_ROUND_CORNER)|Blockly.blockRendering.Types.CORNER,this.width=this.constants_.CORNER_RADIUS,this.height=this.constants_.CORNER_RADIUS/2},Blockly.utils.object.inherits(Blockly.blockRendering.RoundCorner,Blockly.blockRendering.Measurable),Blockly.blockRendering.InRowSpacer=function(a,b){Blockly.blockRendering.InRowSpacer.superClass_.constructor.call(this,a),this.type=this.type|Blockly.blockRendering.Types.SPACER|Blockly.blockRendering.Types.IN_ROW_SPACER,this.width=b,this.height=this.constants_.SPACER_DEFAULT_HEIGHT},Blockly.utils.object.inherits(Blockly.blockRendering.InRowSpacer,Blockly.blockRendering.Measurable),Blockly.blockRendering.Row=function(a){this.type=Blockly.blockRendering.Types.ROW,this.elements=[],this.xPos=this.yPos=this.widthWithConnectedBlocks=this.minWidth=this.minHeight=this.width=this.height=0,this.hasJaggedEdge=this.hasDummyInput=this.hasInlineInput=this.hasStatement=this.hasExternalInput=!1,this.constants_=a,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT,this.align=null},Blockly.blockRendering.Row.prototype.measure=function(){throw Error("Unexpected attempt to measure a base Row.")},Blockly.blockRendering.Row.prototype.getLastInput=function(){for(var b,a=this.elements.length-1;b=this.elements[a];a--)if(Blockly.blockRendering.Types.isInput(b))return b;return null},Blockly.blockRendering.Row.prototype.startsWithElemSpacer=function(){return!0},Blockly.blockRendering.Row.prototype.endsWithElemSpacer=function(){return!0},Blockly.blockRendering.Row.prototype.getFirstSpacer=function(){for(var b,a=0;b=this.elements[a];a++)if(Blockly.blockRendering.Types.isSpacer(b))return b;return null},Blockly.blockRendering.Row.prototype.getLastSpacer=function(){for(var b,a=this.elements.length-1;b=this.elements[a];a--)if(Blockly.blockRendering.Types.isSpacer(b))return b;return null},Blockly.blockRendering.TopRow=function(a){Blockly.blockRendering.TopRow.superClass_.constructor.call(this,a),this.type|=Blockly.blockRendering.Types.TOP_ROW,this.ascenderHeight=this.capline=0,this.hasPreviousConnection=!1,this.connection=null},Blockly.utils.object.inherits(Blockly.blockRendering.TopRow,Blockly.blockRendering.Row),Blockly.blockRendering.TopRow.prototype.hasLeftSquareCorner=function(a){var b=(a.hat?"cap"===a.hat:this.constants_.ADD_START_HATS)&&!a.outputConnection&&!a.previousConnection,c=a.getPreviousBlock();return!!a.outputConnection||b||!!c&&c.getNextBlock()==a},Blockly.blockRendering.TopRow.prototype.hasRightSquareCorner=function(a){return!0},Blockly.blockRendering.TopRow.prototype.measure=function(){for(var e,a=0,b=0,c=0,d=0;e=this.elements[d];d++)b+=e.width,Blockly.blockRendering.Types.isSpacer(e)||(Blockly.blockRendering.Types.isHat(e)?c=Math.max(c,e.ascenderHeight):a=Math.max(a,e.height));this.width=Math.max(this.minWidth,b),this.height=Math.max(this.minHeight,a)+c,this.capline=this.ascenderHeight=c,this.widthWithConnectedBlocks=this.width},Blockly.blockRendering.TopRow.prototype.startsWithElemSpacer=function(){return!1},Blockly.blockRendering.TopRow.prototype.endsWithElemSpacer=function(){return!1},Blockly.blockRendering.BottomRow=function(a){Blockly.blockRendering.BottomRow.superClass_.constructor.call(this,a),this.type|=Blockly.blockRendering.Types.BOTTOM_ROW,this.hasNextConnection=!1,this.connection=null,this.baseline=this.descenderHeight=0},Blockly.utils.object.inherits(Blockly.blockRendering.BottomRow,Blockly.blockRendering.Row),Blockly.blockRendering.BottomRow.prototype.hasLeftSquareCorner=function(a){return!!a.outputConnection||!!a.getNextBlock()},Blockly.blockRendering.BottomRow.prototype.hasRightSquareCorner=function(a){return!0},Blockly.blockRendering.BottomRow.prototype.measure=function(){for(var e,a=0,b=0,c=0,d=0;e=this.elements[d];d++)b+=e.width,Blockly.blockRendering.Types.isSpacer(e)||(Blockly.blockRendering.Types.isNextConnection(e)?c=Math.max(c,e.height):a=Math.max(a,e.height));this.width=Math.max(this.minWidth,b),this.height=Math.max(this.minHeight,a)+c,this.descenderHeight=c,this.widthWithConnectedBlocks=this.width},Blockly.blockRendering.BottomRow.prototype.startsWithElemSpacer=function(){return!1},Blockly.blockRendering.BottomRow.prototype.endsWithElemSpacer=function(){return!1},Blockly.blockRendering.SpacerRow=function(a,b,c){Blockly.blockRendering.SpacerRow.superClass_.constructor.call(this,a),this.type=this.type|Blockly.blockRendering.Types.SPACER|Blockly.blockRendering.Types.BETWEEN_ROW_SPACER,this.width=c,this.height=b,this.followsStatement=!1,this.widthWithConnectedBlocks=0,this.elements=[new Blockly.blockRendering.InRowSpacer(this.constants_,c)]},Blockly.utils.object.inherits(Blockly.blockRendering.SpacerRow,Blockly.blockRendering.Row),Blockly.blockRendering.SpacerRow.prototype.measure=function(){},Blockly.blockRendering.InputRow=function(a){Blockly.blockRendering.InputRow.superClass_.constructor.call(this,a),this.type|=Blockly.blockRendering.Types.INPUT_ROW,this.connectedBlockWidths=0},Blockly.utils.object.inherits(Blockly.blockRendering.InputRow,Blockly.blockRendering.Row),Blockly.blockRendering.InputRow.prototype.measure=function(){this.width=this.minWidth,this.height=this.minHeight;for(var c,a=0,b=0;c=this.elements[b];b++)this.width+=c.width,Blockly.blockRendering.Types.isInput(c)&&(Blockly.blockRendering.Types.isStatementInput(c)?a+=c.connectedBlockWidth:Blockly.blockRendering.Types.isExternalInput(c)&&0!=c.connectedBlockWidth&&(a+=c.connectedBlockWidth-c.connectionWidth)),Blockly.blockRendering.Types.isSpacer(c)||(this.height=Math.max(this.height,c.height));this.connectedBlockWidths=a,this.widthWithConnectedBlocks=this.width+a},Blockly.blockRendering.InputRow.prototype.endsWithElemSpacer=function(){return!this.hasExternalInput&&!this.hasStatement},Blockly.blockRendering.RenderInfo=function(a,b){this.block_=b,this.renderer_=a,this.constants_=this.renderer_.getConstants(),this.outputConnection=b.outputConnection?new Blockly.blockRendering.OutputConnection(this.constants_,b.outputConnection):null,this.isInline=b.getInputsInline()&&!b.isCollapsed(),this.isCollapsed=b.isCollapsed(),this.isInsertionMarker=b.isInsertionMarker(),this.RTL=b.RTL,this.statementEdge=this.width=this.widthWithChildren=this.height=0,this.rows=[],this.inputRows=[],this.hiddenIcons=[],this.topRow=new Blockly.blockRendering.TopRow(this.constants_),this.bottomRow=new Blockly.blockRendering.BottomRow(this.constants_),this.startY=this.startX=0},Blockly.blockRendering.RenderInfo.prototype.getRenderer=function(){return this.renderer_},Blockly.blockRendering.RenderInfo.prototype.measure=function(){this.createRows_(),this.addElemSpacing_(),this.addRowSpacing_(),this.computeBounds_(),this.alignRowElements_(),this.finalize_()},Blockly.blockRendering.RenderInfo.prototype.createRows_=function(){this.populateTopRow_(),this.rows.push(this.topRow);var a=new Blockly.blockRendering.InputRow(this.constants_);this.inputRows.push(a);var b=this.block_.getIcons();if(b.length)for(var d,c=0;d=b[c];c++){var e=new Blockly.blockRendering.Icon(this.constants_,d);(this.isCollapsed&&d.collapseHidden?this.hiddenIcons:a.elements).push(e)}for(d=null,c=0;b=this.block_.inputList[c];c++)if(b.isVisible()){for(this.shouldStartNewRow_(b,d)&&(this.rows.push(a),a=new Blockly.blockRendering.InputRow(this.constants_),this.inputRows.push(a)),d=0;e=b.fieldRow[d];d++)a.elements.push(new Blockly.blockRendering.Field(this.constants_,e,b));this.addInput_(b,a),d=b}this.isCollapsed&&(a.hasJaggedEdge=!0,a.elements.push(new Blockly.blockRendering.JaggedEdge(this.constants_))),(a.elements.length||a.hasDummyInput)&&this.rows.push(a),this.populateBottomRow_(),this.rows.push(this.bottomRow)},Blockly.blockRendering.RenderInfo.prototype.populateTopRow_=function(){var a=!!this.block_.previousConnection,b=(this.block_.hat?"cap"===this.block_.hat:this.constants_.ADD_START_HATS)&&!this.outputConnection&&!a;this.topRow.hasLeftSquareCorner(this.block_)?this.topRow.elements.push(new Blockly.blockRendering.SquareCorner(this.constants_)):this.topRow.elements.push(new Blockly.blockRendering.RoundCorner(this.constants_)),b?(a=new Blockly.blockRendering.Hat(this.constants_),this.topRow.elements.push(a),this.topRow.capline=a.ascenderHeight):a&&(this.topRow.hasPreviousConnection=!0,this.topRow.connection=new Blockly.blockRendering.PreviousConnection(this.constants_,this.block_.previousConnection),this.topRow.elements.push(this.topRow.connection)),this.block_.inputList.length&&this.block_.inputList[0].type==Blockly.inputTypes.STATEMENT&&!this.block_.isCollapsed()?this.topRow.minHeight=this.constants_.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT:this.topRow.minHeight=this.constants_.TOP_ROW_MIN_HEIGHT,this.topRow.hasRightSquareCorner(this.block_)?this.topRow.elements.push(new Blockly.blockRendering.SquareCorner(this.constants_,"right")):this.topRow.elements.push(new Blockly.blockRendering.RoundCorner(this.constants_,"right"))},Blockly.blockRendering.RenderInfo.prototype.populateBottomRow_=function(){this.bottomRow.hasNextConnection=!!this.block_.nextConnection,this.bottomRow.minHeight=this.block_.inputList.length&&this.block_.inputList[this.block_.inputList.length-1].type==Blockly.inputTypes.STATEMENT?this.constants_.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT:this.constants_.BOTTOM_ROW_MIN_HEIGHT,this.bottomRow.hasLeftSquareCorner(this.block_)?this.bottomRow.elements.push(new Blockly.blockRendering.SquareCorner(this.constants_)):this.bottomRow.elements.push(new Blockly.blockRendering.RoundCorner(this.constants_)),this.bottomRow.hasNextConnection&&(this.bottomRow.connection=new Blockly.blockRendering.NextConnection(this.constants_,this.block_.nextConnection),this.bottomRow.elements.push(this.bottomRow.connection)),this.bottomRow.hasRightSquareCorner(this.block_)?this.bottomRow.elements.push(new Blockly.blockRendering.SquareCorner(this.constants_,"right")):this.bottomRow.elements.push(new Blockly.blockRendering.RoundCorner(this.constants_,"right"))},Blockly.blockRendering.RenderInfo.prototype.addInput_=function(a,b){this.isInline&&a.type==Blockly.inputTypes.VALUE?(b.elements.push(new Blockly.blockRendering.InlineInput(this.constants_,a)),b.hasInlineInput=!0):a.type==Blockly.inputTypes.STATEMENT?(b.elements.push(new Blockly.blockRendering.StatementInput(this.constants_,a)),b.hasStatement=!0):a.type==Blockly.inputTypes.VALUE?(b.elements.push(new Blockly.blockRendering.ExternalValueInput(this.constants_,a)),b.hasExternalInput=!0):a.type==Blockly.inputTypes.DUMMY&&(b.minHeight=Math.max(b.minHeight,a.getSourceBlock()&&a.getSourceBlock().isShadow()?this.constants_.DUMMY_INPUT_SHADOW_MIN_HEIGHT:this.constants_.DUMMY_INPUT_MIN_HEIGHT),b.hasDummyInput=!0),null==b.align&&(b.align=a.align)},Blockly.blockRendering.RenderInfo.prototype.shouldStartNewRow_=function(a,b){return!!b&&(a.type==Blockly.inputTypes.STATEMENT||b.type==Blockly.inputTypes.STATEMENT||(a.type==Blockly.inputTypes.VALUE||a.type==Blockly.inputTypes.DUMMY)&&!this.isInline)},Blockly.blockRendering.RenderInfo.prototype.addElemSpacing_=function(){for(var b,a=0;b=this.rows[a];a++){var c=b.elements;if(b.elements=[],b.startsWithElemSpacer()&&b.elements.push(new Blockly.blockRendering.InRowSpacer(this.constants_,this.getInRowSpacing_(null,c[0]))),c.length){for(var d=0;d.blocklyPathLight,",a+" .blocklyInsertionMarker>.blocklyPathDark {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none;","}"])},Blockly.geras.Highlighter=function(a){this.info_=a,this.inlineSteps_=this.steps_="",this.RTL_=this.info_.RTL,a=a.getRenderer(),this.constants_=a.getConstants(),this.highlightConstants_=a.getHighlightConstants(),this.highlightOffset_=this.highlightConstants_.OFFSET,this.outsideCornerPaths_=this.highlightConstants_.OUTSIDE_CORNER,this.insideCornerPaths_=this.highlightConstants_.INSIDE_CORNER,this.puzzleTabPaths_=this.highlightConstants_.PUZZLE_TAB,this.notchPaths_=this.highlightConstants_.NOTCH,this.startPaths_=this.highlightConstants_.START_HAT,this.jaggedTeethPaths_=this.highlightConstants_.JAGGED_TEETH},Blockly.geras.Highlighter.prototype.getPath=function(){return this.steps_+"\n"+this.inlineSteps_},Blockly.geras.Highlighter.prototype.drawTopCorner=function(a){this.steps_+=Blockly.utils.svgPaths.moveBy(a.xPos,this.info_.startY);for(var c,b=0;c=a.elements[b];b++)Blockly.blockRendering.Types.isLeftSquareCorner(c)?this.steps_+=this.highlightConstants_.START_POINT:Blockly.blockRendering.Types.isLeftRoundedCorner(c)?this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):Blockly.blockRendering.Types.isPreviousConnection(c)?this.steps_+=this.notchPaths_.pathLeft:Blockly.blockRendering.Types.isHat(c)?this.steps_+=this.startPaths_.path(this.RTL_):Blockly.blockRendering.Types.isSpacer(c)&&0!=c.width&&(this.steps_+=Blockly.utils.svgPaths.lineOnAxis("H",c.xPos+c.width-this.highlightOffset_));this.steps_+=Blockly.utils.svgPaths.lineOnAxis("H",a.xPos+a.width-this.highlightOffset_)},Blockly.geras.Highlighter.prototype.drawJaggedEdge_=function(a){this.info_.RTL&&(this.steps_+=this.jaggedTeethPaths_.pathLeft+Blockly.utils.svgPaths.lineOnAxis("v",a.height-this.jaggedTeethPaths_.height-this.highlightOffset_))},Blockly.geras.Highlighter.prototype.drawValueInput=function(a){var c,b=a.getLastInput();this.RTL_?(c=a.height-b.connectionHeight,this.steps_+=Blockly.utils.svgPaths.moveTo(b.xPos+b.width-this.highlightOffset_,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+Blockly.utils.svgPaths.lineOnAxis("v",c)):this.steps_+=Blockly.utils.svgPaths.moveTo(b.xPos+b.width,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)},Blockly.geras.Highlighter.prototype.drawStatementInput=function(a){var c,b=a.getLastInput();this.RTL_?(c=a.height-2*this.insideCornerPaths_.height,this.steps_+=Blockly.utils.svgPaths.moveTo(b.xPos,a.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+Blockly.utils.svgPaths.lineOnAxis("v",c)+this.insideCornerPaths_.pathBottom(this.RTL_)+Blockly.utils.svgPaths.lineTo(a.width-b.xPos-this.insideCornerPaths_.width,0)):this.steps_+=Blockly.utils.svgPaths.moveTo(b.xPos,a.yPos+a.height)+this.insideCornerPaths_.pathBottom(this.RTL_)+Blockly.utils.svgPaths.lineTo(a.width-b.xPos-this.insideCornerPaths_.width,0)},Blockly.geras.Highlighter.prototype.drawRightSideRow=function(a){var b=a.xPos+a.width-this.highlightOffset_;a.followsStatement&&(this.steps_+=Blockly.utils.svgPaths.lineOnAxis("H",b)),this.RTL_&&(this.steps_+=Blockly.utils.svgPaths.lineOnAxis("H",b),a.height>this.highlightOffset_&&(this.steps_+=Blockly.utils.svgPaths.lineOnAxis("V",a.yPos+a.height-this.highlightOffset_)))},Blockly.geras.Highlighter.prototype.drawBottomRow=function(a){var b;this.RTL_?this.steps_+=Blockly.utils.svgPaths.lineOnAxis("V",a.baseline-this.highlightOffset_):(b=this.info_.bottomRow.elements[0],Blockly.blockRendering.Types.isLeftSquareCorner(b)?this.steps_+=Blockly.utils.svgPaths.moveTo(a.xPos+this.highlightOffset_,a.baseline-this.highlightOffset_):Blockly.blockRendering.Types.isLeftRoundedCorner(b)&&(this.steps_+=Blockly.utils.svgPaths.moveTo(a.xPos,a.baseline),this.steps_+=this.outsideCornerPaths_.bottomLeft()))},Blockly.geras.Highlighter.prototype.drawLeft=function(){var a=this.info_.outputConnection;a&&(a=a.connectionOffsetY+a.height,this.RTL_?this.steps_+=Blockly.utils.svgPaths.moveTo(this.info_.startX,a):(this.steps_+=Blockly.utils.svgPaths.moveTo(this.info_.startX+this.highlightOffset_,this.info_.bottomRow.baseline-this.highlightOffset_),this.steps_+=Blockly.utils.svgPaths.lineOnAxis("V",a)),this.steps_+=this.puzzleTabPaths_.pathUp(this.RTL_)),this.RTL_||(a=this.info_.topRow,Blockly.blockRendering.Types.isLeftRoundedCorner(a.elements[0])?this.steps_+=Blockly.utils.svgPaths.lineOnAxis("V",this.outsideCornerPaths_.height):this.steps_+=Blockly.utils.svgPaths.lineOnAxis("V",a.capline+this.highlightOffset_))},Blockly.geras.Highlighter.prototype.drawInlineInput=function(a){var b=this.highlightOffset_,c=a.xPos+a.connectionWidth,d=a.centerline-a.height/2,e=a.width-a.connectionWidth,f=d+b;this.RTL_?(d=a.connectionOffsetY-b,a=a.height-(a.connectionOffsetY+a.connectionHeight)+b,this.inlineSteps_+=Blockly.utils.svgPaths.moveTo(c-b,f)+Blockly.utils.svgPaths.lineOnAxis("v",d)+this.puzzleTabPaths_.pathDown(this.RTL_)+Blockly.utils.svgPaths.lineOnAxis("v",a)+Blockly.utils.svgPaths.lineOnAxis("h",e)):this.inlineSteps_+=Blockly.utils.svgPaths.moveTo(a.xPos+a.width+b,f)+Blockly.utils.svgPaths.lineOnAxis("v",a.height)+Blockly.utils.svgPaths.lineOnAxis("h",-e)+Blockly.utils.svgPaths.moveTo(c,d+a.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_)},Blockly.geras.InlineInput=function(a,b){Blockly.geras.InlineInput.superClass_.constructor.call(this,a,b),this.connectedBlock&&(this.width+=this.constants_.DARK_PATH_OFFSET,this.height+=this.constants_.DARK_PATH_OFFSET)},Blockly.utils.object.inherits(Blockly.geras.InlineInput,Blockly.blockRendering.InlineInput),Blockly.geras.StatementInput=function(a,b){Blockly.geras.StatementInput.superClass_.constructor.call(this,a,b),this.connectedBlock&&(this.height+=this.constants_.DARK_PATH_OFFSET)},Blockly.utils.object.inherits(Blockly.geras.StatementInput,Blockly.blockRendering.StatementInput),Blockly.geras.RenderInfo=function(a,b){Blockly.geras.RenderInfo.superClass_.constructor.call(this,a,b)},Blockly.utils.object.inherits(Blockly.geras.RenderInfo,Blockly.blockRendering.RenderInfo),Blockly.geras.RenderInfo.prototype.getRenderer=function(){return this.renderer_},Blockly.geras.RenderInfo.prototype.populateBottomRow_=function(){Blockly.geras.RenderInfo.superClass_.populateBottomRow_.call(this),this.block_.inputList.length&&this.block_.inputList[this.block_.inputList.length-1].type==Blockly.inputTypes.STATEMENT||(this.bottomRow.minHeight=this.constants_.MEDIUM_PADDING-this.constants_.DARK_PATH_OFFSET)},Blockly.geras.RenderInfo.prototype.addInput_=function(a,b){this.isInline&&a.type==Blockly.inputTypes.VALUE?(b.elements.push(new Blockly.geras.InlineInput(this.constants_,a)),b.hasInlineInput=!0):a.type==Blockly.inputTypes.STATEMENT?(b.elements.push(new Blockly.geras.StatementInput(this.constants_,a)),b.hasStatement=!0):a.type==Blockly.inputTypes.VALUE?(b.elements.push(new Blockly.blockRendering.ExternalValueInput(this.constants_,a)),b.hasExternalInput=!0):a.type==Blockly.inputTypes.DUMMY&&(b.minHeight=Math.max(b.minHeight,this.constants_.DUMMY_INPUT_MIN_HEIGHT),b.hasDummyInput=!0),this.isInline||null!=b.align||(b.align=a.align)},Blockly.geras.RenderInfo.prototype.addElemSpacing_=function(){for(var c,a=!1,b=0;c=this.rows[b];b++)c.hasExternalInput&&(a=!0);for(b=0;c=this.rows[b];b++){var d=c.elements;if(c.elements=[],c.startsWithElemSpacer()&&c.elements.push(new Blockly.blockRendering.InRowSpacer(this.constants_,this.getInRowSpacing_(null,d[0]))),d.length){for(var e=0;erect:not(.blocklyDropdownRect),",a+" .blocklyEditableText>rect:not(.blocklyDropdownRect) {","fill: "+this.FIELD_BORDER_RECT_COLOUR+";","}",a+" .blocklyNonEditableText>text,",a+" .blocklyEditableText>text,",a+" .blocklyNonEditableText>g>text,",a+" .blocklyEditableText>g>text {","fill: #575E75;","}",a+" .blocklyFlyoutLabelText {","fill: #575E75;","}",a+" .blocklyText.blocklyBubbleText {","fill: #575E75;","}",a+" .blocklyDraggable:not(.blocklyDisabled)"," .blocklyEditableText:not(.editing):hover>rect,",a+" .blocklyDraggable:not(.blocklyDisabled)"," .blocklyEditableText:not(.editing):hover>.blocklyPath {","stroke: #fff;","stroke-width: 2;","}",a+" .blocklyHtmlInput {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","font-weight: "+this.FIELD_TEXT_FONTWEIGHT+";","color: #575E75;","}",a+" .blocklyDropdownText {","fill: #fff !important;","}",a+".blocklyWidgetDiv .goog-menuitem,",a+".blocklyDropDownDiv .goog-menuitem {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","}",a+".blocklyDropDownDiv .goog-menuitem-content {","color: #fff;","}",a+" .blocklyHighlightedConnectionPath {","stroke: "+this.SELECTED_GLOW_COLOUR+";","}",a+" .blocklyDisabled > .blocklyOutlinePath {","fill: url(#blocklyDisabledPattern"+this.randomIdentifier+")","}",a+" .blocklyInsertionMarker>.blocklyPath {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none;","}"]},Blockly.zelos.TopRow=function(a){Blockly.zelos.TopRow.superClass_.constructor.call(this,a)},Blockly.utils.object.inherits(Blockly.zelos.TopRow,Blockly.blockRendering.TopRow),Blockly.zelos.TopRow.prototype.endsWithElemSpacer=function(){return!1},Blockly.zelos.TopRow.prototype.hasLeftSquareCorner=function(a){var b=(a.hat?"cap"===a.hat:this.constants_.ADD_START_HATS)&&!a.outputConnection&&!a.previousConnection;return!!a.outputConnection||b},Blockly.zelos.TopRow.prototype.hasRightSquareCorner=function(a){return!!a.outputConnection&&!a.statementInputCount&&!a.nextConnection},Blockly.zelos.BottomRow=function(a){Blockly.zelos.BottomRow.superClass_.constructor.call(this,a)},Blockly.utils.object.inherits(Blockly.zelos.BottomRow,Blockly.blockRendering.BottomRow),Blockly.zelos.BottomRow.prototype.endsWithElemSpacer=function(){return!1},Blockly.zelos.BottomRow.prototype.hasLeftSquareCorner=function(a){return!!a.outputConnection},Blockly.zelos.BottomRow.prototype.hasRightSquareCorner=function(a){return!!a.outputConnection&&!a.statementInputCount&&!a.nextConnection},Blockly.zelos.RightConnectionShape=function(a){Blockly.zelos.RightConnectionShape.superClass_.constructor.call(this,a),this.type|=Blockly.blockRendering.Types.getType("RIGHT_CONNECTION"),this.width=this.height=0},Blockly.utils.object.inherits(Blockly.zelos.RightConnectionShape,Blockly.blockRendering.Measurable),Blockly.zelos.RenderInfo=function(a,b){Blockly.zelos.RenderInfo.superClass_.constructor.call(this,a,b),this.topRow=new Blockly.zelos.TopRow(this.constants_),this.bottomRow=new Blockly.zelos.BottomRow(this.constants_),this.isInline=!0,this.isMultiRow=!b.getInputsInline()||b.isCollapsed(),this.hasStatementInput=0=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!f.precedesStatement,Blockly.blockRendering.Types.isInputRow(e)&&e.hasStatement)e.measure(),b=e.width-e.getLastInput().width+a;else if(d&&(2==c||f)&&Blockly.blockRendering.Types.isInputRow(e)&&!e.hasStatement)for(var h,f=e.xPos,d=null,g=0;h=e.elements[g];g++)!((d=Blockly.blockRendering.Types.isSpacer(h)?h:d)&&(Blockly.blockRendering.Types.isField(h)||Blockly.blockRendering.Types.isInput(h))&&fc?c:this.height/2)*(1-Math.sin(Math.acos((c-this.constants_.SMALL_PADDING)/c))));if(Blockly.blockRendering.Types.isInlineInput(a)){var e=a.connectedBlock;return a=e?e.pathObject.outputShapeType:a.shape.type,e&&e.outputConnection&&(e.statementInputCount||e.nextConnection)||c==d.SHAPES.HEXAGONAL&&c!=a?0:b-this.constants_.SHAPE_IN_SHAPE_PADDING[c][a]}return Blockly.blockRendering.Types.isField(a)?c==d.SHAPES.ROUND&&a.field instanceof Blockly.FieldTextInput?b-2.75*d.GRID_UNIT:b-this.constants_.SHAPE_IN_SHAPE_PADDING[c][0]:Blockly.blockRendering.Types.isIcon(a)?this.constants_.SMALL_PADDING:0},Blockly.zelos.RenderInfo.prototype.finalizeVerticalAlignment_=function(){if(!this.outputConnection)for(var a=2;a=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!d.precedesStatement;if(e?this.topRow.hasPreviousConnection:b.followsStatement){var g=3==c.elements.length&&(c.elements[1].field instanceof Blockly.FieldLabel||c.elements[1].field instanceof Blockly.FieldImage);if(!e&&g)b.height-=this.constants_.SMALL_PADDING,d.height-=this.constants_.SMALL_PADDING,c.height-=this.constants_.MEDIUM_PADDING;else if(e||f){if(f){for(e=!1,f=0;g=c.elements[f];f++)if(Blockly.blockRendering.Types.isInlineInput(g)&&g.connectedBlock&&!g.connectedBlock.isShadow()&&40<=g.connectedBlock.getHeightWidth().height){e=!0;break}e&&(b.height-=this.constants_.SMALL_PADDING,d.height-=this.constants_.SMALL_PADDING)}}else b.height+=this.constants_.SMALL_PADDING}}},Blockly.zelos.RenderInfo.prototype.finalize_=function(){this.finalizeOutputConnection_(),this.finalizeHorizontalAlignment_(),this.finalizeVerticalAlignment_(),Blockly.zelos.RenderInfo.superClass_.finalize_.call(this),this.rightSide&&(this.widthWithChildren+=this.rightSide.width)},Blockly.zelos.Drawer=function(a,b){Blockly.zelos.Drawer.superClass_.constructor.call(this,a,b)},Blockly.utils.object.inherits(Blockly.zelos.Drawer,Blockly.blockRendering.Drawer),Blockly.zelos.Drawer.prototype.draw=function(){var a=this.block_.pathObject;a.beginDrawing(),this.hideHiddenIcons_(),this.drawOutline_(),this.drawInternals_(),a.setPath(this.outlinePath_+"\n"+this.inlinePath_),this.info_.RTL&&a.flipRTL(),Blockly.blockRendering.useDebugger&&this.block_.renderingDebugger.drawDebug(this.block_,this.info_),this.recordSizeOnBlock_(),this.info_.outputConnection&&(a.outputShapeType=this.info_.outputConnection.shape.type),a.endDrawing()},Blockly.zelos.Drawer.prototype.drawOutline_=function(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape&&!this.info_.hasStatementInput&&!this.info_.bottomRow.hasNextConnection?(this.drawFlatTop_(),this.drawRightDynamicConnection_(),this.drawFlatBottom_(),this.drawLeftDynamicConnection_()):Blockly.zelos.Drawer.superClass_.drawOutline_.call(this)},Blockly.zelos.Drawer.prototype.drawLeft_=function(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape?this.drawLeftDynamicConnection_():Blockly.zelos.Drawer.superClass_.drawLeft_.call(this)},Blockly.zelos.Drawer.prototype.drawRightSideRow_=function(a){var b;a.height<=0||(a.precedesStatement||a.followsStatement?(b=this.constants_.INSIDE_CORNERS.rightHeight,b=a.height-(a.precedesStatement?b:0),this.outlinePath_+=(a.followsStatement?this.constants_.INSIDE_CORNERS.pathBottomRight:"")+(0","GT"],["‏≥","GTE"]]},{type:"input_value",name:"B"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",check:"Boolean"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},{type:"logic_negate",message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",check:"Boolean"}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value",name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",extensions:["logic_ternary"]}]),Blockly.defineBlocksWithJsonArray([{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",previousStatement:null,nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]),Blockly.Constants.Logic.TOOLTIPS_BY_OP={EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"},Blockly.Extensions.register("logic_op_tooltip",Blockly.Extensions.buildTooltipForDropdown("OP",Blockly.Constants.Logic.TOOLTIPS_BY_OP)),Blockly.Constants.Logic.CONTROLS_IF_MUTATOR_MIXIN={elseifCount_:0,elseCount_:0,suppressPrefixSuffix:!0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var a=Blockly.utils.xml.createElement("mutation");return this.elseifCount_&&a.setAttribute("elseif",this.elseifCount_),this.elseCount_&&a.setAttribute("else",1),a},domToMutation:function(a){this.elseifCount_=parseInt(a.getAttribute("elseif"),10)||0,this.elseCount_=parseInt(a.getAttribute("else"),10)||0,this.rebuildShape_()},decompose:function(a){var b=a.newBlock("controls_if_if");b.initSvg();for(var c=b.nextConnection,d=1;d<=this.elseifCount_;d++){var e=a.newBlock("controls_if_elseif");e.initSvg(),c.connect(e.previousConnection),c=e.nextConnection}return this.elseCount_&&((a=a.newBlock("controls_if_else")).initSvg(),c.connect(a.previousConnection)),b},compose:function(a){a=a.nextConnection.targetBlock(),this.elseCount_=this.elseifCount_=0;for(var b=[null],c=[null],d=null;a&&!a.isInsertionMarker();){switch(a.type){case"controls_if_elseif":this.elseifCount_++,b.push(a.valueConnection_),c.push(a.statementConnection_);break;case"controls_if_else":this.elseCount_++,d=a.statementConnection_;break;default:throw TypeError("Unknown block type: "+a.type)}a=a.nextConnection&&a.nextConnection.targetBlock()}this.updateShape_(),this.reconnectChildBlocks_(b,c,d)},saveConnections:function(a){a=a.nextConnection.targetBlock();for(var b=1;a;){switch(a.type){case"controls_if_elseif":var c=this.getInput("IF"+b),d=this.getInput("DO"+b);a.valueConnection_=c&&c.connection.targetConnection,a.statementConnection_=d&&d.connection.targetConnection,b++;break;case"controls_if_else":d=this.getInput("ELSE"),a.statementConnection_=d&&d.connection.targetConnection;break;default:throw TypeError("Unknown block type: "+a.type)}a=a.nextConnection&&a.nextConnection.targetBlock()}},rebuildShape_:function(){var a=[null],b=[null],c=null;this.getInput("ELSE")&&(c=this.getInput("ELSE").connection.targetConnection);for(var d=1;this.getInput("IF"+d);){var e=this.getInput("IF"+d),f=this.getInput("DO"+d);a.push(e.connection.targetConnection),b.push(f.connection.targetConnection),d++}this.updateShape_(),this.reconnectChildBlocks_(a,b,c)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var a=1;this.getInput("IF"+a);)this.removeInput("IF"+a),this.removeInput("DO"+a),a++;for(a=1;a<=this.elseifCount_;a++)this.appendValueInput("IF"+a).setCheck("Boolean").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+a).appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE)},reconnectChildBlocks_:function(a,b,c){for(var d=1;d<=this.elseifCount_;d++)Blockly.Mutator.reconnect(a[d],this,"IF"+d),Blockly.Mutator.reconnect(b[d],this,"DO"+d);Blockly.Mutator.reconnect(c,this,"ELSE")}},Blockly.Extensions.registerMutator("controls_if_mutator",Blockly.Constants.Logic.CONTROLS_IF_MUTATOR_MIXIN,null,["controls_if_elseif","controls_if_else"]),Blockly.Constants.Logic.CONTROLS_IF_TOOLTIP_EXTENSION=function(){this.setTooltip(function(){return this.elseifCount_||this.elseCount_?!this.elseifCount_&&this.elseCount_?Blockly.Msg.CONTROLS_IF_TOOLTIP_2:this.elseifCount_&&!this.elseCount_?Blockly.Msg.CONTROLS_IF_TOOLTIP_3:this.elseifCount_&&this.elseCount_?Blockly.Msg.CONTROLS_IF_TOOLTIP_4:"":Blockly.Msg.CONTROLS_IF_TOOLTIP_1}.bind(this))},Blockly.Extensions.register("controls_if_tooltip",Blockly.Constants.Logic.CONTROLS_IF_TOOLTIP_EXTENSION),Blockly.Constants.Logic.LOGIC_COMPARE_ONCHANGE_MIXIN={onchange:function(a){this.prevBlocks_||(this.prevBlocks_=[null,null]);var b=this.getInputTargetBlock("A"),c=this.getInputTargetBlock("B");b&&c&&!this.workspace.connectionChecker.doTypeChecks(b.outputConnection,c.outputConnection)&&(Blockly.Events.setGroup(a.group),(a=this.prevBlocks_[0])!==b&&(b.unplug(),!a||a.isDisposed()||a.isShadow()||this.getInput("A").connection.connect(a.outputConnection)),(b=this.prevBlocks_[1])!==c&&(c.unplug(),!b||b.isDisposed()||b.isShadow()||this.getInput("B").connection.connect(b.outputConnection)),this.bumpNeighbours(),Blockly.Events.setGroup(!1)),this.prevBlocks_[0]=this.getInputTargetBlock("A"),this.prevBlocks_[1]=this.getInputTargetBlock("B")}},Blockly.Constants.Logic.LOGIC_COMPARE_EXTENSION=function(){this.mixin(Blockly.Constants.Logic.LOGIC_COMPARE_ONCHANGE_MIXIN)},Blockly.Extensions.register("logic_compare",Blockly.Constants.Logic.LOGIC_COMPARE_EXTENSION),Blockly.Constants.Logic.LOGIC_TERNARY_ONCHANGE_MIXIN={prevParentConnection_:null,onchange:function(a){var b=this.getInputTargetBlock("THEN"),c=this.getInputTargetBlock("ELSE"),d=this.outputConnection.targetConnection;if((b||c)&&d)for(var e=0;e<2;e++){var f=1==e?b:c;f&&!f.workspace.connectionChecker.doTypeChecks(f.outputConnection,d)&&(Blockly.Events.setGroup(a.group),d===this.prevParentConnection_?(this.unplug(),d.getSourceBlock().bumpNeighbours()):(f.unplug(),f.bumpNeighbours()),Blockly.Events.setGroup(!1))}this.prevParentConnection_=d}},Blockly.Extensions.registerMixin("logic_ternary",Blockly.Constants.Logic.LOGIC_TERNARY_ONCHANGE_MIXIN),Blockly.Blocks.loops={},Blockly.Constants.Loops={},Blockly.Constants.Loops.HUE=120,Blockly.defineBlocksWithJsonArray([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",name:"TIMES",value:10,min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}","UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_for_tooltip"]},{type:"controls_forEach",message0:"%{BKY_CONTROLS_FOREACH_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"LIST",check:"Array"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",extensions:["controls_flow_tooltip","controls_flow_in_loop_check"]}]),Blockly.Constants.Loops.WHILE_UNTIL_TOOLTIPS={WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"},Blockly.Extensions.register("controls_whileUntil_tooltip",Blockly.Extensions.buildTooltipForDropdown("MODE",Blockly.Constants.Loops.WHILE_UNTIL_TOOLTIPS)),Blockly.Constants.Loops.BREAK_CONTINUE_TOOLTIPS={BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"},Blockly.Extensions.register("controls_flow_tooltip",Blockly.Extensions.buildTooltipForDropdown("FLOW",Blockly.Constants.Loops.BREAK_CONTINUE_TOOLTIPS)),Blockly.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN={customContextMenu:function(a){var b,c,d;this.isInFlyout||(c=(b=this.getField("VAR").getVariable()).name,this.isCollapsed()||null==c||((d={enabled:!0}).text=Blockly.Msg.VARIABLES_SET_CREATE_GET.replace("%1",c),b=Blockly.Variables.generateVariableFieldDom(b),(c=Blockly.utils.xml.createElement("block")).setAttribute("type","variables_get"),c.appendChild(b),d.callback=Blockly.ContextMenu.callbackFactory(this,c),a.push(d)))}},Blockly.Extensions.registerMixin("contextMenu_newGetVariableBlock",Blockly.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN),Blockly.Extensions.register("controls_for_tooltip",Blockly.Extensions.buildTooltipWithFieldText("%{BKY_CONTROLS_FOR_TOOLTIP}","VAR")),Blockly.Extensions.register("controls_forEach_tooltip",Blockly.Extensions.buildTooltipWithFieldText("%{BKY_CONTROLS_FOREACH_TOOLTIP}","VAR")),Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN={LOOP_TYPES:["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"],suppressPrefixSuffix:!0,getSurroundLoop:function(a){do{if(-1!=Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.LOOP_TYPES.indexOf(a.type))return a}while(a=a.getSurroundParent());return null},onchange:function(a){var b,c;this.workspace.isDragging&&!this.workspace.isDragging()&&a.type==Blockly.Events.BLOCK_MOVE&&(b=Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.getSurroundLoop(this),this.setWarningText(b?null:Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING),this.isInFlyout||(c=Blockly.Events.getGroup(),Blockly.Events.setGroup(a.group),this.setEnabled(b),Blockly.Events.setGroup(c)))}},Blockly.Extensions.registerMixin("controls_flow_in_loop_check",Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN),Blockly.Blocks.math={},Blockly.Constants.Math={},Blockly.Constants.Math.HUE=230,Blockly.defineBlocksWithJsonArray([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD"],["%{BKY_MATH_SUBTRACTION_SYMBOL}","MINUS"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}","MULTIPLY"],["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE"],["%{BKY_MATH_POWER_SYMBOL}","POWER"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}","ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN"],["%{BKY_MATH_TRIG_COS}","COS"],["%{BKY_MATH_TRIG_TAN}","TAN"],["%{BKY_MATH_TRIG_ASIN}","ASIN"],["%{BKY_MATH_TRIG_ACOS}","ACOS"],["%{BKY_MATH_TRIG_ATAN}","ATAN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_TRIG_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_constant",message0:"%1",args0:[{type:"field_dropdown",name:"CONSTANT",options:[["π","PI"],["e","E"],["φ","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(½)","SQRT1_2"],["∞","INFINITY"]]}],output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTANT_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTANT_HELPURL}"},{type:"math_number_property",message0:"%1 %2",args0:[{type:"input_value",name:"NUMBER_TO_CHECK",check:"Number"},{type:"field_dropdown",name:"PROPERTY",options:[["%{BKY_MATH_IS_EVEN}","EVEN"],["%{BKY_MATH_IS_ODD}","ODD"],["%{BKY_MATH_IS_PRIME}","PRIME"],["%{BKY_MATH_IS_WHOLE}","WHOLE"],["%{BKY_MATH_IS_POSITIVE}","POSITIVE"],["%{BKY_MATH_IS_NEGATIVE}","NEGATIVE"],["%{BKY_MATH_IS_DIVISIBLE_BY}","DIVISIBLE_BY"]]}],inputsInline:!0,output:"Boolean",style:"math_blocks",tooltip:"%{BKY_MATH_IS_TOOLTIP}",mutator:"math_is_divisibleby_mutator"},{type:"math_change",message0:"%{BKY_MATH_CHANGE_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_MATH_CHANGE_TITLE_ITEM}"},{type:"input_value",name:"DELTA",check:"Number"}],previousStatement:null,nextStatement:null,style:"variable_blocks",helpUrl:"%{BKY_MATH_CHANGE_HELPURL}",extensions:["math_change_tooltip"]},{type:"math_round",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ROUND_OPERATOR_ROUND}","ROUND"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDUP}","ROUNDUP"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDDOWN}","ROUNDDOWN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ROUND_HELPURL}",tooltip:"%{BKY_MATH_ROUND_TOOLTIP}"},{type:"math_on_list",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ONLIST_OPERATOR_SUM}","SUM"],["%{BKY_MATH_ONLIST_OPERATOR_MIN}","MIN"],["%{BKY_MATH_ONLIST_OPERATOR_MAX}","MAX"],["%{BKY_MATH_ONLIST_OPERATOR_AVERAGE}","AVERAGE"],["%{BKY_MATH_ONLIST_OPERATOR_MEDIAN}","MEDIAN"],["%{BKY_MATH_ONLIST_OPERATOR_MODE}","MODE"],["%{BKY_MATH_ONLIST_OPERATOR_STD_DEV}","STD_DEV"],["%{BKY_MATH_ONLIST_OPERATOR_RANDOM}","RANDOM"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ONLIST_HELPURL}",mutator:"math_modes_of_list_mutator",extensions:["math_op_tooltip"]},{type:"math_modulo",message0:"%{BKY_MATH_MODULO_TITLE}",args0:[{type:"input_value",name:"DIVIDEND",check:"Number"},{type:"input_value",name:"DIVISOR",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_MODULO_TOOLTIP}",helpUrl:"%{BKY_MATH_MODULO_HELPURL}"},{type:"math_constrain",message0:"%{BKY_MATH_CONSTRAIN_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"Number"},{type:"input_value",name:"LOW",check:"Number"},{type:"input_value",name:"HIGH",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTRAIN_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTRAIN_HELPURL}"},{type:"math_random_int",message0:"%{BKY_MATH_RANDOM_INT_TITLE}",args0:[{type:"input_value",name:"FROM",check:"Number"},{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_INT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_INT_HELPURL}"},{type:"math_random_float",message0:"%{BKY_MATH_RANDOM_FLOAT_TITLE_RANDOM}",output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_FLOAT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_FLOAT_HELPURL}"},{type:"math_atan2",message0:"%{BKY_MATH_ATAN2_TITLE}",args0:[{type:"input_value",name:"X",check:"Number"},{type:"input_value",name:"Y",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_ATAN2_TOOLTIP}",helpUrl:"%{BKY_MATH_ATAN2_HELPURL}"}]),Blockly.Constants.Math.TOOLTIPS_BY_OP={ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}",MULTIPLY:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}",DIVIDE:"%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}",POWER:"%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}",ROOT:"%{BKY_MATH_SINGLE_TOOLTIP_ROOT}",ABS:"%{BKY_MATH_SINGLE_TOOLTIP_ABS}",NEG:"%{BKY_MATH_SINGLE_TOOLTIP_NEG}",LN:"%{BKY_MATH_SINGLE_TOOLTIP_LN}",LOG10:"%{BKY_MATH_SINGLE_TOOLTIP_LOG10}",EXP:"%{BKY_MATH_SINGLE_TOOLTIP_EXP}",POW10:"%{BKY_MATH_SINGLE_TOOLTIP_POW10}",SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"},Blockly.Extensions.register("math_op_tooltip",Blockly.Extensions.buildTooltipForDropdown("OP",Blockly.Constants.Math.TOOLTIPS_BY_OP)),Blockly.Constants.Math.IS_DIVISIBLEBY_MUTATOR_MIXIN={mutationToDom:function(){var a=Blockly.utils.xml.createElement("mutation"),b="DIVISIBLE_BY"==this.getFieldValue("PROPERTY");return a.setAttribute("divisor_input",b),a},domToMutation:function(a){a="true"==a.getAttribute("divisor_input"),this.updateShape_(a)},updateShape_:function(a){var b=this.getInput("DIVISOR");a?b||this.appendValueInput("DIVISOR").setCheck("Number"):b&&this.removeInput("DIVISOR")}},Blockly.Constants.Math.IS_DIVISIBLE_MUTATOR_EXTENSION=function(){this.getField("PROPERTY").setValidator(function(a){a="DIVISIBLE_BY"==a,this.getSourceBlock().updateShape_(a)})},Blockly.Extensions.registerMutator("math_is_divisibleby_mutator",Blockly.Constants.Math.IS_DIVISIBLEBY_MUTATOR_MIXIN,Blockly.Constants.Math.IS_DIVISIBLE_MUTATOR_EXTENSION),Blockly.Extensions.register("math_change_tooltip",Blockly.Extensions.buildTooltipWithFieldText("%{BKY_MATH_CHANGE_TOOLTIP}","VAR")),Blockly.Constants.Math.LIST_MODES_MUTATOR_MIXIN={updateType_:function(a){"MODE"==a?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){var a=Blockly.utils.xml.createElement("mutation");return a.setAttribute("op",this.getFieldValue("OP")),a},domToMutation:function(a){this.updateType_(a.getAttribute("op"))}},Blockly.Constants.Math.LIST_MODES_MUTATOR_EXTENSION=function(){this.getField("OP").setValidator(function(a){this.updateType_(a)}.bind(this))},Blockly.Extensions.registerMutator("math_modes_of_list_mutator",Blockly.Constants.Math.LIST_MODES_MUTATOR_MIXIN,Blockly.Constants.Math.LIST_MODES_MUTATOR_EXTENSION),Blockly.Blocks.procedures={},Blockly.Blocks.procedures_defnoreturn={init:function(){var a=Blockly.Procedures.findLegalName("",this);(a=new Blockly.FieldTextInput(a,Blockly.Procedures.rename)).setSpellcheck(!1),this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE).appendField(a,"NAME").appendField("","PARAMS"),this.setMutator(new Blockly.Mutator(["procedures_mutatorarg"])),(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText(Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT),this.setStyle("procedure_blocks"),this.setTooltip(Blockly.Msg.PROCEDURES_DEFNORETURN_TOOLTIP),this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.setStatements_(!0),this.statementConnection_=null},setStatements_:function(a){this.hasStatements_!==a&&(a?(this.appendStatementInput("STACK").appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=a)},updateParams_:function(){var a="";this.arguments_.length&&(a=Blockly.Msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", ")),Blockly.Events.disable();try{this.setFieldValue(a,"PARAMS")}finally{Blockly.Events.enable()}},mutationToDom:function(a){var b=Blockly.utils.xml.createElement("mutation");a&&b.setAttribute("name",this.getFieldValue("NAME"));for(var c=0;c b.toString() ? 1 : -1; },",' "IGNORE_CASE": function(a, b) {'," return a.toString().toLowerCase() > b.toString().toLowerCase() ? 1 : -1; },"," };"," var compare = compareFuncs[type];"," return function(a, b) { return compare(a, b) * direction; }","}"])+'("'+a+'", '+c+"))",Blockly.JavaScript.ORDER_FUNCTION_CALL]},Blockly.JavaScript.lists_split=function(a){var b=Blockly.JavaScript.valueToCode(a,"INPUT",Blockly.JavaScript.ORDER_MEMBER),c=Blockly.JavaScript.valueToCode(a,"DELIM",Blockly.JavaScript.ORDER_NONE)||"''";if("SPLIT"==(a=a.getFieldValue("MODE")))b=b||"''",a="split";else{if("JOIN"!=a)throw Error("Unknown mode: "+a);b=b||"[]",a="join"}return[b+"."+a+"("+c+")",Blockly.JavaScript.ORDER_FUNCTION_CALL]},Blockly.JavaScript.lists_reverse=function(a){return[(Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_FUNCTION_CALL)||"[]")+".slice().reverse()",Blockly.JavaScript.ORDER_FUNCTION_CALL]},Blockly.JavaScript.logic={},Blockly.JavaScript.controls_if=function(a){var b=0,c="";Blockly.JavaScript.STATEMENT_PREFIX&&(c+=Blockly.JavaScript.injectId(Blockly.JavaScript.STATEMENT_PREFIX,a));do{var d=Blockly.JavaScript.valueToCode(a,"IF"+b,Blockly.JavaScript.ORDER_NONE)||"false",e=Blockly.JavaScript.statementToCode(a,"DO"+b)}while(c+=(0",GTE:">="}[a.getFieldValue("OP")],c="=="==b||"!="==b?Blockly.JavaScript.ORDER_EQUALITY:Blockly.JavaScript.ORDER_RELATIONAL;return[(Blockly.JavaScript.valueToCode(a,"A",c)||"0")+" "+b+" "+(a=Blockly.JavaScript.valueToCode(a,"B",c)||"0"),c]},Blockly.JavaScript.logic_operation=function(a){var e,b="AND"==a.getFieldValue("OP")?"&&":"||",c="&&"==b?Blockly.JavaScript.ORDER_LOGICAL_AND:Blockly.JavaScript.ORDER_LOGICAL_OR,d=Blockly.JavaScript.valueToCode(a,"A",c);return a=Blockly.JavaScript.valueToCode(a,"B",c),a=d||a?(e="&&"==b?"true":"false",d=d||e,a||e):d="false",[d+" "+b+" "+a,c]},Blockly.JavaScript.logic_negate=function(a){var b=Blockly.JavaScript.ORDER_LOGICAL_NOT;return["!"+(Blockly.JavaScript.valueToCode(a,"BOOL",b)||"true"),b]},Blockly.JavaScript.logic_boolean=function(a){return["TRUE"==a.getFieldValue("BOOL")?"true":"false",Blockly.JavaScript.ORDER_ATOMIC]},Blockly.JavaScript.logic_null=function(a){return["null",Blockly.JavaScript.ORDER_ATOMIC]},Blockly.JavaScript.logic_ternary=function(a){return[(Blockly.JavaScript.valueToCode(a,"IF",Blockly.JavaScript.ORDER_CONDITIONAL)||"false")+" ? "+(Blockly.JavaScript.valueToCode(a,"THEN",Blockly.JavaScript.ORDER_CONDITIONAL)||"null")+" : "+(a=Blockly.JavaScript.valueToCode(a,"ELSE",Blockly.JavaScript.ORDER_CONDITIONAL)||"null"),Blockly.JavaScript.ORDER_CONDITIONAL]},Blockly.JavaScript.loops={},Blockly.JavaScript.controls_repeat_ext=function(a){var b=a.getField("TIMES")?String(Number(a.getFieldValue("TIMES"))):Blockly.JavaScript.valueToCode(a,"TIMES",Blockly.JavaScript.ORDER_ASSIGNMENT)||"0",c=Blockly.JavaScript.statementToCode(a,"DO"),c=Blockly.JavaScript.addLoopTrap(c,a);a="";var d=Blockly.JavaScript.variableDB_.getDistinctName("count",Blockly.VARIABLE_CATEGORY_NAME),e=b;return b.match(/^\w+$/)||Blockly.isNumber(b)||(a+="var "+(e=Blockly.JavaScript.variableDB_.getDistinctName("repeat_end",Blockly.VARIABLE_CATEGORY_NAME))+" = "+b+";\n"),a+"for (var "+d+" = 0; "+d+" < "+e+"; "+d+"++) {\n"+c+"}\n"},Blockly.JavaScript.controls_repeat=Blockly.JavaScript.controls_repeat_ext,Blockly.JavaScript.controls_whileUntil=function(a){var b="UNTIL"==a.getFieldValue("MODE"),c=Blockly.JavaScript.valueToCode(a,"BOOL",b?Blockly.JavaScript.ORDER_LOGICAL_NOT:Blockly.JavaScript.ORDER_NONE)||"false",d=Blockly.JavaScript.statementToCode(a,"DO");return"while ("+(c=b?"!"+c:c)+") {\n"+(d=Blockly.JavaScript.addLoopTrap(d,a))+"}\n"},Blockly.JavaScript.controls_for=function(a){var g,b=Blockly.JavaScript.variableDB_.getName(a.getFieldValue("VAR"),Blockly.VARIABLE_CATEGORY_NAME),c=Blockly.JavaScript.valueToCode(a,"FROM",Blockly.JavaScript.ORDER_ASSIGNMENT)||"0",d=Blockly.JavaScript.valueToCode(a,"TO",Blockly.JavaScript.ORDER_ASSIGNMENT)||"0",e=Blockly.JavaScript.valueToCode(a,"BY",Blockly.JavaScript.ORDER_ASSIGNMENT)||"1",f=Blockly.JavaScript.statementToCode(a,"DO"),f=Blockly.JavaScript.addLoopTrap(f,a);return Blockly.isNumber(c)&&Blockly.isNumber(d)&&Blockly.isNumber(e)?(a="for ("+b+" = "+c+"; "+b+((g=Number(c)<=Number(d))?" <= ":" >= ")+d+"; "+b,a=(1==(b=Math.abs(Number(e)))?a+(g?"++":"--"):a+(g?" += ":" -= ")+b)+") {\n"+f+"}\n"):(a="",(g=c).match(/^\w+$/)||Blockly.isNumber(c)||(a+="var "+(g=Blockly.JavaScript.variableDB_.getDistinctName(b+"_start",Blockly.VARIABLE_CATEGORY_NAME))+" = "+c+";\n"),(c=d).match(/^\w+$/)||Blockly.isNumber(d)||(a+="var "+(c=Blockly.JavaScript.variableDB_.getDistinctName(b+"_end",Blockly.VARIABLE_CATEGORY_NAME))+" = "+d+";\n"),a+="var "+(d=Blockly.JavaScript.variableDB_.getDistinctName(b+"_inc",Blockly.VARIABLE_CATEGORY_NAME))+" = ",a=(a=Blockly.isNumber(e)?a+(Math.abs(e)+";\n"):a+"Math.abs("+e+");\n")+"if ("+g+" > "+c+") {\n"+(Blockly.JavaScript.INDENT+d)+" = -"+d+";\n",a+="}\n",a+="for ("+b+" = "+g+"; "+d+" >= 0 ? "+b+" <= "+c+" : "+b+" >= "+c+"; "+b+" += "+d+") {\n"+f+"}\n"),a},Blockly.JavaScript.controls_forEach=function(a){var b=Blockly.JavaScript.variableDB_.getName(a.getFieldValue("VAR"),Blockly.VARIABLE_CATEGORY_NAME),c=Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_ASSIGNMENT)||"[]",d=Blockly.JavaScript.statementToCode(a,"DO"),d=Blockly.JavaScript.addLoopTrap(d,a);a="";var e=c;return c.match(/^\w+$/)||(a+="var "+(e=Blockly.JavaScript.variableDB_.getDistinctName(b+"_list",Blockly.VARIABLE_CATEGORY_NAME))+" = "+c+";\n"),a+"for (var "+(c=Blockly.JavaScript.variableDB_.getDistinctName(b+"_index",Blockly.VARIABLE_CATEGORY_NAME))+" in "+e+") {\n"+(Blockly.JavaScript.INDENT+b+" = "+e+"["+c+"];\n"+d)+"}\n"},Blockly.JavaScript.controls_flow_statements=function(a){var c,b="";switch(Blockly.JavaScript.STATEMENT_PREFIX&&(b+=Blockly.JavaScript.injectId(Blockly.JavaScript.STATEMENT_PREFIX,a)),Blockly.JavaScript.STATEMENT_SUFFIX&&(b+=Blockly.JavaScript.injectId(Blockly.JavaScript.STATEMENT_SUFFIX,a)),!Blockly.JavaScript.STATEMENT_PREFIX||(c=Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.getSurroundLoop(a))&&!c.suppressPrefixSuffix&&(b+=Blockly.JavaScript.injectId(Blockly.JavaScript.STATEMENT_PREFIX,c)),a.getFieldValue("FLOW")){case"BREAK":return b+"break;\n";case"CONTINUE":return b+"continue;\n"}throw Error("Unknown flow statement.")},Blockly.JavaScript.math={},Blockly.JavaScript.math_number=function(a){return[a=Number(a.getFieldValue("NUM")),0<=a?Blockly.JavaScript.ORDER_ATOMIC:Blockly.JavaScript.ORDER_UNARY_NEGATION]},Blockly.JavaScript.math_arithmetic=function(a){var c=(b={ADD:[" + ",Blockly.JavaScript.ORDER_ADDITION],MINUS:[" - ",Blockly.JavaScript.ORDER_SUBTRACTION],MULTIPLY:[" * ",Blockly.JavaScript.ORDER_MULTIPLICATION],DIVIDE:[" / ",Blockly.JavaScript.ORDER_DIVISION],POWER:[null,Blockly.JavaScript.ORDER_NONE]}[a.getFieldValue("OP")])[0],b=b[1],d=Blockly.JavaScript.valueToCode(a,"A",b)||"0";return a=Blockly.JavaScript.valueToCode(a,"B",b)||"0",c?[d+c+a,b]:["Math.pow("+d+", "+a+")",Blockly.JavaScript.ORDER_FUNCTION_CALL]},Blockly.JavaScript.math_single=function(a){var b=a.getFieldValue("OP");if("NEG"==b)return["-"+(a="-"==(a=Blockly.JavaScript.valueToCode(a,"NUM",Blockly.JavaScript.ORDER_UNARY_NEGATION)||"0")[0]?" "+a:a),Blockly.JavaScript.ORDER_UNARY_NEGATION];switch(a="SIN"==b||"COS"==b||"TAN"==b?Blockly.JavaScript.valueToCode(a,"NUM",Blockly.JavaScript.ORDER_DIVISION)||"0":Blockly.JavaScript.valueToCode(a,"NUM",Blockly.JavaScript.ORDER_NONE)||"0",b){case"ABS":var c="Math.abs("+a+")";break;case"ROOT":c="Math.sqrt("+a+")";break;case"LN":c="Math.log("+a+")";break;case"EXP":c="Math.exp("+a+")";break;case"POW10":c="Math.pow(10,"+a+")";break;case"ROUND":c="Math.round("+a+")";break;case"ROUNDUP":c="Math.ceil("+a+")";break;case"ROUNDDOWN":c="Math.floor("+a+")";break;case"SIN":c="Math.sin("+a+" / 180 * Math.PI)";break;case"COS":c="Math.cos("+a+" / 180 * Math.PI)";break;case"TAN":c="Math.tan("+a+" / 180 * Math.PI)"}if(c)return[c,Blockly.JavaScript.ORDER_FUNCTION_CALL];switch(b){case"LOG10":c="Math.log("+a+") / Math.log(10)";break;case"ASIN":c="Math.asin("+a+") / Math.PI * 180";break;case"ACOS":c="Math.acos("+a+") / Math.PI * 180";break;case"ATAN":c="Math.atan("+a+") / Math.PI * 180";break;default:throw Error("Unknown math operator: "+b)}return[c,Blockly.JavaScript.ORDER_DIVISION]},Blockly.JavaScript.math_constant=function(a){return{PI:["Math.PI",Blockly.JavaScript.ORDER_MEMBER],E:["Math.E",Blockly.JavaScript.ORDER_MEMBER],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",Blockly.JavaScript.ORDER_DIVISION],SQRT2:["Math.SQRT2",Blockly.JavaScript.ORDER_MEMBER],SQRT1_2:["Math.SQRT1_2",Blockly.JavaScript.ORDER_MEMBER],INFINITY:["Infinity",Blockly.JavaScript.ORDER_ATOMIC]}[a.getFieldValue("CONSTANT")]},Blockly.JavaScript.math_number_property=function(a){var b=Blockly.JavaScript.valueToCode(a,"NUMBER_TO_CHECK",Blockly.JavaScript.ORDER_MODULUS)||"0",c=a.getFieldValue("PROPERTY");if("PRIME"==c)return[Blockly.JavaScript.provideFunction_("mathIsPrime",["function "+Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(n) {"," // https://en.wikipedia.org/wiki/Primality_test#Naive_methods"," if (n == 2 || n == 3) {"," return true;"," }"," // False if n is NaN, negative, is 1, or not whole."," // And false if n is divisible by 2 or 3."," if (isNaN(n) || n <= 1 || n % 1 != 0 || n % 2 == 0 || n % 3 == 0) {"," return false;"," }"," // Check all the numbers of form 6k +/- 1, up to sqrt(n)."," for (var x = 6; x <= Math.sqrt(n) + 1; x += 6) {"," if (n % (x - 1) == 0 || n % (x + 1) == 0) {"," return false;"," }"," }"," return true;","}"])+"("+b+")",Blockly.JavaScript.ORDER_FUNCTION_CALL];switch(c){case"EVEN":var d=b+" % 2 == 0";break;case"ODD":d=b+" % 2 == 1";break;case"WHOLE":d=b+" % 1 == 0";break;case"POSITIVE":d=b+" > 0";break;case"NEGATIVE":d=b+" < 0";break;case"DIVISIBLE_BY":d=b+" % "+(a=Blockly.JavaScript.valueToCode(a,"DIVISOR",Blockly.JavaScript.ORDER_MODULUS)||"0")+" == 0"}return[d,Blockly.JavaScript.ORDER_EQUALITY]},Blockly.JavaScript.math_change=function(a){var b=Blockly.JavaScript.valueToCode(a,"DELTA",Blockly.JavaScript.ORDER_ADDITION)||"0";return(a=Blockly.JavaScript.variableDB_.getName(a.getFieldValue("VAR"),Blockly.VARIABLE_CATEGORY_NAME))+" = (typeof "+a+" == 'number' ? "+a+" : 0) + "+b+";\n"},Blockly.JavaScript.math_round=Blockly.JavaScript.math_single,Blockly.JavaScript.math_trig=Blockly.JavaScript.math_single,Blockly.JavaScript.math_on_list=function(a){var b=a.getFieldValue("OP");switch(b){case"SUM":a=Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_MEMBER)||"[]",a+=".reduce(function(x, y) {return x + y;})";break;case"MIN":a="Math.min.apply(null, "+(a=Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_NONE)||"[]")+")";break;case"MAX":a="Math.max.apply(null, "+(a=Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_NONE)||"[]")+")";break;case"AVERAGE":a=(b=Blockly.JavaScript.provideFunction_("mathMean",["function "+Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(myList) {"," return myList.reduce(function(x, y) {return x + y;}) / myList.length;","}"]))+"("+(a=Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_NONE)||"[]")+")";break;case"MEDIAN":a=(b=Blockly.JavaScript.provideFunction_("mathMedian",["function "+Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(myList) {"," var localList = myList.filter(function (x) {return typeof x == 'number';});"," if (!localList.length) return null;"," localList.sort(function(a, b) {return b - a;});"," if (localList.length % 2 == 0) {"," return (localList[localList.length / 2 - 1] + localList[localList.length / 2]) / 2;"," } else {"," return localList[(localList.length - 1) / 2];"," }","}"]))+"("+(a=Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_NONE)||"[]")+")";break;case"MODE":a=(b=Blockly.JavaScript.provideFunction_("mathModes",["function "+Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(values) {"," var modes = [];"," var counts = [];"," var maxCount = 0;"," for (var i = 0; i < values.length; i++) {"," var value = values[i];"," var found = false;"," var thisCount;"," for (var j = 0; j < counts.length; j++) {"," if (counts[j][0] === value) {"," thisCount = ++counts[j][1];"," found = true;"," break;"," }"," }"," if (!found) {"," counts.push([value, 1]);"," thisCount = 1;"," }"," maxCount = Math.max(thisCount, maxCount);"," }"," for (var j = 0; j < counts.length; j++) {"," if (counts[j][1] == maxCount) {"," modes.push(counts[j][0]);"," }"," }"," return modes;","}"]))+"("+(a=Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_NONE)||"[]")+")";break;case"STD_DEV":a=(b=Blockly.JavaScript.provideFunction_("mathStandardDeviation",["function "+Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(numbers) {"," var n = numbers.length;"," if (!n) return null;"," var mean = numbers.reduce(function(x, y) {return x + y;}) / n;"," var variance = 0;"," for (var j = 0; j < n; j++) {"," variance += Math.pow(numbers[j] - mean, 2);"," }"," variance = variance / n;"," return Math.sqrt(variance);","}"]))+"("+(a=Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_NONE)||"[]")+")";break;case"RANDOM":a=(b=Blockly.JavaScript.provideFunction_("mathRandomList",["function "+Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(list) {"," var x = Math.floor(Math.random() * list.length);"," return list[x];","}"]))+"("+(a=Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_NONE)||"[]")+")";break;default:throw Error("Unknown operator: "+b)}return[a,Blockly.JavaScript.ORDER_FUNCTION_CALL]},Blockly.JavaScript.math_modulo=function(a){return[(Blockly.JavaScript.valueToCode(a,"DIVIDEND",Blockly.JavaScript.ORDER_MODULUS)||"0")+" % "+(a=Blockly.JavaScript.valueToCode(a,"DIVISOR",Blockly.JavaScript.ORDER_MODULUS)||"0"),Blockly.JavaScript.ORDER_MODULUS]},Blockly.JavaScript.math_constrain=function(a){return["Math.min(Math.max("+(Blockly.JavaScript.valueToCode(a,"VALUE",Blockly.JavaScript.ORDER_NONE)||"0")+", "+(Blockly.JavaScript.valueToCode(a,"LOW",Blockly.JavaScript.ORDER_NONE)||"0")+"), "+(a=Blockly.JavaScript.valueToCode(a,"HIGH",Blockly.JavaScript.ORDER_NONE)||"Infinity")+")",Blockly.JavaScript.ORDER_FUNCTION_CALL]},Blockly.JavaScript.math_random_int=function(a){var b=Blockly.JavaScript.valueToCode(a,"FROM",Blockly.JavaScript.ORDER_NONE)||"0";return a=Blockly.JavaScript.valueToCode(a,"TO",Blockly.JavaScript.ORDER_NONE)||"0",[Blockly.JavaScript.provideFunction_("mathRandomInt",["function "+Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(a, b) {"," if (a > b) {"," // Swap a and b to ensure a is smaller."," var c = a;"," a = b;"," b = c;"," }"," return Math.floor(Math.random() * (b - a + 1) + a);","}"])+"("+b+", "+a+")",Blockly.JavaScript.ORDER_FUNCTION_CALL]},Blockly.JavaScript.math_random_float=function(a){return["Math.random()",Blockly.JavaScript.ORDER_FUNCTION_CALL]},Blockly.JavaScript.math_atan2=function(a){var b=Blockly.JavaScript.valueToCode(a,"X",Blockly.JavaScript.ORDER_NONE)||"0";return["Math.atan2("+(Blockly.JavaScript.valueToCode(a,"Y",Blockly.JavaScript.ORDER_NONE)||"0")+", "+b+") / Math.PI * 180",Blockly.JavaScript.ORDER_DIVISION]},Blockly.JavaScript.procedures={},Blockly.JavaScript.procedures_defreturn=function(a){var b=Blockly.JavaScript.variableDB_.getName(a.getFieldValue("NAME"),Blockly.PROCEDURE_CATEGORY_NAME),c="";Blockly.JavaScript.STATEMENT_PREFIX&&(c+=Blockly.JavaScript.injectId(Blockly.JavaScript.STATEMENT_PREFIX,a)),Blockly.JavaScript.STATEMENT_SUFFIX&&(c+=Blockly.JavaScript.injectId(Blockly.JavaScript.STATEMENT_SUFFIX,a));var c=c&&Blockly.JavaScript.prefixLines(c,Blockly.JavaScript.INDENT),d="";Blockly.JavaScript.INFINITE_LOOP_TRAP&&(d=Blockly.JavaScript.prefixLines(Blockly.JavaScript.injectId(Blockly.JavaScript.INFINITE_LOOP_TRAP,a),Blockly.JavaScript.INDENT));for(var e=Blockly.JavaScript.statementToCode(a,"STACK"),f=Blockly.JavaScript.valueToCode(a,"RETURN",Blockly.JavaScript.ORDER_NONE)||"",g=e&&f?c:"",f=f&&Blockly.JavaScript.INDENT+"return "+f+";\n",h=[],l=a.getVars(),k=0;k{const block=itemProcessor.call(thisArg,i);return block.next=acc,block};items.reduceRight(linearise,null)&&this.statements.set(name,items.reduceRight(linearise,null))}asDom(document){const blockElement=document.createElement("block");blockElement.setAttribute("type",`sparql11_${this.type}`);for(var[name,value]of this.values){const valueElement=document.createElement("value");valueElement.setAttribute("name",name);var valueDom=value.asDom(document);valueElement.appendChild(valueDom),blockElement.appendChild(valueElement)}for(var[name,value]of this.fields){const valueElement=document.createElement("field");valueElement.setAttribute("name",name),valueElement.textContent=value,blockElement.appendChild(valueElement)}for(var[name,statementDom]of this.statements){const statementElement=document.createElement("statement");statementElement.setAttribute("name",name),statementDom=statementDom.asDom(document),statementElement.appendChild(statementDom),blockElement.appendChild(statementElement)}if(this.next){const nextElement=document.createElement("next");var nextDom=this.next.asDom(document);nextElement.appendChild(nextDom),blockElement.appendChild(nextElement)}return blockElement}}},{}],31:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const SparqlJS=require("sparqljs"),Block_1=require("./Block"),StringifiedMap_1=require("./StringifiedMap"),TermSet=require("@rdfjs/term-set"),TermMap=require("@rdfjs/term-map");class BlockGenerator{constructor(){this.prefixes=new Map}visit(query){switch(query.type){case"query":return this.query(query);case"update":return this.update(query)}}query(query){const block=new Block_1.Block("query");return block.addItems("prologue",BlockGenerator.getPrologueItems(query),this.prologueItem,this),block.addValue("value",this[query.queryType.toLowerCase()](query)),query.values&&block.addValue("values",this.values(query.values)),block}select(query){const block=new Block_1.Block("selectquery");return block.addValue("select",this.selectClause(query)),block.addValue("where",this.queryCommon(query)),block}construct(query){var template=BlockGenerator.normalisePatterns([{triples:query.template,type:"bgp"}]);if(BlockGenerator.isSimpleConstruct(query)){const block=new Block_1.Block("simpleconstructquery");return block.addValue("modifiers",this.solutionModifiers(query)),block.addItems("where",[...template],this.triplesSameSubjectItem,this),query.from&&this.dataset(block,query.from),block}{const block=new Block_1.Block("constructquery");return block.addValue("where",this.queryCommon(query)),block.addItems("template",[...template],this.triplesSameSubjectItem,this),block}}describe(query){var variables=query.variables;const block=new Block_1.Block("describequery");return query.where&&block.addValue("where",this.queryCommon(query)),BlockGenerator.isWildcard(variables)?block.addField("star","*"):block.addItems("template",variables,this.varOrIriItem,this),block}ask(query){return new Block_1.Block("askquery",this.queryCommon(query))}update(query){const block=new Block_1.Block("update");return block.addItems("prologue",BlockGenerator.getPrologueItems(query),this.prologueItem,this),block.addItems("items",query.updates,this.updateItem,this),block}updateItem(update){return"type"in update?new Block_1.Block("updateitem",this.managementOperation(update)):new Block_1.Block("updateitem",this.insertDeleteOperation(update))}managementOperation(update){switch(update.type){case"clear":case"drop":return this.clearDrop(update);case"add":case"move":case"copy":return this.addMoveCopy(update);case"load":return this.load(update);case"create":return this.create(update)}}insertDeleteOperation(update){switch(update.updateType){case"insert":case"delete":case"deletewhere":return this.insertDeleteWhere(update);case"insertdelete":return this.modify(update)}}clearDrop(update){const block=new Block_1.Block("cleardrop");return block.addValue("graph",this.graphRefAll(update.graph)),block.addField("operator",update.type.toUpperCase()),update.silent&&block.addField("silent","SILENT"),block}addMoveCopy(update){const block=new Block_1.Block("addmovecopy");return block.addValue("source",this.graphRefAll(update.source)),block.addValue("destination",this.graphRefAll(update.destination)),block.addField("operator",update.type.toUpperCase()),update.silent&&block.addField("silent","SILENT"),block}load(update){const block=new Block_1.Block("load");return block.addValue("source",this.namedNode(update.source)),update.destination&&block.addValue("destination",this.graphRef(update.destination)),update.silent&&block.addField("silent","silent"),block}create(update){const block=new Block_1.Block("create");return block.addValue("graph",this.graphRef(update.graph.name)),update.silent&&block.addField("silent","silent"),block}insertDeleteWhere(update){var _a;const block=new Block_1.Block("insertdeletewhere");return block.addValue("pattern",this.quadPattern(null!==(_a=update.insert)&&void 0!==_a?_a:update.delete)),block.addField("operator",update.updateType.replace("insert","INSERT DATA").replace("deletewhere","DELETE WHERE").replace("delete","DELETE DATA")),block}quadPattern(items){const block=new Block_1.Block("quadpattern");return block.addItems("items",[...BlockGenerator.normaliseQuads(items)],this.quadPatternItem,this),block}quadPatternItem(item){return"triplesSameSubject"===item.type?new Block_1.Block("quadpatternitem",this.triplesSameSubject(item)):new Block_1.Block("quadpatternitem",this.quadsNotTriples(item))}quadsNotTriples(item){const results=[];for(var[subject,predicates]of BlockGenerator.toTriplesSameSubject(item.triples))results.push({type:"triplesSameSubject",subject:subject,predicates:predicates});const block=new Block_1.Block("quadsnottriples");return block.addValue("name",this.term(item.name)),block.addItems("triples",results,this.triplesSameSubjectItem,this),block}modify(update){const block=new Block_1.Block("modify");return update.graph&&block.addValue("iri",this.namedNode(update.graph)),update.delete.length&&block.addValue("delete",this.quadPattern(update.delete)),update.insert.length&&block.addValue("insert",this.quadPattern(update.insert)),block.addValue("where",this.group(update.where)),update.using&&this.usings(block,update.using),block}graphRefAll(graph){return graph.name?this.graphRef(graph.name):graph.all?new Block_1.Block("graphrefallall"):graph.default?new Block_1.Block("graphordefault"):graph.named?new Block_1.Block("graphrefallnamed"):void 0}graphRef(iri){return new Block_1.Block("graphref",this.namedNode(iri))}usings(block,from){var convert=(isNamed,iri)=>[isNamed,iri],namedGraphs=from.named.map(convert.bind(null,!0));const iris=from.default.map(convert.bind(null,!1));block.addItems("using",iris.concat(namedGraphs),this.using,this)}using([isNamed,iri]){return isNamed?new Block_1.Block("usingclause",this.named(iri)):new Block_1.Block("usingclause",this.namedNode(iri))}pattern(pattern){if("queryType"in pattern)return this.subSelect(pattern);switch(pattern.type){case"group":return this.group(pattern.patterns);case"values":return this.values(pattern.values);default:return this[pattern.type](pattern)}}group(normalisedPatterns){normalisedPatterns=BlockGenerator.normalisePatterns(normalisedPatterns);return 0===normalisedPatterns.size?new Block_1.Block("groupgraphpattern"):isSingle(normalisedPatterns)?new Block_1.Block("groupgraphpattern",this.pattern(first(normalisedPatterns))):1","<=",">=","in","notin","!","+","UMINUS","*","/"].includes(pattern.expression.operator)?new Block_1.Block("filter",this.bracketted(pattern.expression)):new Block_1.Block("filter",this.expression(pattern.expression))}minus(pattern){return new Block_1.Block("minusgraphpattern",this.group(pattern.patterns))}union(pattern){const block=new Block_1.Block("grouporuniongraphpattern");return block.addItems("items",pattern.patterns,this.groupItem,this),block}triplesSameSubject(pattern){const block=new Block_1.Block("triplessamesubject");return block.addValue("subject",this.term(pattern.subject)),block.addItems("predicates",[...pattern.predicates.entries()],this.propertyList,this),block}subSelect(query){const block=new Block_1.Block("subselect");return block.addValue("select",this.selectClause(query)),block.addValue("pattern",this.group(query.where)),query.values&&block.addValue("values",this.values(query.values)),block.addValue("modifiers",this.solutionModifiers(query)),block}solutionModifiers(query){if(query.group||query.having||query.order||"limit"in query||"offset"in query){const block=new Block_1.Block("solutionmodifier");return"limit"in query&&block.addValue("limit",this.numeric(query.limit.toString())),"offset"in query&&block.addValue("offset",this.numeric(query.offset.toString())),query.group&&block.addItems("group",query.group,this.groupingItem,this),query.having&&block.addItems("having",query.having,this.havingItem,this),query.order&&block.addItems("order",query.order,this.orderItem,this),block}}collection(pattern){const block=new Block_1.Block("collection");return block.addItems("items",pattern.items,this.graphNodeItem,this),block}verb(verb){return"pathType"in verb?this.path(verb):verb.value===RDF.type?new Block_1.Block("a"):this.term(verb)}path(path){switch(path.pathType){case"|":return this.pathAlternative(path);case"/":return this.pathSequence(path);case"^":return this.pathInverse(path);case"?":case"+":case"*":return this.pathModifier(path);case"!":return this.pathNegated(path)}}pathAlternative(path){const block=new Block_1.Block("pathalternative");return block.addItems("items",path.items,this.pathAlternativeItem,this),block}pathSequence(path){const block=new Block_1.Block("pathsequence");return block.addItems("items",path.items,this.pathSequenceItem,this),block}pathModifier(path){const block=new Block_1.Block("pathwithmodifier");var verb=first(path.items);return"pathType"in verb&&["/","|","^"].includes(verb.pathType)?block.addValue("value",this.brackettedPath(verb)):block.addValue("value",this.verb(verb)),block.addField("modifier",path.pathType),block}pathInverse(verb){const block=new Block_1.Block("inversepath");verb=first(verb.items);return"pathType"in verb&&["/","|"].includes(verb.pathType)?block.addValue("value",this.brackettedPath(verb)):block.addValue("value",this.verb(verb)),block}pathNegated(path){var verb=first(path.items);if(!("pathType"in verb))return this.verb(verb);switch(verb.pathType){case"|":return new Block_1.Block("negatedpath",this.pathOneInPropertySetAlternative(verb));case"^":return new Block_1.Block("negatedpath",this.inversePathOneInPropertySet(verb))}}inversePathOneInPropertySet(verb){return new Block_1.Block("inversepathoneinpropertyset",this.verb(first(verb.items)))}pathOneInPropertySetAlternative(verb){const block=new Block_1.Block("pathoneinpropertysetalternative");return block.addItems("items",verb.items,this.pathOneInPropertySetAlternativeItem,this),block}brackettedPath(verb){return new Block_1.Block("bracketedpath",this.verb(verb))}prefix([prefix,namespace]){return this.prefixes.set(namespace,prefix),prefix?this.prefixDecl(prefix,namespace):this.prefixDeclDefault(namespace)}prefixDecl(prefix,value){const block=new Block_1.Block("prefixdecl",this.iriref(value));return block.addField("prefix",prefix),block}prefixDeclDefault(value){return new Block_1.Block("prefixdecldefault",this.iriref(value))}base(value){return this.baseUri=value,new Block_1.Block("base",this.iriref(value))}queryCommon(query){const block=new Block_1.Block("querycommon");return block.addValue("pattern",this.group(query.where)),block.addValue("modifiers",this.solutionModifiers(query)),query.from&&this.dataset(block,query.from),block}dataset(block,from){var convert=(isNamed,iri)=>[isNamed,iri],namedGraphs=from.named.map(convert.bind(null,!0));const iris=from.default.map(convert.bind(null,!1));block.addItems("datasets",iris.concat(namedGraphs),this.from,this)}from([isNamed,iri]){return isNamed?new Block_1.Block("datasetclause",this.named(iri)):new Block_1.Block("datasetclause",this.namedNode(iri))}named(iri){return new Block_1.Block("namedgraphclause",this.namedNode(iri))}selectClause(variables){const block=new Block_1.Block("selectclause");variables.distinct&&block.addField("distinctOrReduced","DISTINCT"),variables.reduced&&block.addField("distinctOrReduced","REDUCED");variables=variables.variables;return BlockGenerator.isWildcard(variables)?block.addField("star","*"):block.addItems("vars",variables,this.varOrExpressionAsVarItem,this),block}values(rows){var variables=rows.reduce((a,b)=>Object.keys(b),[]).map(stringToVariable);const values=rows.map(Object.values);return isSingle(variables)?new Block_1.Block("inlinedata",this.inlineDataOneVar(first(variables),values.flat())):new Block_1.Block("inlinedata",this.inlineDataFull(variables,values))}inlineDataOneVar(variable,values){const block=new Block_1.Block("inlinedataonevar");return block.addValue("variable",this.variable(variable)),block.addItems("values",values.flat(),this.dataBlockValueItem,this),block}inlineDataFull(variables,values){const block=new Block_1.Block("inlinedatafull");return block.addItems("variables",variables,this.variableItem,this),block.addItems("values",values,this.dataBlockValuesItem,this),block}expressionAsVar(expression,variable){const block=new Block_1.Block("expressionasvar",this.expression(expression));return block.addValue("name",this.variable(variable)),block}descending(expression){const block=new Block_1.Block("ordercondition",this.bracketted(expression));return block.addField("operator","DESC"),block}expression(expression){return"type"in expression?this[expression.type](expression):"termType"in expression?this.term(expression):void 0}operation(expression){switch(expression.operator){case"||":case"&&":case"=":case"!=":case"<":case">":case"<=":case">=":case"+":case"-":case"*":case"/":case"!":case"UMINUS":return this.unibinary(expression);case"notin":case"in":return this.in(expression);case"bound":return this.bound(expression);case"exists":case"notexists":return this.exists(expression);case"concat":case"coalesce":return this.builtInCallN(expression);default:return this[`builtInCall${expression.args.length}`](expression)}}functionCall(expression){const block=new Block_1.Block("iriorfunction");return block.addValue("iri",this.namedNode(expression.function)),expression.distinct&&block.addField("distinct","DISTINCT"),block.addItems("args",expression.args,this.expressionListItem,this),block}aggregate(expression){switch(expression.aggregation){case"sum":case"min":case"max":case"avg":case"sample":return this.aggregateCommon(expression);default:return this[expression.aggregation](expression)}}exists(expression){const block=new Block_1.Block("exists");var arg=first(expression.args);return"group"===arg.type?block.addValue("value",this.pattern(arg)):block.addValue("value",this.group(expression.args)),block.addField("operator",expression.operator.toUpperCase().replace("NOTEXISTS","NOT EXISTS")),block}builtInCall0(expression){const block=new Block_1.Block("builtincall0");return block.addField("operator",expression.operator.toUpperCase()),block}builtInCall1(expression){const block=new Block_1.Block("builtincall1");return block.addValue("arg1",this.expression(first(expression.args))),block.addField("operator",expression.operator.toUpperCase()),block}builtInCall2(expression){const block=new Block_1.Block("builtincall2");return block.addValue("arg1",this.expression(expression.args[0])),block.addValue("arg2",this.expression(expression.args[1])),block.addField("operator",expression.operator.toUpperCase()),block}builtInCall3(expression){const block=new Block_1.Block("builtincall3");return block.addValue("arg1",this.expression(expression.args[0])),block.addValue("arg2",this.expression(expression.args[1])),block.addValue("arg3",this.expression(expression.args[2])),block.addField("operator",expression.operator.toUpperCase()),block}builtInCall4(expression){const block=new Block_1.Block("builtincall4");return block.addValue("arg1",this.expression(expression.args[0])),block.addValue("arg2",this.expression(expression.args[1])),block.addValue("arg3",this.expression(expression.args[2])),block.addValue("arg4",this.expression(expression.args[3])),block.addField("operator",expression.operator.toUpperCase()),block}builtInCallN(expression){const block=new Block_1.Block("builtincalln");return block.addField("operator",expression.operator.toUpperCase()),block.addItems("args",expression.args,this.expressionListItem,this),block}bound(expression){return new Block_1.Block("bound",this.expression(first(expression.args)))}bracketted(expression){return new Block_1.Block("brackettedexpression",this.expression(expression))}unibinary(expression,hierarchy=BlockGenerator.hierarchy){const[name,definition]=deconstruct(hierarchy);if(definition.operators.includes(expression.operator)){const block=new Block_1.Block(name);return block.addValue("left",this.bracketArgument(expression.args[0],definition)),1items.push(entry)),items}static isWildcard(variables){return variables[0]instanceof SparqlJS.Wildcard}static toTriplesSameSubject(triples){return triples.reduce((subjects,triple)=>{subjects.has(triple.subject)||subjects.set(triple.subject,new StringifiedMap_1.StringifiedMap);const subject=subjects.get(triple.subject);subject.has(triple.predicate)||subject.set(triple.predicate,new TermSet);const predicate=subject.get(triple.predicate);return predicate.add(triple.object),subjects},new TermMap)}static normalisePatterns(patterns){return Array.from(patterns).reduce((results,pattern)=>{var _a,subject,predicates;if("bgp"===pattern.type)for([subject,predicates]of this.toTriplesSameSubject(null!==(_a=pattern.triples)&&void 0!==_a?_a:[]))results.add({type:"triplesSameSubject",subject:subject,predicates:predicates});else results.add(pattern);return results},new Set)}static normaliseQuads(quads){return quads.reduce((results,pattern)=>{var subject,predicates;if("bgp"===pattern.type)for([subject,predicates]of this.toTriplesSameSubject(pattern.triples))results.add({type:"triplesSameSubject",subject:subject,predicates:predicates});else results.add(pattern);return results},new Set)}}var RDF,XSD;function stringToVariable(s){return{value:s.replace("?",""),termType:null,equals:null}}function isSingle(collection){return collection instanceof Array?1===collection.length:1===collection.size}function first(collection){return collection instanceof Array?collection[0]:collection.values().next().value}function deconstruct(hierarchy){return first(Object.entries(hierarchy))}exports.default=BlockGenerator,BlockGenerator.hierarchy={unaryexpression:{operators:["UMINUS","!"],higher:{multiplicativeexpression:{operators:["*","/"],higher:{additiveexpression:{operators:["+","-"],higher:{relationalexpression:{operators:["=","!=","<",">","<=",">="],higher:{conditionalandexpression:{operators:["&&"],higher:{conditionalorexpression:{operators:["||"]}}}}}}}}}}}},function(RDF){RDF.type="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",RDF.langString="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",RDF.nil="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil",RDF.first="http://www.w3.org/1999/02/22-rdf-syntax-ns#first",RDF.rest="http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"}(RDF=RDF||{}),function(XSD){XSD.string="http://www.w3.org/2001/XMLSchema#string",XSD.integer="http://www.w3.org/2001/XMLSchema#integer",XSD.decimal="http://www.w3.org/2001/XMLSchema#decimal",XSD.double="http://www.w3.org/2001/XMLSchema#double",XSD.boolean="http://www.w3.org/2001/XMLSchema#boolean"}(XSD=XSD||{})},{"./Block":30,"./StringifiedMap":33,"@rdfjs/term-map":1,"@rdfjs/term-set":2,sparqljs:39}],32:[function(Blockly,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Order=void 0;var Order,Blockly=Blockly("blockly");function codeTuple(code){return[code,Order.None]}function join(delimiter,...clauses){return clauses.filter(Boolean).join(delimiter)}function joinO(delimiter,...clauses){return clauses.filter(clause=>clause instanceof Array?clause[0]:clause).map(clause=>clause instanceof Array?clause[1]:clause).join(delimiter)}function prefixedName(prefix,localName){return codeTuple(`${prefix}:${localName}`)}function iriref(value=""){return codeTuple(`<${value}>`)}!function(Order){Order[Order.None=0]="None",Order[Order.Atomic=1]="Atomic"}(Order=exports.Order||(exports.Order={}));class CodeGenerator extends Blockly.Generator{constructor(){super("SPARQL 1.1"),this.INDENT="",this.addCodeGeneratorProperties()}addCodeGeneratorProperties(){const toWrappedGenerator=generatorName=>block=>this[generatorName](block);Object.getOwnPropertyNames(CodeGenerator.prototype).filter(name=>name.startsWith("sparql")).map(generatorName=>[generatorName.replace("sparql","sparql11_").toLowerCase(),generatorName]).map(([propertyName,generatorName])=>[propertyName,toWrappedGenerator(generatorName)]).forEach(([propertyName,generatorFunction])=>this[propertyName]=generatorFunction)}sparqlQuery(block){return join("\n\n",this.statementToCode(block,"prologue"),join("\n",this.valueToCode(block,"value"),this.valueToCode(block,"values")))}sparqlSelectQuery(block){return codeTuple(join("\n",this.valueToCode(block,"select"),this.valueToCode(block,"where")))}sparqlDescribeQuery(where){var star=where.getFieldValue("star"),subject=this.statementToCode(where,"subject"),where=this.valueToCode(where,"where");return codeTuple(join("\n",join(" ","DECRIBE",star,subject),where))}sparqlAskQuery(block){return codeTuple(join(" ","ASK",this.valueToCode(block,"value")))}sparqlSimpleConstructquery(modifiers){var datasets=this.statementToCode(modifiers,"datasets"),where=this.statementToCode(modifiers,"where"),modifiers=this.valueToCode(modifiers,"modifiers");return codeTuple(join("\n","CONSTRUCT",datasets,join("\n","WHERE {",this.indent(where),"}"),modifiers))}sparqlConstructQuery(where){var template=this.statementToCode(where,"template"),where=this.valueToCode(where,"where");return codeTuple(join("\n",join("\n","CONSTRUCT {",this.indent(template),"}"),where))}sparqlUpdate(block){return join("\n\n",this.statementToCode(block,"prologue"),this.statementToCode(block,"items"))}sparqlLoad(destination){var source=this.valueToCode(destination,"source"),silent=destination.getFieldValue("silent"),destination=this.valueToCode(destination,"destination");return codeTuple(joinO(" ",[!0,join(" ","LOAD",silent,source)],[destination,join(" ","INTO",destination)]))}sparqlGraphRef(block){return codeTuple(join(" ","GRAPH",this.valueToCode(block,"value")))}sparqlCreate(block){return codeTuple(join(" ","CREATE",block.getFieldValue("silent"),this.valueToCode(block,"graph")))}sparqlAddMoveCopy(block){return codeTuple(join(" ",block.getFieldValue("operator"),block.getFieldValue("silent"),this.valueToCode(block,"source"),"TO",this.valueToCode(block,"destination")))}sparqlClearDrop(block){return codeTuple(join(" ",block.getFieldValue("operator"),block.getFieldValue("silent"),this.valueToCode(block,"graph")))}sparqlQuadPattern(items){items=this.statementToCode(items,"items");return codeTuple(join("\n","{",this.indent(items),"}"))}sparqlInsertDeleteWhere(block){return codeTuple(join(" ",block.getFieldValue("operator"),this.valueToCode(block,"pattern")))}sparqlModify(where){var iri=this.valueToCode(where,"iri"),deleteClause=this.valueToCode(where,"delete"),insert=this.valueToCode(where,"insert"),using=this.statementToCode(where,"using"),where=this.valueToCode(where,"where");return codeTuple(joinO("\n",[iri,join(" ","WITH",iri)],[deleteClause,join(" ","DELETE",deleteClause)],[insert,join(" ","INSERT",insert)],using,join(" ","WHERE",where)))}sparqlUsingClause(block){var code=join(" ","USING",this.valueToCode(block,"value"));return this.generateNext(block,code,"\n")}sparqlGraphOrDefault(){return codeTuple("DEFAULT")}sparqlQuadsNotTriples(triples){var name=this.valueToCode(triples,"name"),triples=this.statementToCode(triples,"triples");return codeTuple(join(" ","GRAPH",name,join("\n","{",this.indent(triples),"}")))}sparqlSelectClause(block){return codeTuple(join(" ","SELECT",block.getFieldValue("distinctOrReduced"),block.getFieldValue("star"),this.statementToCode(block,"vars")))}sparqlExpressionAsVar(block){return codeTuple(`(${this.valueToCode(block,"value")} AS ${this.valueToCode(block,"name")})`)}sparqlQueryCommon(modifiers){var datasets=this.statementToCode(modifiers,"datasets"),pattern=this.valueToCode(modifiers,"pattern"),modifiers=this.valueToCode(modifiers,"modifiers");return codeTuple(join("\n",datasets,join(" ","WHERE",pattern),modifiers))}sparqlGroupGraphPattern(value){value=this.valueToCode(value,"value");return codeTuple(join("\n","{",this.indent(value),"}"))}sparqlSubSelect(block){var select=this.valueToCode(block,"select"),pattern=this.valueToCode(block,"pattern"),values=this.valueToCode(block,"values");return codeTuple(join("\n",select,`WHERE ${pattern}`,this.valueToCode(block,"modifiers"),values))}sparqlTriplesSameSubject(_a){var subject=this.valueToCode(_a,"subject"),predicates=this.statementToCode(_a,"predicates");let code;return code=null!==(_a=_a.getInputTargetBlock("predicates"))&&void 0!==_a&&_a.getNextBlock()?join("\n",subject,this.indent(predicates)):join(" ",subject,predicates),codeTuple(code)}sparqlPropertyListNotEmpty(block){var code=join(" ",this.valueToCode(block,"predicate"),this.statementToCode(block,"objects"));return this.generateNext(block,code," ;\n")}sparqlGroupGraphPatternSub(block){return codeTuple(this.statementToCode(block,"items"))}sparqlBlankNodePropertyList(predicates){const p=predicates.getInputTargetBlock("predicates");predicates=this.blockToCode(p);let code;return code=p&&p.getNextBlock()?join("\n","[",this.indent(predicates),"]"):join(" ","[",predicates,"]"),codeTuple(code)}sparqlCollection(block){return codeTuple(join("","(",this.statementToCode(block,"items"),")"))}sparqlOptionalGraphPattern(block){return codeTuple(join(" ","OPTIONAL",this.valueToCode(block,"value")))}sparqlGraphGraphPattern(block){return codeTuple(join(" ","GRAPH",this.valueToCode(block,"iri"),this.valueToCode(block,"patterns")))}sparqlServiceGraphPattern(block){var iri=this.valueToCode(block,"iri");return codeTuple(join(" ","SERVICE",block.getFieldValue("silent"),iri,this.valueToCode(block,"patterns")))}sparqlMinusGraphPattern(block){return codeTuple(join(" ","MINUS",this.valueToCode(block,"value")))}sparqlFilter(block){return codeTuple(join(" ","FILTER",this.valueToCode(block,"value")))}sparqlBind(block){return codeTuple(join(" ","BIND",this.valueToCode(block,"value")))}sparqlGroupOrUnionGraphPattern(block){return codeTuple(join("",...this.statementToCode(block,"items")))}sparqlPrefixDecl(block){return codeTuple(`PREFIX ${block.getFieldValue("prefix")}: ${this.valueToCode(block,"value")}`)}sparqlPrefixDeclDefault(block){return codeTuple(`PREFIX : ${this.valueToCode(block,"value")}`)}sparqlBase(block){return codeTuple(`BASE ${this.valueToCode(block,"value")}`)}sparqlNamedGraphClause(block){return codeTuple(`NAMED ${this.valueToCode(block,"value")}`)}sparqlSolutionModifier(offset){var group=this.statementToCode(offset,"group"),having=this.statementToCode(offset,"having"),order=this.statementToCode(offset,"order"),limit=this.valueToCode(offset,"limit"),offset=this.valueToCode(offset,"offset");return codeTuple(joinO("\n",[group,`GROUP BY ${group}`],[having,`HAVING ${having}`],[order,`ORDER BY ${order}`],[limit,`LIMIT ${limit}`],[offset,`OFFSET ${offset}`]))}sparqlOrdercondition(block){return codeTuple(join("",block.getFieldValue("operator"),this.valueToCode(block,"value")))}sparqlInlineData(block){return codeTuple(join(" ","VALUES",this.valueToCode(block,"value")))}sparqlInlineDataOneVar(block){return codeTuple(join(" ",this.valueToCode(block,"variable"),join(" ","{",this.statementToCode(block,"values")," }")))}sparqlInlineDataFull(values){var variables=this.statementToCode(values,"variables"),values=this.statementToCode(values,"values");return codeTuple(join(" ",join("","(",variables,")"),join("\n","{",this.indent(values),"}")))}sparqlA(){return codeTuple("a")}sparqlNegatedPath(block){return codeTuple(join("","!",this.valueToCode(block,"value")))}sparqlBracketedPath(block){return codeTuple(join("","(",this.valueToCode(block,"value"),")"))}sparqlPathWithModifier(block){var modifier=block.getFieldValue("modifier");return codeTuple(join("",this.valueToCode(block,"value"),modifier))}sparqlInversePath(block){return codeTuple(join("","^",this.valueToCode(block,"value")))}sparqlPathAlternative(block){return codeTuple(this.statementToCode(block,"items"))}sparqlPathSequence(block){return codeTuple(this.statementToCode(block,"items"))}sparqlInversePathOneInPropertySet(block){return codeTuple(join("","^",this.valueToCode(block,"value")))}sparqlPathOneInPropertySetAlternative(block){return codeTuple(join("","(",this.statementToCode(block,"items"),")"))}sparqlIrirefDefault(){return iriref()}sparqlIriref(block){return iriref(block.getFieldValue("value"))}sparqlPrefixedName(){return prefixedName("","")}sparqlPrefixedNamePrefix(block){return prefixedName(block.getFieldValue("prefix"),"")}sparqlPrefixedNameLocalName(block){return prefixedName("",block.getFieldValue("localName"))}sparqlPrefixedNamePrefixLocalName(block){return prefixedName(block.getFieldValue("prefix"),block.getFieldValue("localName"))}sparqlString(block){let value=block.getFieldValue("value"),delimiter="'";return-1delimiter).join("")),codeTuple(`${delimiter}${value}${delimiter}`)}sparqlTypedLiteral(block){return codeTuple(`${this.valueToCode(block,"value")}^^${this.valueToCode(block,"datatype")}`)}sparqlLangString(block){return codeTuple(`${this.valueToCode(block,"value")}@${block.getFieldValue("language")}`)}sparqlNumericLiteral(block){const value=block.getFieldValue("value");return codeTuple(value.toString())}sparqlBooleanLiteral(block){return codeTuple(("TRUE"===block.getFieldValue("value")).toString())}sparqlVar1(block){return this.var(block,"?")}sparqlVar2(block){return this.var(block,"$")}sparqlUndef(){return codeTuple("UNDEF")}sparqlNil(){return codeTuple("()")}sparqlAnon(){return codeTuple("[]")}sparqlBlankNodeLabel(block){return codeTuple(`_:${block.getFieldValue("value")}`)}sparqlGraphRefAllDefault(){return codeTuple("DEFAULT")}sparqlGraphRefAllNamed(){return codeTuple("NAMED")}sparqlGraphRefAllAll(){return codeTuple("ALL")}sparqlBrackettedExpression(block){return codeTuple(`(${this.valueToCode(block,"value")})`)}sparqlBuiltinCall1(block){return codeTuple(`${block.getFieldValue("operator")}(${this.valueToCode(block,"arg1")})`)}sparqlBuiltinCall0(block){return codeTuple(`${block.getFieldValue("operator")}()`)}sparqlBuiltinCall2(block){return codeTuple(`${block.getFieldValue("operator")}(${this.valueToCode(block,"arg1")}, ${this.valueToCode(block,"arg2")})`)}sparqlBuiltinCall4(block){return codeTuple(`${block.getFieldValue("operator")}(${this.valueToCode(block,"arg1")}, ${this.valueToCode(block,"arg2")}, ${this.valueToCode(block,"arg3")}, ${this.valueToCode(block,"arg4")})`)}sparqlBuiltinCall3(block){return codeTuple(`${block.getFieldValue("operator")}(${this.valueToCode(block,"arg1")}, ${this.valueToCode(block,"arg2")}, ${this.valueToCode(block,"arg3")})`)}sparqlBuiltinCallN(block){return codeTuple(`${block.getFieldValue("operator")}(${this.statementToCode(block,"args")})`)}sparqlAdditiveExpression(block){var left=this.valueToCode(block,"left"),right=this.valueToCode(block,"right");return codeTuple(join(" ",left,block.getFieldValue("operator"),right))}sparqlMultiplicativeExpression(block){var left=this.valueToCode(block,"left"),right=this.valueToCode(block,"right");return codeTuple(join(" ",left,block.getFieldValue("operator"),right))}sparqlRelationalExpression(block){var left=this.valueToCode(block,"left"),right=this.valueToCode(block,"right");return codeTuple(join(" ",left,block.getFieldValue("operator"),right))}sparqlConditionalAndExpression(block){return codeTuple(join(" ",this.valueToCode(block,"left"),"&&",this.valueToCode(block,"right")))}sparqlConditionalOrExpression(block){return codeTuple(join(" ",this.valueToCode(block,"left"),"||",this.valueToCode(block,"right")))}sparqlRelationalExpressionIn(block){var left=this.valueToCode(block,"left"),right=this.statementToCode(block,"right");return codeTuple(join(" ",left,join("",block.getFieldValue("operator")," (",right,")")))}sparqlUnaryexpression(left){const operator=left.getFieldValue("operator");left=this.valueToCode(left,"left");return codeTuple(join("",operator.replace("UMINUS","-"),left))}sparqlIriOrFunction(block){return codeTuple(join("",this.valueToCode(block,"iri"),"(",join(" ",block.getFieldValue("distinct"),this.statementToCode(block,"args")),")"))}sparqlBound(block){return codeTuple(join("","BOUND(",this.valueToCode(block,"value"),")"))}sparqlExists(block){return codeTuple(join(" ",block.getFieldValue("operator"),this.valueToCode(block,"value")))}sparqlAggregate(block){return codeTuple(join("",block.getFieldValue("operator"),"(",join(" ",block.getFieldValue("distinct"),this.valueToCode(block,"arg1")),")"))}sparqlCount(block){var arg1=this.valueToCode(block,"arg1");return codeTuple(join("","COUNT(",join(" ",block.getFieldValue("distinct"),block.getFieldValue("star"),arg1),")"))}sparqlGroup_Concat(separator){var arg1=this.valueToCode(separator,"arg1"),distinct=separator.getFieldValue("distinct"),separator=this.valueToCode(separator,"separator");return codeTuple(joinO("","GROUP_CONCAT(",join(" ",distinct,arg1),["' '"!==separator,join(" ","; SEPARATOR =",separator)],")"))}sparqlEmbTp(block){return codeTuple(joinO(" ","<<",this.valueToCode(block,"subject"),this.valueToCode(block,"predicate"),this.valueToCode(block,"object"),">>"))}sparqlObjectListItemAnootationPattern(block){var value=this.valueToCode(block,"value"),code=this.statementToCode(block,"annotations"),code=join(" ",value,join("\n","{|",this.indent(code),"|}"));return this.generateNext(block,code,", ")}sparqlVarOrExpressionAsVarItem(block){return this.item(" ",block)}sparqlObjectListItem(block){return this.item(", ",block)}sparqlGroupGraphPatternSubItem(block){return this.item(" .\n",block)}sparqlPrologueItem(block){return this.item("\n",block)}sparqlVarOrIriItem(block){return this.item(" ",block)}sparqlDatasetClause(block){var value=this.valueToCode(block,"value");return this.generateNext(block,`FROM ${value}`,"\n")}sparqlExpressionListItem(block){return this.item(", ",block)}sparqlGroupConditionItem(block){return this.item(" ",block)}sparqlHavingConditionItem(block){return this.item(" ",block)}sparqlOrderConditionItem(block){return this.item(" ",block)}sparqlGraphNodeItem(block){return this.item(" ",block)}sparqlUnaryExpressionItem(block){return this.item("",block)}sparqlConditionalAndExpressionItem(block){return this.item("",block)}sparqlMultiplicativeExpressionItem(block){return this.item("",block)}sparqlGroupGraphPatternItem(block){return this.item("\nUNION\n",block)}sparqlPathSequencItem(block){return this.item("/",block)}sparqlPathAlternativeItem(block){return this.item("|",block)}sparqlPathOneInPropertySetAlternativeItem(block){return this.item("|",block)}sparqlDataBlockValuesItem(block){var code=join("","(",join(" ",this.statementToCode(block,"items")),")");return this.generateNext(block,code,"\n")}sparqlDataBlockValueItem(block){return this.item(" ",block)}sparqlVarItem(block){return this.item(" ",block)}sparqlTriplesSameSubjectItem(block){return this.item(" .\n",block)}sparqlUpdateItem(block){return this.item(" ;\n\n",block)}sparqlQuadPatternItem(block){return this.item(" .\n",block)}valueToCode(block,name){return super.valueToCode(block,name,Order.Atomic)}indent(code){if(code)return this.prefixLines(code,"\t")}var(block,prefix){return codeTuple(`${prefix}${block.getFieldValue("value")}`)}item(delimiter,block){var value=this.valueToCode(block,"value");return this.generateNext(block,value,delimiter)}generateNext(next,code,delimiter){next=this.blockToCode(next.getNextBlock());return next&&(code+=delimiter+next),code}}exports.default=CodeGenerator},{blockly:17}],33:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.StringifiedMap=void 0;class StringifiedMap extends Map{constructor(){super(...arguments),this.keyMap=new Map}set(key,value){var keyString=JSON.stringify(key);return this.keyMap.set(keyString,key),super.set(keyString,value)}get(key){return super.get(JSON.stringify(key))}has(key){return super.has(JSON.stringify(key))}keys(){return this.keyMap.values()}entries(){return this[Symbol.iterator]()}*[Symbol.iterator](){for(var[key,value]of super[Symbol.iterator]())yield[this.keyMap.get(key),value]}}exports.StringifiedMap=StringifiedMap},{}],34:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const Blockly=require("blockly");Blockly.Blocks.sparql11_embtp={init:function(){this.appendValueInput("subject").appendField("<<").setCheck("EmbSubjectOrObject"),this.appendValueInput("predicate").setCheck("Verb"),this.appendValueInput("object").setCheck("EmbSubjectOrObject"),this.appendDummyInput().appendField(">>"),this.setOutput(!0,["GraphNode","GraphNodePath","VarOrTermOrEmbTP","EmbSubjectOrObject","EmbTP","DataBlockValue"]),this.setColour(0),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_objectlistitemanootationpattern={init:function(){this.appendValueInput("value").appendField("{|").setCheck("GraphNode"),this.appendStatementInput("annotations").setCheck("PropertyListNotEmpty"),this.appendDummyInput().appendField("|}"),this.setPreviousStatement(!0,"ObjectListItem"),this.setNextStatement(!0,"ObjectListItem"),this.setColour(294),this.setTooltip("ObjectListItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_selectclause={init:function(){this.appendStatementInput("vars").setCheck("VarOrExpressionAsVarItem").appendField(new Blockly.FieldDropdown([["",""],["DISTINCT","DISTINCT"],["REDUCED","REDUCED"]]),"distinctOrReduced").appendField(new Blockly.FieldDropdown([["",""],["*","*"]]),"star"),this.setOutput(!0,"SelectClause"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_expressionasvar={init:function(){this.appendValueInput("value").setCheck(["Expression","EmbTP"]).appendField("("),this.appendDummyInput().appendField("AS"),this.appendValueInput("name").setCheck("Var"),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["ExpressionAsVar","GroupCondition"]),this.setColour(98),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_selectquery={init:function(){this.appendValueInput("select").setCheck("SelectClause").appendField("SELECT"),this.appendValueInput("where").setCheck("QueryCommon"),this.setInputsInline(!1),this.setOutput(!0,"SelectQuery"),this.setColour(196),this.setTooltip("SelectQuery"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_describequery={init:function(){this.appendStatementInput("subject").setCheck("VarOrIriItem").appendField("DESCRIBE").appendField(new Blockly.FieldDropdown([["",""],["*","*"]]),"star"),this.appendValueInput("where").setCheck("QueryCommon"),this.setOutput(!0,"DescribeQuery"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_prefixedname={init:function(){this.appendDummyInput().appendField(":"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","iri","VarOrIri","GraphNode","VarOrTerm","GraphTerm","Verb","DataBlockValue","PathPrimary","PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath","PathOneInPropertySet","PathNegatedPropertySet","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression","iriOrFunction","GraphOrDefault"]),this.setColour(326),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_prefixednameprefix={init:function(){this.appendDummyInput().appendField(new Blockly.FieldTextInput(""),"prefix").appendField(":"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","iri","VarOrIri","GraphNode","VarOrTerm","GraphTerm","Verb","DataBlockValue","PathPrimary","PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath","PathOneInPropertySet","PathNegatedPropertySet","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression","iriOrFunction","GraphOrDefault"]),this.setColour(326),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_prefixednamelocalname={init:function(){this.appendDummyInput().appendField(":").appendField(new Blockly.FieldTextInput(""),"localName"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","iri","VarOrIri","GraphNode","VarOrTerm","GraphTerm","Verb","DataBlockValue","PathPrimary","PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath","PathOneInPropertySet","PathNegatedPropertySet","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression","iriOrFunction","GraphOrDefault"]),this.setColour(326),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_prefixednameprefixlocalname={init:function(){this.appendDummyInput().appendField(new Blockly.FieldTextInput(""),"prefix").appendField(":").appendField(new Blockly.FieldTextInput(""),"localName"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","iri","VarOrIri","GraphNode","VarOrTerm","GraphTerm","Verb","DataBlockValue","PathPrimary","PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath","PathOneInPropertySet","PathNegatedPropertySet","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression","iriOrFunction","GraphOrDefault"]),this.setColour(326),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_iriref={init:function(){this.appendDummyInput().appendField("<").appendField(new Blockly.FieldTextInput(""),"value").appendField(">"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","IRIREF","iri","VarOrIri","GraphNode","VarOrTerm","GraphTerm","Verb","DataBlockValue","PathPrimary","PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath","PathOneInPropertySet","PathNegatedPropertySet","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression","iriOrFunction","GraphOrDefault"]),this.setColour(326),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_irirefdefault={init:function(){this.appendDummyInput().appendField("<>"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","IRIREF","iri","VarOrIri","GraphNode","VarOrTerm","GraphTerm","Verb","DataBlockValue","PathPrimary","PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath","PathOneInPropertySet","PathNegatedPropertySet","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression","iriOrFunction","GraphOrDefault"]),this.setColour(326),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_solutionmodifier={init:function(){this.appendStatementInput("group").setCheck("GroupConditionItem").appendField("GROUP BY"),this.appendStatementInput("having").setCheck("HavingConditionItem").appendField("HAVING"),this.appendStatementInput("order").setCheck("OrderConditionItem").appendField("ORDER BY"),this.appendValueInput("limit").setCheck("NumericLiteral").appendField("LIMIT"),this.appendValueInput("offset").setCheck("NumericLiteral").appendField("OFFSET"),this.setOutput(!0,"SolutionModifier"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_subselect={init:function(){this.appendValueInput("select").setCheck("SelectClause").appendField("SELECT"),this.appendValueInput("pattern").setCheck("GroupGraphPattern").appendField("WHERE"),this.appendValueInput("modifiers").setCheck("SolutionModifier"),this.appendValueInput("values").setCheck("ValuesClause"),this.setOutput(!0,"SubSelect"),this.setColour(65),this.setTooltip("SubSelect"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_typedliteral={init:function(){this.appendValueInput("value").setCheck("string"),this.appendValueInput("datatype").appendField("^^").setCheck("iri"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","RDFLiteral","GraphNode","VarOrTerm","GraphTerm","DataBlockValue","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression"]),this.setColour(163),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_langstring={init:function(){this.appendValueInput("value").setCheck("string"),this.appendDummyInput().appendField("@").appendField(new Blockly.FieldTextInput(""),"language"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","RDFLiteral","GraphNode","VarOrTerm","GraphTerm","DataBlockValue","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression"]),this.setColour(163),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_a={init:function(){this.appendDummyInput().appendField("a"),this.setOutput(!0,["a","PathPrimary","PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath","PathOneInPropertySet","PathNegatedPropertySet","Verb"]),this.setColour(228),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_blanknodepropertylist={init:function(){this.appendDummyInput().appendField("["),this.appendStatementInput("predicates").setCheck("PropertyListNotEmpty"),this.appendDummyInput().appendField("]"),this.setOutput(!0,["BlankNodePropertyList","TriplesNode","TriplesSameSubject","GraphNode","Object","TriplesBlock"]),this.setColour(0),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_collection={init:function(){this.appendDummyInput().appendField("("),this.appendStatementInput("items").setCheck("GraphNodeItem"),this.appendDummyInput().appendField(")"),this.setOutput(!0,["Collection","TriplesNode","TriplesSameSubject","GraphNode","Object","TriplesBlock"]),this.setColour(0),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_anon={init:function(){this.appendDummyInput().appendField("[]"),this.setOutput(!0,["EmbSubjectOrObject","VarOrTermOrEmbTP","BlankNode","GraphTerm","VarOrTerm","GraphNode","Object"]),this.setColour(98),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_blanknodelabel={init:function(){this.appendDummyInput().appendField("_:").appendField(new Blockly.FieldTextInput(""),"value"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","VarOrTermOrEmbTP","BlankNode","GraphTerm","VarOrTerm","GraphNode"]),this.setColour(98),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_nil={init:function(){this.appendDummyInput().appendField("()"),this.setOutput(!0,["VarOrTermOrEmbTP","NIL","GraphTerm","VarOrTerm","GraphNode","Object"]),this.setColour(98),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_var1={init:function(){this.appendDummyInput().appendField("?").appendField(new Blockly.FieldTextInput("s"),"value"),this.setInputsInline(!1),this.setOutput(!0,["EmbSubjectOrObject","VarOrTermOrEmbTP","Var","VarOrIri","Verb","VarOrTerm","GraphNode","Object","GroupCondition","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression"]),this.setColour(33),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_var2={init:function(){this.appendDummyInput().appendField("$").appendField(new Blockly.FieldTextInput("s"),"value"),this.setInputsInline(!1),this.setOutput(!0,["EmbSubjectOrObject","VarOrTermOrEmbTP","Var","VarOrIri","Verb","VarOrTerm","GraphNode","Object","GroupCondition","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression"]),this.setColour(33),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_groupconditionitem={init:function(){this.appendValueInput("value").setCheck("GroupCondition"),this.setPreviousStatement(!0,"GroupConditionItem"),this.setNextStatement(!0,"GroupConditionItem"),this.setColour(196),this.setTooltip("GroupConditionItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_groupgraphpattern={init:function(){this.appendDummyInput().appendField("{"),this.appendValueInput("value").setCheck(["SubSelect","GroupGraphPatternSub","TriplesNode","TriplesSameSubject","GraphPatternNotTriples","GroupGraphPattern"]),this.appendDummyInput().appendField("}"),this.setInputsInline(!1),this.setOutput(!0,"GroupGraphPattern"),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_groupgraphpatternsub={init:function(){this.appendStatementInput("items").setCheck("GroupGraphPatternSubItem"),this.setOutput(!0,"GroupGraphPatternSub"),this.setColour(65),this.setTooltip("GroupGraphPatternSub"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_groupgraphpatternsubitem={init:function(){this.appendValueInput("value").setCheck(["GroupGraphPattern","TriplesNode","TriplesSameSubject","GraphPatternNotTriples"]),this.setPreviousStatement(!0,"GroupGraphPatternSubItem"),this.setNextStatement(!0,"GroupGraphPatternSubItem"),this.setColour(65),this.setTooltip("GroupGraphPatternSubItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_optionalgraphpattern={init:function(){this.appendValueInput("value").setCheck("GroupGraphPattern").appendField("OPTIONAL"),this.setOutput(!0,"GraphPatternNotTriples"),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_graphgraphpattern={init:function(){this.appendValueInput("iri").setCheck("VarOrIri").appendField("GRAPH"),this.appendValueInput("patterns").setCheck("GroupGraphPattern"),this.setInputsInline(!1),this.setOutput(!0,["GraphGraphPattern","GraphPatternNotTriples"]),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_servicegraphpattern={init:function(){this.appendValueInput("iri").setCheck("VarOrIri").appendField("SERVICE").appendField(new Blockly.FieldDropdown([["",""],["SILENT","SILENT"]]),"silent"),this.appendValueInput("patterns").setCheck("GroupGraphPattern"),this.setOutput(!0,["ServiceGraphPattern","GraphPatternNotTriples"]),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_bind={init:function(){this.appendValueInput("value").setCheck("ExpressionAsVar").appendField("BIND"),this.setOutput(!0,["Bind","GraphPatternNotTriples"]),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_minusgraphpattern={init:function(){this.appendValueInput("value").setCheck("GroupGraphPattern").appendField("MINUS"),this.setOutput(!0,["MinusGraphPattern","GraphPatternNotTriples"]),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_grouporuniongraphpattern={init:function(){this.appendStatementInput("items").setCheck("GroupGraphPatternItem").appendField("UNION"),this.setInputsInline(!1),this.setOutput(!0,["GroupOrUnionGraphPattern","GraphPatternNotTriples"]),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_filter={init:function(){this.appendValueInput("value").setCheck("Constraint").appendField("FILTER"),this.setOutput(!0,["Filter","GraphPatternNotTriples"]),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_inlinedata={init:function(){this.appendValueInput("value").setCheck("DataBlock").appendField("VALUES"),this.setOutput(!0,["InlineData","GraphPatternNotTriples","ValuesClause"]),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_inlinedataonevar={init:function(){this.appendValueInput("variable").setCheck("Var"),this.appendDummyInput().appendField("{"),this.appendStatementInput("values").setCheck("DataBlockValueItem"),this.appendDummyInput().appendField("}"),this.setOutput(!0,"DataBlock"),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_inlinedatafull={init:function(){this.appendDummyInput().appendField("("),this.appendStatementInput("variables").setCheck("VarItem"),this.appendDummyInput().appendField(")"),this.appendDummyInput().appendField("{"),this.appendStatementInput("values").setCheck("DataBlockValuesItem"),this.appendDummyInput().appendField("}"),this.setOutput(!0,["InlineDataFull","DataBlock"]),this.setColour(65),this.setTooltip("InlineDataFull"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_datablockvaluesitem={init:function(){this.appendDummyInput().appendField("("),this.appendStatementInput("items").setCheck("DataBlockValueItem"),this.appendDummyInput().appendField(")"),this.setPreviousStatement(!0,"DataBlockValuesItem"),this.setNextStatement(!0,"DataBlockValuesItem"),this.setColour(65),this.setTooltip("DataBlockValuesItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_datablockvalueitem={init:function(){this.appendValueInput("value").setCheck("DataBlockValue"),this.setPreviousStatement(!0,"DataBlockValueItem"),this.setNextStatement(!0,"DataBlockValueItem"),this.setColour(65),this.setTooltip("DataBlockValueItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_undef={init:function(){this.appendDummyInput().appendField("UNDEF"),this.setOutput(!0,"DataBlockValue"),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_negatedpath={init:function(){this.appendValueInput("value").setCheck("PathNegatedPropertySet").appendField("!"),this.setInputsInline(!0),this.setOutput(!0,["PathPrimary","PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath"]),this.setColour(228),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_bracketedpath={init:function(){this.appendValueInput("value").setCheck("Path").appendField("("),this.appendDummyInput().appendField(")"),this.setOutput(!0,["PathPrimary","PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath"]),this.setColour(228),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_pathwithmodifier={init:function(){this.appendValueInput("value").setCheck("PathPrimary").appendField(""),this.appendDummyInput().appendField(new Blockly.FieldDropdown([["",""],["?","?"],["*","*"],["+","+"]]),"modifier"),this.setInputsInline(!0),this.setOutput(!0,["PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath"]),this.setColour(228),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_inversepath={init:function(){this.appendValueInput("value").setCheck("PathElt").appendField("^"),this.setInputsInline(!1),this.setInputsInline(!0),this.setOutput(!0,["PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath"]),this.setColour(228),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_pathalternative={init:function(){this.appendDummyInput().appendField("|"),this.appendStatementInput("items").setCheck("PathAlternativeItem"),this.setInputsInline(!0),this.setOutput(!0,["PathAlternative","Path","VerbPath"]),this.setColour(228),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_pathsequencitem={init:function(){this.appendValueInput("value").setCheck("PathEltOrInverse"),this.setInputsInline(!1),this.setPreviousStatement(!0,"PathSequenceItem"),this.setNextStatement(!0,"PathSequenceItem"),this.setColour(228),this.setTooltip("PathSequenceItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_pathalternativeitem={init:function(){this.appendValueInput("value").setCheck("PathSequence"),this.setInputsInline(!1),this.setPreviousStatement(!0,"PathAlternativeItem"),this.setNextStatement(!0,"PathAlternativeItem"),this.setColour(228),this.setTooltip("PathAlternativeItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_pathsequence={init:function(){this.appendDummyInput().appendField("/"),this.appendStatementInput("items").setCheck("PathSequenceItem"),this.setInputsInline(!0),this.setOutput(!0,["PathSequence","PathAlternative","Path","VerbPath"]),this.setColour(228),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_inversepathoneinpropertyset={init:function(){this.appendValueInput("value").setCheck(["iri","a"]).appendField("^"),this.setInputsInline(!0),this.setOutput(!0,["PathOneInPropertySet","PathNegatedPropertySet"]),this.setColour(228),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_pathoneinpropertysetalternative={init:function(){this.appendDummyInput().appendField("(|)"),this.appendStatementInput("items").setCheck("PathOneInPropertySetAlternativeItem"),this.setInputsInline(!0),this.setOutput(!0,"PathNegatedPropertySet"),this.setColour(228),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_pathoneinpropertysetalternativeitem={init:function(){this.appendValueInput("value").setCheck("PathOneInPropertySet"),this.setPreviousStatement(!0,"PathOneInPropertySetAlternativeItem"),this.setNextStatement(!0,"PathOneInPropertySetAlternativeItem"),this.setColour(228),this.setTooltip("PathOneInPropertySetAlternativeItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_varitem={init:function(){this.appendValueInput("value").setCheck("Var"),this.setInputsInline(!1),this.setPreviousStatement(!0,"VarItem"),this.setNextStatement(!0,"VarItem"),this.setColour(65),this.setTooltip("VarItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_askquery={init:function(){this.appendValueInput("value").setCheck("QueryCommon").appendField("ASK"),this.setOutput(!0,"AskQuery"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_simpleconstructquery={init:function(){this.appendDummyInput().appendField("CONSTRUCT"),this.appendStatementInput("datasets").setCheck("DatasetClause"),this.appendStatementInput("where").setCheck("TriplesSameSubjectItem").appendField("WHERE {"),this.appendValueInput("modifiers").setCheck("SolutionModifier").appendField("}"),this.setOutput(!0,"ConstructQuery"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_triplessamesubjectitem={init:function(){this.appendValueInput("value").setCheck("TriplesSameSubject"),this.setPreviousStatement(!0,"TriplesSameSubjectItem"),this.setNextStatement(!0,"TriplesSameSubjectItem"),this.setColour(196),this.setTooltip("TriplesSameSubjectItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_constructquery={init:function(){this.appendStatementInput("template").setCheck("TriplesSameSubjectItem").appendField("CONSTRUCT {"),this.appendValueInput("where").setCheck("QueryCommon").appendField("}"),this.setOutput(!0,"ConstructQuery"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_query={init:function(){this.appendStatementInput("prologue").setCheck("PrologueItem"),this.appendValueInput("value").setCheck(["SelectQuery","ConstructQuery","DescribeQuery","AskQuery"]),this.appendValueInput("values").setCheck("ValuesClause"),this.setColour(196),this.setTooltip("Query"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_base={init:function(){this.appendValueInput("value").setCheck("IRIREF").appendField("BASE"),this.setInputsInline(!1),this.setOutput(!0,"BaseDecl"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_prefixdecl={init:function(){this.appendValueInput("value").setCheck("IRIREF").appendField("PREFIX").appendField(new Blockly.FieldTextInput(""),"prefix").appendField(":"),this.setOutput(!0,"PrefixDecl"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_prologueitem={init:function(){this.appendValueInput("value").setCheck(["BaseDecl","PrefixDecl"]),this.setInputsInline(!1),this.setPreviousStatement(!0,"PrologueItem"),this.setNextStatement(!0,"PrologueItem"),this.setColour(196),this.setTooltip("PrologueItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_varorexpressionasvaritem={init:function(){this.appendValueInput("value").setCheck(["Var","ExpressionAsVar"]),this.setInputsInline(!1),this.setPreviousStatement(!0,"VarOrExpressionAsVarItem"),this.setNextStatement(!0,"VarOrExpressionAsVarItem"),this.setColour(196),this.setTooltip("VarOrExpressionAsVarItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_numericliteral={init:function(){const field=new Blockly.FieldTextInput("");field.setValidator(value=>{if(isNaN(parseFloat(value))||!isFinite(value))return null}),this.appendDummyInput().appendField(field,"value"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","NumericLiteral","RDFLiteral","GraphNode","VarOrTerm","GraphTerm","DataBlockValue","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression"]),this.setColour(163),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_booleanliteral={init:function(){this.appendDummyInput().appendField(new Blockly.FieldCheckbox("TRUE"),"value"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","RDFLiteral","GraphNode","VarOrTerm","GraphTerm","DataBlockValue","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression"]),this.setColour(163),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_brackettedexpression={init:function(){this.appendValueInput("value").setCheck("Expression").appendField("("),this.appendDummyInput().appendField(")"),this.setOutput(!0,["BrackettedExpression","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_multiplicativeexpression={init:function(){this.appendValueInput("left").setCheck("UnaryExpression"),this.appendValueInput("right").setCheck("UnaryExpression").appendField(new Blockly.FieldDropdown([["*","*"],["/","/"]]),"operator"),this.setInputsInline(!0),this.setOutput(!0,["MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_additiveexpression={init:function(){this.appendValueInput("left").setCheck("MultiplicativeExpression"),this.appendValueInput("right").setCheck("MultiplicativeExpression").appendField(new Blockly.FieldDropdown([["+","+"],["-","-"]]),"operator"),this.setInputsInline(!0),this.setOutput(!0,["AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_relationalexpression={init:function(){this.appendValueInput("left").setCheck("NumericExpression"),this.appendValueInput("right").setCheck("NumericExpression").appendField(new Blockly.FieldDropdown([["=","="],["!=","!="],["<","<"],[">",">"],["<=","<="],[">=",">="]]),"operator"),this.setInputsInline(!0),this.setOutput(!0,["RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_relationalexpressionin={init:function(){this.appendValueInput("left").setCheck("NumericExpression"),this.appendStatementInput("right").setCheck("ExpressionListItem").appendField(new Blockly.FieldDropdown([["IN","IN"],["NOT IN","NOT IN"]]),"operator"),this.setInputsInline(!0),this.setOutput(!0,["RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_expressionlistitem={init:function(){this.appendValueInput("value").setCheck("Expression"),this.setPreviousStatement(!0,"ExpressionListItem"),this.setNextStatement(!0,"ExpressionListItem"),this.setColour(261),this.setTooltip("ExpressionListItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_conditionalandexpression={init:function(){this.appendValueInput("left").setCheck("ValueLogical"),this.appendValueInput("right").setCheck("ValueLogical").appendField("&&"),this.setInputsInline(!0),this.setOutput(!0,["ConditionalAndExpression","ConditionalOrExpression","Expression"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_conditionalorexpression={init:function(){this.appendValueInput("left").setCheck("ConditionalAndExpression"),this.appendValueInput("right").setCheck("ConditionalAndExpression").appendField("||"),this.setInputsInline(!0),this.setOutput(!0,["ConditionalOrExpression","Expression"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_string={init:function(){this.appendDummyInput().appendField(new Blockly.FieldMultilineInput(""),"value"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","string","RDFLiteral","GraphNode","VarOrTerm","GraphTerm","DataBlockValue","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression"]),this.setColour(163),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_havingconditionitem={init:function(){this.appendValueInput("value").setCheck("Constraint"),this.setPreviousStatement(!0,"HavingConditionItem"),this.setNextStatement(!0,"HavingConditionItem"),this.setColour(196),this.setTooltip("HavingConditionItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_triplessamesubject={init:function(){this.appendValueInput("subject").setCheck(["VarOrTermOrEmbTP","TriplesNode"]),this.appendStatementInput("predicates").setCheck("PropertyListNotEmpty"),this.setOutput(!0,"TriplesSameSubject"),this.setColour(0),this.setTooltip("TriplesSameSubject"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_varoririitem={init:function(){this.appendValueInput("value").setCheck("VarOrIri"),this.setPreviousStatement(!0,"VarOrIriItem"),this.setNextStatement(!0,"VarOrIriItem"),this.setColour(196),this.setTooltip("VarOrIriItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_graphnodeitem={init:function(){this.appendValueInput("value").setCheck("GraphNode"),this.setPreviousStatement(!0,"GraphNodeItem"),this.setNextStatement(!0,"GraphNodeItem"),this.setColour(294),this.setTooltip("GraphNodeItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_objectlistitem={init:function(){this.appendValueInput("value").setCheck("GraphNode"),this.setPreviousStatement(!0,"ObjectListItem"),this.setNextStatement(!0,"ObjectListItem"),this.setColour(294),this.setTooltip("ObjectListItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_propertylistnotempty={init:function(){this.appendValueInput("predicate").setCheck(["Verb","Path"]),this.appendStatementInput("objects").setCheck("ObjectListItem"),this.setPreviousStatement(!0,"PropertyListNotEmpty"),this.setNextStatement(!0,"PropertyListNotEmpty"),this.setColour(131),this.setTooltip("PropertyListNotEmpty"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_querycommon={init:function(){this.appendStatementInput("datasets").setCheck("DatasetClause"),this.appendValueInput("pattern").setCheck("GroupGraphPattern").appendField("WHERE"),this.appendValueInput("modifiers").setCheck("SolutionModifier"),this.setOutput(!0,"QueryCommon"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_datasetclause={init:function(){this.appendValueInput("value").setCheck(["iri","NamedGraphClause"]).appendField("FROM"),this.setInputsInline(!1),this.setPreviousStatement(!0,"DatasetClause"),this.setNextStatement(!0,"DatasetClause"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_namedgraphclause={init:function(){this.appendValueInput("value").setCheck("iri").appendField("NAMED"),this.setOutput(!0,"NamedGraphClause"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_builtincall0={init:function(){this.appendDummyInput().appendField(new Blockly.FieldDropdown([["BNODE","BNODE"],["RAND","RAND"],["NOW","NOW"],["UUID","UUID"],["STRUUID","STRUUID"]]),"operator").appendField("()"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_builtincall1={init:function(){this.appendValueInput("arg1").setCheck("Expression").appendField(new Blockly.FieldDropdown([["STR","STR"],["LANG","LANG"],["DATATYPE","DATATYPE"],["IRI","IRI"],["URI","URI"],["BNODE","BNODE"],["ABS","ABS"],["CEIL","CEIL"],["FLOOR","FLOOR"],["ROUND","ROUND"],["STRLEN","STRLEN"],["UCASE","UCASE"],["LCASE","LCASE"],["ENCODE_FOR_URI","ENCODE_FOR_URI"],["YEAR","YEAR"],["MONTH","MONTH"],["DAY","DAY"],["HOURS","HOURS"],["MINUTES","MINUTES"],["SECONDS","SECONDS"],["TIMEZONE","TIMEZONE"],["TZ","TZ"],["MD5","MD5"],["SHA1","SHA1"],["SHA256","SHA256"],["SHA384","SHA384"],["SHA512","SHA512"],["ISIRI","ISIRI"],["ISURI","ISURI"],["ISBLANK","ISBLANK"],["ISLITERAL","ISLITERAL"],["ISNUMERIC","ISNUMERIC"],["SUBJECT","SUBJECT"],["PREDICATE","PREDICATE"],["OBJECT","OBJECT"],["ISTRIPLE","ISTRIPLE"]]),"operator").appendField("("),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_builtincall2={init:function(){this.appendValueInput("arg1").setCheck("Expression").appendField(new Blockly.FieldDropdown([["LANGMATCHES","LANGMATCHES"],["SUBSTR","SUBSTR"],["CONTAINS","CONTAINS"],["STRSTARTS","STRSTARTS"],["STRENDS","STRENDS"],["STRBEFORE","STRBEFORE"],["STRAFTER","STRAFTER"],["STRLANG","STRLANG"],["STRDT","STRDT"],["SAMETERM","SAMETERM"],["REGEX","REGEX"]]),"operator").appendField("("),this.appendValueInput("arg2").setCheck("Expression").appendField(","),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_builtincall3={init:function(){this.appendValueInput("arg1").setCheck("Expression").appendField(new Blockly.FieldDropdown([["REGEX","REGEX"],["SUBSTR","SUBSTR"],["REPLACE","REPLACE"],["IF","IF"],["TRIPLE","TRIPLE"]]),"operator").appendField("("),this.appendValueInput("arg2").setCheck("Expression").appendField(","),this.appendValueInput("arg3").setCheck("Expression").appendField(","),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_builtincall4={init:function(){this.appendValueInput("arg1").setCheck("Expression").appendField(new Blockly.FieldDropdown([["REPLACE","REPLACE"]]),"operator").appendField("("),this.appendValueInput("arg2").setCheck("Expression").appendField(","),this.appendValueInput("arg3").setCheck("Expression").appendField(","),this.appendValueInput("arg4").setCheck("Expression").appendField(","),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_builtincalln={init:function(){this.appendStatementInput("args").setCheck("ExpressionListItem").appendField(new Blockly.FieldDropdown([["CONCAT","CONCAT"],["COALESCE","COALESCE"]]),"operator").appendField("("),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_iriorfunction={init:function(){this.appendValueInput("iri").setCheck("iri"),this.appendDummyInput().appendField("(").appendField(new Blockly.FieldDropdown([["",""],["DISTINCT","DISTINCT"]]),"distinct"),this.appendStatementInput("args").setCheck("ExpressionListItem"),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","Constraint","GroupCondition"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_exists={init:function(){this.appendValueInput("value").setCheck("GroupGraphPattern").appendField(new Blockly.FieldDropdown([["EXISTS","EXISTS"],["NOT EXISTS","NOT EXISTS"]]),"operator"),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_bound={init:function(){this.appendValueInput("value").setCheck("Var").appendField("BOUND ("),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_unaryexpression={init:function(){this.appendValueInput("left").setCheck("PrimaryExpression").appendField(new Blockly.FieldDropdown([["!","!"],["+","+"],["-","UMINUS"]]),"operator"),this.setInputsInline(!0),this.setOutput(!0,["UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_aggregate={init:function(){this.appendValueInput("arg1").setCheck("Expression").appendField(new Blockly.FieldDropdown([["SUM","SUM"],["MIN","MIN"],["MAX","MAX"],["AVG","AVG"],["SAMPLE","SAMPLE"]]),"operator").appendField("(").appendField(new Blockly.FieldDropdown([["",""],["DISTINCT","DISTINCT"]]),"distinct"),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_count={init:function(){this.appendValueInput("arg1").setCheck("Expression").appendField("COUNT(").appendField(new Blockly.FieldDropdown([["",""],["DISTINCT","DISTINCT"]]),"distinct").appendField(new Blockly.FieldDropdown([["",""],["*","*"]]),"star"),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_group_concat={init:function(){this.appendValueInput("arg1").setCheck("Expression").appendField("GROUP_CONCAT(").appendField(new Blockly.FieldDropdown([["",""],["DISTINCT","DISTINCT"]]),"distinct"),this.appendValueInput("separator").appendField("; SEPARATOR =").setCheck("string"),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_prefixdecldefault={init:function(){this.appendValueInput("value").setCheck("IRIREF").appendField("PREFIX :"),this.setOutput(!0,"PrefixDecl"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_groupgraphpatternitem={init:function(){this.appendValueInput("value").setCheck("GroupGraphPattern"),this.setPreviousStatement(!0,"GroupGraphPatternItem"),this.setNextStatement(!0,"GroupGraphPatternItem"),this.setColour(65),this.setTooltip("GroupGraphPatternItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_orderconditionitem={init:function(){this.appendValueInput("value").setCheck(["OrderCondition","Constraint","Var"]),this.setPreviousStatement(!0,"OrderConditionItem"),this.setNextStatement(!0,"OrderConditionItem"),this.setColour(196),this.setTooltip("OrderConditionItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_ordercondition={init:function(){this.appendValueInput("value").setCheck("BrackettedExpression").appendField(new Blockly.FieldDropdown([["ASC","ASC"],["DESC","DESC"]]),"operator"),this.setOutput(!0,"OrderCondition"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_update={init:function(){this.appendStatementInput("prologue").setCheck("PrologueItem"),this.appendStatementInput("items").setCheck("UpdateItem"),this.setColour(196),this.setTooltip("Update"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_updateitem={init:function(){this.appendValueInput("value").setCheck(["Update1"]),this.setPreviousStatement(!0,"UpdateItem"),this.setNextStatement(!0,"UpdateItem"),this.setColour(196),this.setTooltip("UpdateItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_load={init:function(){this.appendValueInput("source").setCheck("iri").appendField("LOAD").appendField(new Blockly.FieldDropdown([["",""],["SILENT","silent"]]),"silent"),this.appendValueInput("destination").setCheck("GraphRef").appendField("INTO"),this.setOutput(!0,"Update1"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_graphref={init:function(){this.appendValueInput("value").setCheck("iri").appendField("GRAPH"),this.setOutput(!0,["GraphRef","GraphRefAll","GraphOrDefault"]),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_graphrefallnamed={init:function(){this.appendDummyInput().appendField("NAMED"),this.setOutput(!0,"GraphRefAll"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_graphrefallall={init:function(){this.appendDummyInput().appendField("ALL"),this.setOutput(!0,"GraphRefAll"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_graphordefault={init:function(){this.appendDummyInput().appendField("DEFAULT"),this.setOutput(!0,["GraphRefAll","GraphOrDefault"]),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_create={init:function(){this.appendValueInput("graph").setCheck("GraphRef").appendField("CREATE").appendField(new Blockly.FieldDropdown([["",""],["SILENT","silent"]]),"silent"),this.setOutput(!0,"Update1"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_addmovecopy={init:function(){this.appendValueInput("source").setCheck("GraphOrDefault").appendField(new Blockly.FieldDropdown([["ADD","ADD"],["MOVE","MOVE"],["COPY","COPY"]]),"operator").appendField(new Blockly.FieldDropdown([["",""],["SILENT","SILENT"]]),"silent"),this.appendValueInput("destination").setCheck("GraphOrDefault").appendField("TO"),this.setOutput(!0,"Update1"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_cleardrop={init:function(){this.appendValueInput("graph").setCheck("GraphRefAll").appendField(new Blockly.FieldDropdown([["CLEAR","CLEAR"],["DROP","DROP"]]),"operator").appendField(new Blockly.FieldDropdown([["",""],["SILENT","SILENT"]]),"silent"),this.setOutput(!0,"Update1"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_quadpattern={init:function(){this.appendDummyInput().appendField("{"),this.appendStatementInput("items").setCheck("QuadPatternItem"),this.appendDummyInput().appendField("}"),this.setInputsInline(!1),this.setOutput(!0,"QuadPattern"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_quadpatternitem={init:function(){this.appendValueInput("value").setCheck(["TriplesSameSubject","QuadsNotTriples"]),this.setInputsInline(!1),this.setPreviousStatement(!0,"QuadPatternItem"),this.setNextStatement(!0,"QuadPatternItem"),this.setColour(196),this.setTooltip("QuadPatternItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_insertdeletewhere={init:function(){this.appendValueInput("pattern").setCheck("QuadPattern").appendField(new Blockly.FieldDropdown([["INSERT DATA","INSERT DATA"],["DELETE DATA","DELETE DATA"],["DELETE WHERE","DELETE WHERE"]]),"operator"),this.setOutput(!0,"Update1"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_quadsnottriples={init:function(){this.appendValueInput("name").setCheck("VarOrIri").appendField("GRAPH {"),this.appendStatementInput("triples").setCheck("TriplesSameSubjectItem"),this.appendDummyInput().appendField("}"),this.setInputsInline(!1),this.setOutput(!0,"QuadsNotTriples"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_modify={init:function(){this.appendValueInput("iri").setCheck("iri").appendField("WITH"),this.appendValueInput("delete").setCheck("QuadPattern").appendField("DELETE"),this.appendValueInput("insert").setCheck("QuadPattern").appendField("INSERT"),this.appendStatementInput("using").setCheck("UsingClause"),this.appendValueInput("where").setCheck("GroupGraphPattern").appendField("WHERE"),this.setInputsInline(!1),this.setOutput(!0,"Update1"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_usingclause={init:function(){this.appendValueInput("value").setCheck(["iri","NamedGraphClause"]).appendField("USING"),this.setInputsInline(!1),this.setPreviousStatement(!0,"UsingClause"),this.setNextStatement(!0,"UsingClause"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}}},{blockly:17}],35:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.blocklyToSparql=exports.sparqlToBlockly=void 0,require("./blocks");const BlockGenerator_1=require("./BlockGenerator"),CodeGenerator_1=require("./CodeGenerator");exports.sparqlToBlockly=function(_a){return null===(_a=(new BlockGenerator_1.default).visit(_a))||void 0===_a?void 0:_a.xml},exports.blocklyToSparql=function(block){return(new CodeGenerator_1.default).blockToCode(block)}},{"./BlockGenerator":31,"./CodeGenerator":32,"./blocks":34}],36:[function(require,module,exports){function Generator(options){this._options=options=options||{};var prefixes=options.prefixes||{};this._prefixByIri={};var prefix,prefixIris=[];for(prefix in prefixes){var iri=prefixes[prefix];isString(iri)&&(this._prefixByIri[iri]=prefix,prefixIris.push(iri))}var iriList=prefixIris.join("|").replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&");this._prefixRegex=new RegExp("^("+iriList+")([a-zA-Z][\\-_a-zA-Z0-9]*)$"),this._usedPrefixes={},this._sparqlStar=options.sparqlStar,this._indent=isString(options.indent)?options.indent:" ",this._newline=isString(options.newline)?options.newline:"\n",this._explicitDatatype=Boolean(options.explicitDatatype)}Generator.prototype.toQuery=function(q){var query="";return q.queryType&&(query+=q.queryType.toUpperCase()+" "),q.reduced&&(query+="REDUCED "),q.distinct&&(query+="DISTINCT "),q.variables?query+=mapJoin(q.variables,void 0,function(variable){return isTerm(variable)?this.toEntity(variable):"("+this.toExpression(variable.expression)+" AS ?"+variable.variable.value+")"},this)+" ":q.template&&(query+=this.group(q.template,!0)+this._newline),q.from&&(query+=this.graphs("FROM ",q.from.default)+this.graphs("FROM NAMED ",q.from.named)),q.where&&(query+="WHERE "+this.group(q.where,!0)+this._newline),q.updates&&(query+=mapJoin(q.updates,";"+this._newline,this.toUpdate,this)),q.group&&(query+="GROUP BY "+mapJoin(q.group,void 0,function(it){var result=isString(it.expression)?it.expression:"("+this.toExpression(it.expression)+")";return it.variable?"("+result+" AS ?"+it.variable.value+")":result},this)+this._newline),q.having&&(query+="HAVING ("+mapJoin(q.having,void 0,this.toExpression,this)+")"+this._newline),q.order&&(query+="ORDER BY "+mapJoin(q.order,void 0,function(it){var expr="("+this.toExpression(it.expression)+")";return it.descending?"DESC "+expr:expr},this)+this._newline),q.offset&&(query+="OFFSET "+q.offset+this._newline),q.limit&&(query+="LIMIT "+q.limit+this._newline),q.values&&(query+=this.values(q)),(query=this.baseAndPrefixes(q)+query).trim()},Generator.prototype.baseAndPrefixes=function(q){var key,base=q.base?"BASE <"+q.base+">"+this._newline:"",prefixes="";for(key in q.prefixes)(this._options.allPrefixes||this._usedPrefixes[key])&&(prefixes+="PREFIX "+key+": <"+q.prefixes[key]+">"+this._newline);return base+prefixes},Generator.prototype.toPattern=function(pattern){var type=pattern.type||pattern instanceof Array&&"array"||(pattern.subject&&pattern.predicate&&pattern.object?"triple":"");if(!(type in this))throw new Error("Unknown entry type: "+type);return this[type](pattern)},Generator.prototype.triple=function(t){return this.toEntity(t.subject)+" "+this.toEntity(t.predicate)+" "+this.toEntity(t.object)+"."},Generator.prototype.array=function(items){return mapJoin(items,this._newline,this.toPattern,this)},Generator.prototype.bgp=function(bgp){return this.encodeTriples(bgp.triples)},Generator.prototype.encodeTriples=function(triples){if(!triples.length)return"";for(var parts=[],subject=void 0,predicate=void 0,i=0;i":case">=":case"<=":case"&&":case"||":case"=":case"!=":case"+":case"-":case"*":case"/":return(isTerm(args[0])?this.toEntity(args[0]):"("+this.toExpression(args[0])+")")+" "+operator+" "+(isTerm(args[1])?this.toEntity(args[1]):"("+this.toExpression(args[1])+")");case"!":return"!("+this.toExpression(args[0])+")";case"uminus":return"-("+this.toExpression(args[0])+")";case"notin":operator="NOT IN";case"in":return this.toExpression(args[0])+" "+operator+"("+(isString(args[1])?args[1]:mapJoin(args[1],", ",this.toExpression,this))+")";case"notexists":operator="NOT EXISTS";case"exists":return operator+" "+this.group(args[0],!0);default:return operator+"("+mapJoin(args,", ",this.toExpression,this)+")"}default:throw new Error("Unknown expression type: "+expr.type)}},Generator.prototype.toEntity=function(value){if(isTerm(value))switch(value.termType){case"Wildcard":return"*";case"Variable":return"?"+value.value;case"BlankNode":return"_:"+value.value;case"Literal":var lexical=value.value||"",language=value.language||"",datatype=value.datatype;if(value='"'+lexical.replace(escape,escapeReplacer)+'"',language)value+="@"+language;else if(datatype){if(!this._explicitDatatype)switch(datatype.value){case"http://www.w3.org/2001/XMLSchema#string":return value;case"http://www.w3.org/2001/XMLSchema#integer":if(/^\d+$/.test(lexical))return lexical+" "}value+="^^"+this.encodeIRI(datatype.value)}return value;case"Quad":if(!this._sparqlStar)throw new Error("SPARQL* support is not enabled");return value.graph&&"DefaultGraph"!==value.graph.termType?"<< GRAPH "+this.toEntity(value.graph)+" { "+this.toEntity(value.subject)+" "+this.toEntity(value.predicate)+" "+this.toEntity(value.object)+" } >>":"<< "+this.toEntity(value.subject)+" "+this.toEntity(value.predicate)+" "+this.toEntity(value.object)+" >>";default:return this.encodeIRI(value.value)}else{var items=value.items.map(this.toEntity,this),path=value.pathType;switch(path){case"^":case"!":return path+items[0];case"*":case"+":case"?":return"("+items[0]+path+")";default:return"("+items.join(path)+")"}}};var escape=/["\\\t\n\r\b\f]/g,escapeReplacer=function(c){return escapeReplacements[c]},escapeReplacements={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};function isString(object){return"string"==typeof object}function isTerm(object){return"string"==typeof object.termType}function equalTerms(term1,term2){if(!term1||!isTerm(term1))return!1;if(!term2||!isTerm(term2))return!1;if(term1.termType!==term2.termType)return!1;switch(term1.termType){case"Literal":return term1.value===term2.value&&term1.language===term2.language&&equalTerms(term1.datatype,term2.datatype);case"Quad":return equalTerms(term1.subject,term2.subject)&&equalTerms(term1.predicate,term2.predicate)&&equalTerms(term1.object,term2.object)&&equalTerms(term1.graph,term2.graph);default:return term1.value===term2.value}}function mapJoin(array,sep,func,self){return array.map(func,self).join(isString(sep)?sep:" ")}Generator.prototype.encodeIRI=function(iri){var prefixMatch=this._prefixRegex.exec(iri);if(prefixMatch){var prefix=this._prefixByIri[prefixMatch[1]];return this._usedPrefixes[prefix]=!0,prefix+":"+prefixMatch[2]}return"<"+iri+">"},Generator.prototype.toUpdate=function(update){switch(update.type||update.updateType){case"load":return"LOAD"+(update.source?" "+this.toEntity(update.source):"")+(update.destination?" INTO GRAPH "+this.toEntity(update.destination):"");case"insert":return"INSERT DATA "+this.group(update.insert,!0);case"delete":return"DELETE DATA "+this.group(update.delete,!0);case"deletewhere":return"DELETE WHERE "+this.group(update.delete,!0);case"insertdelete":return(update.graph?"WITH "+this.toEntity(update.graph)+this._newline:"")+(update.delete.length?"DELETE "+this.group(update.delete,!0)+this._newline:"")+(update.insert.length?"INSERT "+this.group(update.insert,!0)+this._newline:"")+(update.using?this.graphs("USING ",update.using.default):"")+(update.using?this.graphs("USING NAMED ",update.using.named):"")+"WHERE "+this.group(update.where,!0);case"add":case"copy":case"move":return update.type.toUpperCase()+(update.source.default?" DEFAULT ":" ")+"TO "+this.toEntity(update.destination.name);case"create":case"clear":case"drop":return update.type.toUpperCase()+(update.silent?" SILENT ":" ")+(update.graph.default?"DEFAULT":update.graph.named?"NAMED":update.graph.all?"ALL":"GRAPH "+this.toEntity(update.graph.name));default:throw new Error("Unknown update query type: "+update.type)}},Generator.prototype.indent=function(text){return text.replace(/^/gm,this._indent)},module.exports=function(options={}){return{stringify:function(query){var currentOptions=Object.create(options);return currentOptions.prefixes=query.prefixes,new Generator(currentOptions).toQuery(query)},createGenerator:function(){return new Generator(options)}}}},{}],37:[function(require,module,exports){!function(process){!function(){var SparqlParser=function(){var parser=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[6,12,15,28,41,50,55,107,117,120,122,123,132,133,138,320,321,322,323,324],$V1=[2,208],$V2=[107,117,120,122,123,132,133,138,320,321,322,323,324],$V3=[1,20],$V4=[1,29],$V5=[6,90],$V6=[45,46,58],$V7=[45,58],$V8=[1,58],$V9=[1,60],$Va=[1,56],$Vb=[1,59],$Vc=[1,65],$Vd=[1,66],$Ve=[26,34,35],$Vf=[13,16,310],$Vg=[119,141,318,325],$Vh=[13,16,119,141,310],$Vi=[1,88],$Vj=[1,92],$Vk=[1,94],$Vl=[119,141,318,319,325],$Vm=[13,16,119,141,310,319],$Vn=[1,100],$Vo=[2,250],$Vp=[1,99],$Vq=[13,16,34,35,87,93,224,229,243,244,297,298,299,300,301,302,303,304,305,306,307,308,309,310],$Vr=[6,45,46,58,68,75,78,86,88,90],$Vs=[6,13,16,34,45,46,58,68,75,78,86,88,90,310],$Vt=[6,13,16,26,34,35,37,38,45,46,48,58,68,75,78,86,87,88,90,93,100,116,119,132,133,135,140,167,168,170,173,174,191,195,217,222,224,225,229,233,243,244,248,252,256,271,276,293,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326,328,329,331,332,333,334,335,336,337,338],$Vu=[34,35,45,46,58],$Vv=[13,16,34,35,87,273,274,275,277,279,280,282,283,286,288,297,298,299,300,301,302,303,304,305,306,307,308,309,310,338,339,340,341,342,343],$Vw=[2,451],$Vx=[1,123],$Vy=[1,117],$Vz=[1,124],$VA=[1,125],$VB=[6,13,16,34,35,46,48,87,90,93,119,167,168,170,173,174,224,229,243,244,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326],$VC=[2,309],$VD=[1,142],$VE=[1,140],$VF=[6,191],$VG=[2,326],$VH=[2,314],$VI=[45,135],$VJ=[6,48,78,86,88,90],$VK=[2,254],$VL=[1,156],$VM=[1,158],$VN=[6,48,75,78,86,88,90],$VO=[2,252],$VP=[1,164],$VQ=[1,176],$VR=[1,174],$VS=[1,184],$VT=[1,182],$VU=[1,175],$VV=[1,180],$VW=[1,181],$VX=[1,185],$VY=[1,186],$VZ=[1,189],$V_=[1,190],$V$=[1,191],$V01=[1,192],$V11=[1,193],$V21=[1,194],$V31=[1,195],$V41=[1,196],$V51=[1,197],$V61=[1,198],$V71=[1,199],$V81=[6,68,75,78,86,88,90],$V91=[37,38,191,248,276],$Va1=[37,38,191,248,252,276],$Vb1=[37,38,191,248,252,256,271,276,293,304,305,306,307,308,309,332,333,334,335,336,337,338],$Vc1=[26,37,38,191,248,252,256,271,276,293,304,305,306,307,308,309,329,332,333,334,335,336,337,338],$Vd1=[1,229],$Ve1=[1,230],$Vf1=[1,232],$Vg1=[1,233],$Vh1=[1,234],$Vi1=[1,235],$Vj1=[1,237],$Vk1=[1,238],$Vl1=[2,458],$Vm1=[1,240],$Vn1=[1,241],$Vo1=[1,242],$Vp1=[1,248],$Vq1=[1,243],$Vr1=[1,244],$Vs1=[1,245],$Vt1=[1,246],$Vu1=[1,247],$Vv1=[13,16,48,87,100,229,297,298,299,300,301,302,303,304,305,306,307,308,309,310],$Vw1=[48,93],$Vx1=[34,38],$Vy1=[6,116,191],$Vz1=[48,119],$VA1=[6,48,86,88,90],$VB1=[2,338],$VC1=[2,330],$VD1=[1,293],$VE1=[1,295],$VF1=[48,119,326],$VG1=[13,16,34,195,310],$VH1=[13,16,34,35,38,46,48,87,90,93,119,167,168,170,173,174,191,195,217,222,224,225,229,233,243,244,276,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326],$VI1=[13,16,26,34,35,37,38,46,48,87,90,93,100,119,167,168,170,173,174,191,195,217,222,224,225,229,233,243,244,248,252,256,271,276,293,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326,329,332,333,334,335,336,337,338],$VJ1=[13,16,26,34,35,37,38,46,48,87,90,93,100,119,167,168,170,173,174,191,195,217,222,224,225,229,233,243,244,248,252,256,271,276,293,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326,329,332,333,334,335,336,337,338],$VK1=[13,16,34,35,87,217,271,273,274,275,277,279,280,282,283,286,288,297,298,299,300,301,302,303,304,305,306,307,308,309,310,332,338,339,340,341,342,343],$VL1=[1,329],$VM1=[1,330],$VN1=[1,332],$VO1=[1,331],$VP1=[6,13,16,26,34,35,37,38,46,48,75,78,81,83,86,87,88,90,93,119,167,168,170,173,174,191,224,229,243,244,248,252,256,271,273,274,275,276,277,279,280,282,283,286,288,293,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326,329,332,333,334,335,336,337,338,339,340,341,342,343],$VQ1=[1,340],$VR1=[1,339],$VS1=[35,93],$VT1=[1,353],$VU1=[1,354],$VV1=[1,367],$VW1=[6,48,90],$VX1=[6,13,16,35,48,78,86,88,90,273,274,275,277,279,280,282,283,286,288,310,338,339,340,341,342,343],$VY1=[6,13,16,34,35,46,48,78,81,83,86,87,88,90,93,119,167,168,170,173,174,224,229,243,244,273,274,275,277,279,280,282,283,286,288,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326,338,339,340,341,342,343],$VZ1=[46,48,90,119,167,168,170,173,174],$V_1=[1,386],$V$1=[1,387],$V02=[1,393],$V12=[1,392],$V22=[48,119,191,225,326],$V32=[2,370],$V42=[13,16,34,35,38,87,93,224,229,243,244,297,298,299,300,301,302,303,304,305,306,307,308,309,310],$V52=[13,16,34,35,38,46,48,87,90,93,119,167,168,170,173,174,191,224,225,229,243,244,276,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326],$V62=[13,16,26,34,35,87,217,271,273,274,275,277,279,280,282,283,286,288,297,298,299,300,301,302,303,304,305,306,307,308,309,310,332,338,339,340,341,342,343],$V72=[13,16,38,48,87,100,229,297,298,299,300,301,302,303,304,305,306,307,308,309,310],$V82=[35,48],$V92=[2,329],$Va2=[1,451],$Vb2=[1,448],$Vc2=[1,449],$Vd2=[6,13,16,26,34,35,37,38,46,48,68,75,78,81,83,86,87,88,90,93,119,167,168,170,173,174,191,224,229,243,244,248,252,256,271,273,274,275,276,277,279,280,282,283,286,288,293,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326,327,329,332,333,334,335,336,337,338,339,340,341,342,343],$Ve2=[13,16,35,195,217,222,310],$Vf2=[2,384],$Vg2=[1,469],$Vh2=[46,48,90,119,167,168,170,173,174,326],$Vi2=[13,16,34,35,195,217,222,310],$Vj2=[6,13,16,34,35,48,75,78,86,88,90,273,274,275,277,279,280,282,283,286,288,310,338,339,340,341,342,343],$Vk2=[13,16,34,35,38,46,48,87,90,93,119,167,168,170,173,174,191,195,224,225,229,243,244,276,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326],$Vl2=[6,13,16,34,35,48,81,83,86,88,90,273,274,275,277,279,280,282,283,286,288,310,338,339,340,341,342,343],$Vm2=[13,16,34,35,46,48,87,90,93,119,167,168,170,173,174,224,229,243,244,297,298,299,300,301,302,303,304,305,306,307,308,309,310],$Vn2=[13,16,34,310],$Vo2=[13,16,34,35,46,48,87,90,93,119,167,168,170,173,174,224,229,243,244,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326],$Vp2=[2,341],$Vq2=[46,48,90,119,167,168,170,173,174,191,225,326],$Vr2=[13,16,34,35,37,38,46,48,87,90,93,119,167,168,170,173,174,191,195,217,222,224,225,229,233,243,244,276,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326],$Vs2=[2,336],$Vt2=[13,16,35,195,217,310],$Vu2=[13,16,34,35,38,46,48,87,90,93,119,167,168,170,173,174,191,195,217,222,224,225,229,243,244,276,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326],$Vv2=[13,16,38,87,100,229,297,298,299,300,301,302,303,304,305,306,307,308,309,310],$Vw2=[13,16,34,38,48,87,100,195,229,233,297,298,299,300,301,302,303,304,305,306,307,308,309,310],$Vx2=[13,16,34,35,48,87,93,119,224,229,243,244,297,298,299,300,301,302,303,304,305,306,307,308,309,310],$Vy2=[13,16,34,35,38,87,93,224,229,243,244,297,298,299,300,301,302,303,304,305,306,307,308,309,310,328,329],$Vz2=[13,16,26,34,35,38,87,93,224,229,243,244,297,298,299,300,301,302,303,304,305,306,307,308,309,310,328,329,331,332],$VA2=[1,630],$VB2=[1,631],$VC2=[2,324],XSD=[13,16,38,195,222,310],parser={trace:function(){},yy:{},symbols_:{error:2,QueryOrUpdate:3,Prologue:4,QueryOrUpdate_group0:5,EOF:6,Prologue_repetition0:7,Query:8,Query_group0:9,Query_option0:10,BaseDecl:11,BASE:12,IRIREF:13,PrefixDecl:14,PREFIX:15,PNAME_NS:16,SelectQuery:17,SelectClauseWildcard:18,SelectQuery_repetition0:19,WhereClause:20,SolutionModifierNoGroup:21,SelectClauseVars:22,SelectQuery_repetition1:23,SolutionModifier:24,SelectClauseBase:25,"*":26,SelectClauseVars_repetition_plus0:27,SELECT:28,SelectClauseBase_option0:29,SubSelect:30,SubSelect_option0:31,SubSelect_option1:32,SelectClauseItem:33,VAR:34,"(":35,Expression:36,AS:37,")":38,VarTriple:39,ConstructQuery:40,CONSTRUCT:41,ConstructTemplate:42,ConstructQuery_repetition0:43,ConstructQuery_repetition1:44,WHERE:45,"{":46,ConstructQuery_option0:47,"}":48,DescribeQuery:49,DESCRIBE:50,DescribeQuery_group0:51,DescribeQuery_repetition0:52,DescribeQuery_option0:53,AskQuery:54,ASK:55,AskQuery_repetition0:56,DatasetClause:57,FROM:58,DatasetClause_option0:59,iri:60,WhereClause_option0:61,GroupGraphPattern:62,SolutionModifier_option0:63,SolutionModifierNoGroup_option0:64,SolutionModifierNoGroup_option1:65,SolutionModifierNoGroup_option2:66,GroupClause:67,GROUP:68,BY:69,GroupClause_repetition_plus0:70,GroupCondition:71,BuiltInCall:72,FunctionCall:73,HavingClause:74,HAVING:75,HavingClause_repetition_plus0:76,OrderClause:77,ORDER:78,OrderClause_repetition_plus0:79,OrderCondition:80,ASC:81,BrackettedExpression:82,DESC:83,Constraint:84,LimitOffsetClauses:85,LIMIT:86,INTEGER:87,OFFSET:88,ValuesClause:89,VALUES:90,InlineData:91,InlineData_repetition0:92,NIL:93,InlineData_repetition1:94,InlineData_repetition_plus2:95,InlineData_repetition3:96,DataBlockValue:97,Literal:98,ConstTriple:99,UNDEF:100,DataBlockValueList:101,DataBlockValueList_repetition_plus0:102,Update:103,Update_repetition0:104,Update1:105,Update_option0:106,LOAD:107,Update1_option0:108,Update1_option1:109,Update1_group0:110,Update1_option2:111,GraphRefAll:112,Update1_group1:113,Update1_option3:114,GraphOrDefault:115,TO:116,CREATE:117,Update1_option4:118,GRAPH:119,INSERTDATA:120,QuadPattern:121,DELETEDATA:122,DELETEWHERE:123,Update1_option5:124,InsertClause:125,Update1_option6:126,Update1_repetition0:127,Update1_option7:128,DeleteClause:129,Update1_option8:130,Update1_repetition1:131,DELETE:132,INSERT:133,UsingClause:134,USING:135,UsingClause_option0:136,WithClause:137,WITH:138,IntoGraphClause:139,INTO:140,DEFAULT:141,GraphOrDefault_option0:142,GraphRefAll_group0:143,QuadPattern_option0:144,QuadPattern_repetition0:145,QuadsNotTriples:146,QuadsNotTriples_group0:147,QuadsNotTriples_option0:148,QuadsNotTriples_option1:149,QuadsNotTriples_option2:150,TriplesTemplate:151,TriplesTemplate_repetition0:152,TriplesSameSubject:153,TriplesTemplate_option0:154,GroupGraphPatternSub:155,GroupGraphPatternSub_option0:156,GroupGraphPatternSub_repetition0:157,GroupGraphPatternSubTail:158,GraphPatternNotTriples:159,GroupGraphPatternSubTail_option0:160,GroupGraphPatternSubTail_option1:161,TriplesBlock:162,TriplesBlock_repetition0:163,TriplesSameSubjectPath:164,TriplesBlock_option0:165,GraphPatternNotTriples_repetition0:166,OPTIONAL:167,MINUS:168,GraphPatternNotTriples_group0:169,SERVICE:170,GraphPatternNotTriples_option0:171,GraphPatternNotTriples_group1:172,FILTER:173,BIND:174,FunctionCall_option0:175,FunctionCall_repetition0:176,ExpressionList:177,ExpressionList_repetition0:178,ConstructTemplate_option0:179,ConstructTriples:180,ConstructTriples_repetition0:181,ConstructTriples_option0:182,TriplesSameSubject_group0:183,PropertyListNotEmpty:184,TriplesNode:185,PropertyList:186,PropertyList_option0:187,VerbObjectList:188,PropertyListNotEmpty_repetition0:189,SemiOptionalVerbObjectList:190,";":191,SemiOptionalVerbObjectList_option0:192,Verb:193,ObjectList:194,a:195,ObjectList_repetition0:196,GraphNode:197,TriplesSameSubjectPath_group0:198,PropertyListPathNotEmpty:199,TriplesNodePath:200,TriplesSameSubjectPath_option0:201,PropertyListPathNotEmpty_group0:202,PropertyListPathNotEmpty_repetition0:203,GraphNodePath:204,PropertyListPathNotEmpty_repetition1:205,PropertyListPathNotEmptyTail:206,PropertyListPathNotEmptyTail_group0:207,Path:208,Path_repetition0:209,PathSequence:210,PathSequence_repetition0:211,PathEltOrInverse:212,PathElt:213,PathPrimary:214,PathElt_option0:215,PathEltOrInverse_option0:216,"!":217,PathNegatedPropertySet:218,PathOneInPropertySet:219,PathNegatedPropertySet_repetition0:220,PathNegatedPropertySet_option0:221,"^":222,TriplesNode_repetition_plus0:223,"[":224,"]":225,TriplesNodePath_repetition_plus0:226,GraphNode_group0:227,GraphNodePath_group0:228,"<<":229,VarTriple_group0:230,VarTriple_group1:231,VarTriple_group2:232,">>":233,VarTriple_group3:234,VarTriple_group4:235,ConstTriple_group0:236,ConstTriple_group1:237,ConstTriple_group2:238,ConstTriple_group3:239,ConstTriple_group4:240,VarOrTerm:241,Term:242,BLANK_NODE_LABEL:243,ANON:244,ConditionalAndExpression:245,Expression_repetition0:246,ExpressionTail:247,"||":248,RelationalExpression:249,ConditionalAndExpression_repetition0:250,ConditionalAndExpressionTail:251,"&&":252,AdditiveExpression:253,RelationalExpression_group0:254,RelationalExpression_option0:255,IN:256,MultiplicativeExpression:257,AdditiveExpression_repetition0:258,AdditiveExpressionTail:259,AdditiveExpressionTail_group0:260,NumericLiteralPositive:261,AdditiveExpressionTail_repetition0:262,NumericLiteralNegative:263,AdditiveExpressionTail_repetition1:264,UnaryExpression:265,MultiplicativeExpression_repetition0:266,MultiplicativeExpressionTail:267,MultiplicativeExpressionTail_group0:268,UnaryExpression_option0:269,PrimaryExpression:270,"-":271,Aggregate:272,FUNC_ARITY0:273,FUNC_ARITY1:274,FUNC_ARITY2:275,",":276,IF:277,BuiltInCall_group0:278,BOUND:279,BNODE:280,BuiltInCall_option0:281,EXISTS:282,COUNT:283,Aggregate_option0:284,Aggregate_group0:285,FUNC_AGGREGATE:286,Aggregate_option1:287,GROUP_CONCAT:288,Aggregate_option2:289,Aggregate_option3:290,GroupConcatSeparator:291,SEPARATOR:292,"=":293,String:294,LANGTAG:295,"^^":296,DECIMAL:297,DOUBLE:298,BOOLEAN:299,STRING_LITERAL1:300,STRING_LITERAL2:301,STRING_LITERAL_LONG1:302,STRING_LITERAL_LONG2:303,INTEGER_POSITIVE:304,DECIMAL_POSITIVE:305,DOUBLE_POSITIVE:306,INTEGER_NEGATIVE:307,DECIMAL_NEGATIVE:308,DOUBLE_NEGATIVE:309,PNAME_LN:310,QueryOrUpdate_group0_option0:311,Prologue_repetition0_group0:312,SelectClauseBase_option0_group0:313,DISTINCT:314,REDUCED:315,DescribeQuery_group0_repetition_plus0_group0:316,DescribeQuery_group0_repetition_plus0:317,NAMED:318,SILENT:319,CLEAR:320,DROP:321,ADD:322,MOVE:323,COPY:324,ALL:325,".":326,UNION:327,"|":328,"/":329,PathElt_option0_group0:330,"?":331,"+":332,"!=":333,"<":334,">":335,"<=":336,">=":337,NOT:338,CONCAT:339,COALESCE:340,SUBSTR:341,REGEX:342,REPLACE:343,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",12:"BASE",13:"IRIREF",15:"PREFIX",16:"PNAME_NS",26:"*",28:"SELECT",34:"VAR",35:"(",37:"AS",38:")",41:"CONSTRUCT",45:"WHERE",46:"{",48:"}",50:"DESCRIBE",55:"ASK",58:"FROM",68:"GROUP",69:"BY",75:"HAVING",78:"ORDER",81:"ASC",83:"DESC",86:"LIMIT",87:"INTEGER",88:"OFFSET",90:"VALUES",93:"NIL",100:"UNDEF",107:"LOAD",116:"TO",117:"CREATE",119:"GRAPH",120:"INSERTDATA",122:"DELETEDATA",123:"DELETEWHERE",132:"DELETE",133:"INSERT",135:"USING",138:"WITH",140:"INTO",141:"DEFAULT",167:"OPTIONAL",168:"MINUS",170:"SERVICE",173:"FILTER",174:"BIND",191:";",195:"a",217:"!",222:"^",224:"[",225:"]",229:"<<",233:">>",243:"BLANK_NODE_LABEL",244:"ANON",248:"||",252:"&&",256:"IN",271:"-",273:"FUNC_ARITY0",274:"FUNC_ARITY1",275:"FUNC_ARITY2",276:",",277:"IF",279:"BOUND",280:"BNODE",282:"EXISTS",283:"COUNT",286:"FUNC_AGGREGATE",288:"GROUP_CONCAT",292:"SEPARATOR",293:"=",295:"LANGTAG",296:"^^",297:"DECIMAL",298:"DOUBLE",299:"BOOLEAN",300:"STRING_LITERAL1",301:"STRING_LITERAL2",302:"STRING_LITERAL_LONG1",303:"STRING_LITERAL_LONG2",304:"INTEGER_POSITIVE",305:"DECIMAL_POSITIVE",306:"DOUBLE_POSITIVE",307:"INTEGER_NEGATIVE",308:"DECIMAL_NEGATIVE",309:"DOUBLE_NEGATIVE",310:"PNAME_LN",314:"DISTINCT",315:"REDUCED",318:"NAMED",319:"SILENT",320:"CLEAR",321:"DROP",322:"ADD",323:"MOVE",324:"COPY",325:"ALL",326:".",327:"UNION",328:"|",329:"/",331:"?",332:"+",333:"!=",334:"<",335:">",336:"<=",337:">=",338:"NOT",339:"CONCAT",340:"COALESCE",341:"SUBSTR",342:"REGEX",343:"REPLACE"},productions_:[0,[3,3],[4,1],[8,2],[11,2],[14,3],[17,4],[17,4],[18,2],[22,2],[25,2],[30,4],[30,4],[33,1],[33,5],[33,5],[40,5],[40,7],[49,5],[54,4],[57,3],[20,2],[24,2],[21,3],[67,3],[71,1],[71,1],[71,3],[71,5],[71,1],[74,2],[77,3],[80,2],[80,2],[80,1],[80,1],[85,2],[85,2],[85,4],[85,4],[89,2],[91,4],[91,4],[91,6],[97,1],[97,1],[97,1],[97,1],[101,3],[103,3],[105,4],[105,3],[105,5],[105,4],[105,2],[105,2],[105,2],[105,6],[105,6],[129,2],[125,2],[134,3],[137,2],[139,3],[115,1],[115,2],[112,2],[112,1],[121,4],[146,7],[151,3],[62,3],[62,3],[155,2],[158,3],[162,3],[159,2],[159,2],[159,2],[159,3],[159,4],[159,2],[159,6],[159,6],[159,1],[84,1],[84,1],[84,1],[73,2],[73,6],[177,1],[177,4],[42,3],[180,3],[153,2],[153,2],[186,1],[184,2],[190,2],[188,2],[193,1],[193,1],[193,1],[194,2],[164,2],[164,2],[199,4],[206,1],[206,3],[208,2],[210,2],[213,2],[212,2],[214,1],[214,1],[214,2],[214,3],[218,1],[218,1],[218,4],[219,1],[219,1],[219,2],[219,2],[185,3],[185,3],[200,3],[200,3],[197,1],[197,1],[204,1],[204,1],[39,9],[39,5],[99,9],[99,5],[241,1],[241,1],[242,1],[242,1],[242,1],[242,1],[242,1],[36,2],[247,2],[245,2],[251,2],[249,1],[249,3],[249,4],[253,2],[259,2],[259,2],[259,2],[257,2],[267,2],[265,2],[265,2],[265,2],[270,1],[270,1],[270,1],[270,1],[270,1],[270,1],[82,3],[72,1],[72,2],[72,4],[72,6],[72,8],[72,2],[72,4],[72,2],[72,4],[72,3],[272,5],[272,5],[272,6],[291,4],[98,1],[98,2],[98,3],[98,1],[98,1],[98,1],[98,1],[98,1],[98,1],[294,1],[294,1],[294,1],[294,1],[261,1],[261,1],[261,1],[263,1],[263,1],[263,1],[60,1],[60,1],[60,1],[311,0],[311,1],[5,1],[5,1],[312,1],[312,1],[7,0],[7,2],[9,1],[9,1],[9,1],[9,1],[10,0],[10,1],[19,0],[19,2],[23,0],[23,2],[27,1],[27,2],[313,1],[313,1],[29,0],[29,1],[31,0],[31,1],[32,0],[32,1],[43,0],[43,2],[44,0],[44,2],[47,0],[47,1],[316,1],[316,1],[317,1],[317,2],[51,1],[51,1],[52,0],[52,2],[53,0],[53,1],[56,0],[56,2],[59,0],[59,1],[61,0],[61,1],[63,0],[63,1],[64,0],[64,1],[65,0],[65,1],[66,0],[66,1],[70,1],[70,2],[76,1],[76,2],[79,1],[79,2],[92,0],[92,2],[94,0],[94,2],[95,1],[95,2],[96,0],[96,2],[102,1],[102,2],[104,0],[104,4],[106,0],[106,2],[108,0],[108,1],[109,0],[109,1],[110,1],[110,1],[111,0],[111,1],[113,1],[113,1],[113,1],[114,0],[114,1],[118,0],[118,1],[124,0],[124,1],[126,0],[126,1],[127,0],[127,2],[128,0],[128,1],[130,0],[130,1],[131,0],[131,2],[136,0],[136,1],[142,0],[142,1],[143,1],[143,1],[143,1],[144,0],[144,1],[145,0],[145,2],[147,1],[147,1],[148,0],[148,1],[149,0],[149,1],[150,0],[150,1],[152,0],[152,3],[154,0],[154,1],[156,0],[156,1],[157,0],[157,2],[160,0],[160,1],[161,0],[161,1],[163,0],[163,3],[165,0],[165,1],[166,0],[166,3],[169,1],[169,1],[171,0],[171,1],[172,1],[172,1],[175,0],[175,1],[176,0],[176,3],[178,0],[178,3],[179,0],[179,1],[181,0],[181,3],[182,0],[182,1],[183,1],[183,1],[187,0],[187,1],[189,0],[189,2],[192,0],[192,1],[196,0],[196,3],[198,1],[198,1],[201,0],[201,1],[202,1],[202,1],[203,0],[203,3],[205,0],[205,2],[207,1],[207,1],[209,0],[209,3],[211,0],[211,3],[330,1],[330,1],[330,1],[215,0],[215,1],[216,0],[216,1],[220,0],[220,3],[221,0],[221,1],[223,1],[223,2],[226,1],[226,2],[227,1],[227,1],[228,1],[228,1],[230,1],[230,1],[231,1],[231,1],[232,1],[232,1],[234,1],[234,1],[235,1],[235,1],[236,1],[236,1],[237,1],[237,1],[238,1],[238,1],[239,1],[239,1],[240,1],[240,1],[246,0],[246,2],[250,0],[250,2],[254,1],[254,1],[254,1],[254,1],[254,1],[254,1],[255,0],[255,1],[258,0],[258,2],[260,1],[260,1],[262,0],[262,2],[264,0],[264,2],[266,0],[266,2],[268,1],[268,1],[269,0],[269,1],[278,1],[278,1],[278,1],[278,1],[278,1],[281,0],[281,1],[284,0],[284,1],[285,1],[285,1],[287,0],[287,1],[289,0],[289,1],[290,0],[290,1]],performAction:function(yytext,yyleng,yylineno,yy,yystate,$$,_$){var entity,$0=$$.length-1;switch(yystate){case 1:if($$[$0-1]=$$[$0-1]||{},Parser.base&&($$[$0-1].base=Parser.base),Parser.base="",$$[$0-1].prefixes=Parser.prefixes,Parser.prefixes=null,"update"===$$[$0-1].type){const insertBnodesAll={};for(const update of $$[$0-1].updates)if("insert"===update.updateType){const insertBnodes={};for(const operation of update.insert)if("bgp"===operation.type||"graph"===operation.type)for(const triple of operation.triples)"BlankNode"===triple.subject.termType&&(insertBnodes[triple.subject.value]=!0),"BlankNode"===triple.predicate.termType&&(insertBnodes[triple.predicate.value]=!0),"BlankNode"===triple.object.termType&&(insertBnodes[triple.object.value]=!0);for(const bnode of Object.keys(insertBnodes)){if(insertBnodesAll[bnode])throw new Error("Detected reuse blank node across different INSERT DATA clauses");insertBnodesAll[bnode]=!0}}}return $$[$0-1];case 3:this.$=extend($$[$0-1],$$[$0],{type:"query"});break;case 4:Parser.base=resolveIRI($$[$0]);break;case 5:Parser.prefixes||(Parser.prefixes={}),$$[$0-1]=$$[$0-1].substr(0,$$[$0-1].length-1),$$[$0]=resolveIRI($$[$0]),Parser.prefixes[$$[$0-1]]=$$[$0];break;case 6:this.$=extend($$[$0-3],groupDatasets($$[$0-2]),$$[$0-1],$$[$0]);break;case 7:if(!Parser.skipUngroupedVariableCheck)if(flatten($$[$0-3].variables.map(vars=>getAggregatesOfExpression(vars.expression))).some(agg=>"count"===agg.aggregation&&!(agg.expression instanceof Wildcard))||$$[$0].group)for(const selectVar of $$[$0-3].variables)if("Variable"===selectVar.termType){if(!$$[$0].group||!$$[$0].group.map(groupVar=>getExpressionId(groupVar)).includes(getExpressionId(selectVar)))throw Error("Projection of ungrouped variable (?"+getExpressionId(selectVar)+")")}else if(0===getAggregatesOfExpression(selectVar.expression).length)for(const usedVar of function(expression){const variables=new Set,visitExpression=function(expr){expr&&("Variable"===expr.termType?variables.add(expr):"operation"===expr.type&&expr.args.forEach(visitExpression))};return visitExpression(expression),variables}(selectVar.expression))if(!$$[$0].group.map(groupVar=>getExpressionId(groupVar)).includes(getExpressionId(usedVar)))throw Error("Use of ungrouped variable in projection of operation (?"+getExpressionId(usedVar)+")");const subqueries=$$[$0-1].where.filter(w=>"query"===w.type);if(0v.variable&&v.variable.value).map(v=>v.variable.value),subqueryIds=flatten(subqueries.map(sub=>sub.variables)).map(v=>v.value||v.variable.value);for(const selectedVarId of selectedVarIds)if(0<=subqueryIds.indexOf(selectedVarId))throw Error("Target id of 'AS' (?"+selectedVarId+") already used in subquery")}this.$=extend($$[$0-3],groupDatasets($$[$0-2]),$$[$0-1],$$[$0]);break;case 8:this.$=extend($$[$0-1],{variables:[new Wildcard]});break;case 9:var graph=function(array){const sortedArray=array.slice().sort(),duplicates=[];for(let i=0;iv.value||v.variable.value));if(0"bind"===el.type)){var index=$$[$0-1].indexOf(binding);const boundVars=new Set;for(const el of $$[$0-1].slice(0,index))"group"!==el.type&&"bgp"!==el.type||!function getBoundVarsFromGroupGraphPattern(pattern){{if(pattern.triples){const boundVars=[];for(const triple of pattern.triples)isVariable(triple.subject)&&boundVars.push(triple.subject.value),isVariable(triple.predicate)&&boundVars.push(triple.predicate.value),isVariable(triple.object)&&boundVars.push(triple.object.value);return boundVars}if(pattern.patterns){const boundVars=[];for(const pat of pattern.patterns)boundVars.push(...getBoundVarsFromGroupGraphPattern(pat));return boundVars}}return[]}(el).forEach(boundVar=>boundVars.add(boundVar));if(boundVars.has(binding.variable.value))throw Error("Variable used to bind is already bound (?"+binding.variable.value+")")}this.$={type:"group",patterns:$$[$0-1]};break;case 73:this.$=$$[$0-1]?unionAll([$$[$0-1]],$$[$0]):unionAll($$[$0]);break;case 74:this.$=$$[$0]?[$$[$0-2],$$[$0]]:$$[$0-2];break;case 76:$$[$0-1].length?this.$={type:"union",patterns:unionAll($$[$0-1].map(degroupSingle),[degroupSingle($$[$0])])}:this.$=$$[$0];break;case 77:this.$=extend($$[$0],{type:"optional"});break;case 78:this.$=extend($$[$0],{type:"minus"});break;case 79:this.$=extend($$[$0],{type:"graph",name:toVar($$[$0-1])});break;case 80:this.$=extend($$[$0],{type:"service",name:toVar($$[$0-1]),silent:!!$$[$0-2]});break;case 81:this.$={type:"filter",expression:$$[$0]};break;case 82:this.$={type:"bind",variable:toVar($$[$0-1]),expression:$$[$0-3]};break;case 83:this.$=ensureSparqlStar({type:"bind",variable:toVar($$[$0-1]),expression:$$[$0-3]});break;case 88:this.$={type:"functionCall",function:$$[$0-1],args:[]};break;case 89:this.$={type:"functionCall",function:$$[$0-5],args:appendTo($$[$0-2],$$[$0-1]),distinct:!!$$[$0-3]};break;case 90:case 107:case 118:case 208:case 216:case 218:case 230:case 232:case 242:case 246:case 266:case 268:case 272:case 276:case 299:case 305:case 316:case 326:case 332:case 338:case 342:case 352:case 354:case 358:case 366:case 370:case 378:case 380:case 384:case 386:case 395:case 427:case 429:case 439:case 443:case 445:case 447:this.$=[];break;case 91:this.$=appendTo($$[$0-2],$$[$0-1]);break;case 93:this.$=unionAll($$[$0-2],[$$[$0-1]]);break;case 94:case 104:this.$=$$[$0].map(function(t){return extend(triple($$[$0-1]),t)});break;case 95:this.$=appendAllTo($$[$0].map(function(t){return extend(triple($$[$0-1].entity),t)}),$$[$0-1].triples);break;case 97:this.$=unionAll([$$[$0-1]],$$[$0]);break;case 98:this.$=unionAll($$[$0]);break;case 99:this.$=objectListToTriples($$[$0-1],$$[$0]);break;case 102:case 114:case 121:this.$=Parser.factory.namedNode(RDF_TYPE);break;case 103:this.$=appendTo($$[$0-1],$$[$0]);break;case 105:this.$=$$[$0]?appendAllTo($$[$0].map(function(t){return extend(triple($$[$0-1].entity),t)}),$$[$0-1].triples):$$[$0-1].triples;break;case 106:this.$=objectListToTriples(toVar($$[$0-3]),appendTo($$[$0-2],$$[$0-1]),$$[$0]);break;case 108:this.$=objectListToTriples(toVar($$[$0-1]),$$[$0]);break;case 109:this.$=$$[$0-1].length?path("|",appendTo($$[$0-1],$$[$0])):$$[$0];break;case 110:this.$=$$[$0-1].length?path("/",appendTo($$[$0-1],$$[$0])):$$[$0];break;case 111:this.$=$$[$0]?path($$[$0],[$$[$0-1]]):$$[$0-1];break;case 112:this.$=$$[$0-1]?path($$[$0-1],[$$[$0]]):$$[$0];break;case 115:case 122:this.$=path($$[$0-1],[$$[$0]]);break;case 119:this.$=path("|",appendTo($$[$0-2],$$[$0-1]));break;case 123:this.$=path($$[$0-1],[Parser.factory.namedNode(RDF_TYPE)]);break;case 124:case 126:this.$=function(objects){var list=blank(),head=list,listItems=[],triples=[];objects.forEach(function(o){listItems.push(o.entity),appendAllTo(triples,o.triples)});for(var i=0,j=0,l=listItems.length,listTriples=Array(2*l);i>10),56320+(1023&charCode))}replacement=escapeReplacements[replacement];if(!replacement)throw new Error;return replacement})}catch(error){return""}if(partialSurrogatesWithoutEndpoint.exec(string))throw new Error("Invalid unicode codepoint of surrogate pair without corresponding codepoint in "+string);return string}function objectListToTriples(predicate,objectList,otherTriples){var objects=[],triples=[];return objectList.forEach(function(l){objects.push(triple(null,predicate,l.entity)),appendAllTo(triples,l.triples)}),unionAll(objects,otherTriples||[],triples)}function getExpressionId(expression){return expression.variable?expression.variable.value:expression.value||expression.expression.value}function getAggregatesOfExpression(expression){if(!expression)return[];if("aggregate"===expression.type)return[expression];if("operation"!==expression.type)return[];{const aggregates=[];for(const arg of expression.args)aggregates.push(...getAggregatesOfExpression(arg));return aggregates}}function flatten(input,depth=1,stack=[]){for(const item of input)0match[0].length))if(match=tempMatch,index=i,this.options.backtrack_lexer){if(!1!==(token=this.test_match(tempMatch,rules[i])))return token;if(!this._backtrack)return!1;match=!1}else if(!this.options.flex)break;return match?!1!==(token=this.test_match(match,rules[index]))&&token:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var r=this.next();return r||this.lex()},begin:function(condition){this.conditionStack.push(condition)},popState:function(){return 0>)/i,/^(?:,)/i,/^(?:a)/i,/^(?:\|)/i,/^(?:\/)/i,/^(?:\^)/i,/^(?:\?)/i,/^(?:\+)/i,/^(?:!)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:\|\|)/i,/^(?:&&)/i,/^(?:=)/i,/^(?:!=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:IN)/i,/^(?:NOT)/i,/^(?:-)/i,/^(?:BOUND)/i,/^(?:BNODE)/i,/^(?:(RAND|NOW|UUID|STRUUID))/i,/^(?:(LANG|DATATYPE|IRI|URI|ABS|CEIL|FLOOR|ROUND|STRLEN|STR|UCASE|LCASE|ENCODE_FOR_URI|YEAR|MONTH|DAY|HOURS|MINUTES|SECONDS|TIMEZONE|TZ|MD5|SHA1|SHA256|SHA384|SHA512|isIRI|isURI|isBLANK|isLITERAL|isNUMERIC))/i,/^(?:(LANGMATCHES|CONTAINS|STRSTARTS|STRENDS|STRBEFORE|STRAFTER|STRLANG|STRDT|sameTerm))/i,/^(?:CONCAT)/i,/^(?:COALESCE)/i,/^(?:IF)/i,/^(?:REGEX)/i,/^(?:SUBSTR)/i,/^(?:REPLACE)/i,/^(?:EXISTS)/i,/^(?:COUNT)/i,/^(?:SUM|MIN|MAX|AVG|SAMPLE)/i,/^(?:GROUP_CONCAT)/i,/^(?:SEPARATOR)/i,/^(?:\^\^)/i,/^(?:true|false)/i,/^(?:(<(?:[^<>\"\{\}\|\^`\\\u0000-\u0020])*>))/i,/^(?:((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:))/i,/^(?:(((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:)((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|:|[0-9]|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))*(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%)))))?)))/i,/^(?:(_:(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?))/i,/^(?:([\?\$]((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])*)))/i,/^(?:(@[a-zA-Z]+(?:-[a-zA-Z0-9]+)*))/i,/^(?:([0-9]+))/i,/^(?:([0-9]*\.[0-9]+))/i,/^(?:([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+)))/i,/^(?:(\+([0-9]+)))/i,/^(?:(\+([0-9]*\.[0-9]+)))/i,/^(?:(\+([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:(-([0-9]+)))/i,/^(?:(-([0-9]*\.[0-9]+)))/i,/^(?:(-([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:([eE][+-]?[0-9]+))/i,/^(?:('(?:(?:[^\u0027\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*'))/i,/^(?:("(?:(?:[^\u0022\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*"))/i,/^(?:('''(?:(?:'|'')?(?:[^'\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*'''))/i,/^(?:("""(?:(?:"|"")?(?:[^\"\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*"""))/i,/^(?:(\((\u0020|\u0009|\u000D|\u000A)*\)))/i,/^(?:(\[(\u0020|\u0009|\u000D|\u000A)*\]))/i,/^(?:$)/i,/^(?:.)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121],inclusive:!0}}},new((Parser.prototype=parser).Parser=Parser)}();void 0!==require&&void 0!==exports&&(exports.parser=SparqlParser,exports.Parser=SparqlParser.Parser,exports.parse=function(){return SparqlParser.parse.apply(SparqlParser,arguments)},exports.main=function(source){source[1]||(console.log("Usage: "+source[0]+" FILE"),process.exit(1));source=require("fs").readFileSync(require("path").normalize(source[1]),"utf8");return exports.parser.parse(source)},void 0!==module&&require.main===module&&exports.main(process.argv.slice(1)))}.call(this)}.call(this,require("_process"))},{"./Wildcard":38,_process:21,fs:21,path:21}],38:[function(require,module,exports){class Wildcard{constructor(){return WILDCARD||this}equals(other){return other&&this.termType===other.termType}}Object.defineProperty(Wildcard.prototype,"value",{enumerable:!0,value:"*"}),Object.defineProperty(Wildcard.prototype,"termType",{enumerable:!0,value:"Wildcard"});var WILDCARD=new Wildcard;module.exports.Wildcard=Wildcard},{}],39:[function(require,module,exports){var Parser=require("./lib/SparqlParser").Parser,Generator=require("./lib/SparqlGenerator"),Wildcard=require("./lib/Wildcard").Wildcard,{DataFactory}=require("rdf-data-factory");module.exports={Parser:function({prefixes,baseIRI,factory,sparqlStar,skipUngroupedVariableCheck}={}){var prefix,prefixesCopy={};for(prefix in prefixes||{})prefixesCopy[prefix]=prefixes[prefix];var parser=new Parser;return parser.parse=function(){return Parser.base=baseIRI||"",Parser.prefixes=Object.create(prefixesCopy),Parser.factory=factory||new DataFactory,Parser.sparqlStar=Boolean(sparqlStar),Parser.skipUngroupedVariableCheck=Boolean(skipUngroupedVariableCheck),Parser.prototype.parse.apply(parser,arguments)},parser._resetBlanks=Parser._resetBlanks,parser},Generator:Generator,Wildcard:Wildcard}},{"./lib/SparqlGenerator":36,"./lib/SparqlParser":37,"./lib/Wildcard":38,"rdf-data-factory":22}],40:[function(require,module,exports){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P=P||Promise)(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):((value=result.value)instanceof P?value:new P(function(resolve){resolve(value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.AppMain=void 0;class AppMain extends HTMLElement{get sparql(){return this.querySelector("sparql-editor")}get blockly(){return this.querySelector("blockly-canvas")}connectedCallback(){return __awaiter(this,void 0,void 0,function*(){document.addEventListener("DOMContentLoaded",()=>{this.sparql.addEventListener("sparql",this.sparqlChanged.bind(this)),this.sparql.addEventListener("input",this.sparqlInput.bind(this)),this.blockly.addEventListener("blocks",this.blocksChanged.bind(this)),this.blockly.addEventListener("load",this.blocksLoaded.bind(this))})})}sparqlChanged(e){this.blockly.dom=e.detail}sparqlInput(){this.updateUrl()}blocksChanged(e){this.sparql.value=e.detail,this.updateUrl()}updateUrl(){window.location.hash=this.sparql.value}blocksLoaded(){var h=window.location.hash.split("#")[1];h&&this.sparql.setAndNotify(decodeURI(h))}}exports.AppMain=AppMain},{}],41:[function(require,module,exports){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P=P||Promise)(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):((value=result.value)instanceof P?value:new P(function(resolve){resolve(value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.BlocklyCanvas=void 0;const Blockly=require("blockly"),SparqlBlockly=require("sparql-blockly");class BlocklyCanvas extends HTMLElement{constructor(){super(...arguments),this.typing=!1}getToolboxData(){return __awaiter(this,void 0,void 0,function*(){var url=this.getAttribute("toolbox-data");const response=yield fetch(url);return yield response.text()})}set dom(value){if(value){const workspace=Blockly.getMainWorkspace();workspace.clear(),this.typing=!0,Blockly.Xml.domToWorkspace(value,workspace)}}connectedCallback(){return __awaiter(this,void 0,void 0,function*(){var options={sounds:!1,toolbox:yield this.getToolboxData(),horizontalLayout:!0,zoom:{controls:!0,wheel:!0,startScale:1,maxScale:3,minScale:.01,scaleSpeed:1.2,pinch:!0}};const workspace=Blockly.inject(this,options);workspace.addChangeListener(this.workspaceChanged.bind(this)),window.setInterval(()=>Blockly.svgResize(workspace),1e3),this.dispatchEvent(new Event("load"))})}workspaceChanged(e){switch(e.type){case Blockly.Events.CHANGE:case Blockly.Events.DELETE:case Blockly.Events.MOVE:this.typing||this.generateCode();break;case Blockly.Events.FINISHED_LOADING:this.typing=!1}}generateCode(){const workspace=Blockly.getMainWorkspace();for(const block of workspace.getTopBlocks(!1))switch(block.type){case"sparql11_query":case"sparql11_update":this.dispatchEvent(new CustomEvent("blocks",{detail:SparqlBlockly.blocklyToSparql(block)}))}}}exports.BlocklyCanvas=BlocklyCanvas},{blockly:17,"sparql-blockly":35}],42:[function(require,module,exports){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P=P||Promise)(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):((value=result.value)instanceof P?value:new P(function(resolve){resolve(value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SparqlEditor=void 0;const SparqlJS=require("sparqljs"),SparqlBlockly=require("sparql-blockly");class SparqlEditor extends HTMLElement{connectedCallback(){return __awaiter(this,void 0,void 0,function*(){this.editorElement.addEventListener("input",this.input.bind(this))})}get editorElement(){return this.querySelector("textarea")}get errorElement(){return this.querySelector("span")}set error(value){this.errorElement.innerText=value}get value(){return this.editorElement.value}set value(value){this.editorElement.value=value,this.validate()}setAndNotify(value){this.editorElement.value=value,this.input()}input(){var query=this.validate();query&&this.dispatchEvent(new CustomEvent("sparql",{detail:SparqlBlockly.sparqlToBlockly(query)}))}validate(){this.error="",this.classList.remove("invalid"),this.classList.remove("valid");var sparql=this.value;if(sparql){const parser=new SparqlJS.Parser({sparqlStar:!0});try{var query=parser.parse(sparql);return this.classList.add("valid"),query}catch(e){this.error=e.message,this.classList.add("invalid")}}}}exports.SparqlEditor=SparqlEditor},{"sparql-blockly":35,sparqljs:39}],43:[function(SparqlEditor_1,module,BlocklyCanvas_1){"use strict";Object.defineProperty(BlocklyCanvas_1,"__esModule",{value:!0});var AppMain_1=SparqlEditor_1("./AppMain"),BlocklyCanvas_1=SparqlEditor_1("./BlocklyCanvas"),SparqlEditor_1=SparqlEditor_1("./SparqlEditor");customElements.define("app-main",AppMain_1.AppMain),customElements.define("blockly-canvas",BlocklyCanvas_1.BlocklyCanvas),customElements.define("sparql-editor",SparqlEditor_1.SparqlEditor)},{"./AppMain":40,"./BlocklyCanvas":41,"./SparqlEditor":42}]},{},[43]); +!function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var p="function"==typeof require&&require;if(!f&&p)return p(i,!0);if(u)return u(i,!0);throw(p=new Error("Cannot find module '"+i+"'")).code="MODULE_NOT_FOUND",p}p=n[i]={exports:{}},e[i][0].call(p.exports,function(r){return o(e[i][1][r]||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i"}},{}],8:[function(require,module,exports){const term=require("./term");module.exports=function(graphString){var subjectString=term(graphString.subject),predicateString=term(graphString.predicate),objectString=term(graphString.object),graphString=term(graphString.graph);return`${subjectString} ${predicateString} ${objectString} ${graphString?graphString+" ":""}.`}},{"./term":9}],9:[function(require,module,exports){const blankNode=require("./blankNode"),defaultGraph=require("./defaultGraph"),literal=require("./literal"),namedNode=require("./namedNode"),variable=require("./variable");module.exports=function(term){switch(term.termType){case"BlankNode":return blankNode(term);case"DefaultGraph":return defaultGraph(term);case"Literal":return literal(term);case"NamedNode":return namedNode(term);case"Variable":return variable(term);default:return}}},{"./blankNode":4,"./defaultGraph":5,"./literal":6,"./namedNode":7,"./variable":10}],10:[function(require,module,exports){module.exports=function(variable){return"?"+variable.value}},{}],11:[function(require,module,exports){var root,factory;root=this,factory=function(Blockly){"use strict";return Blockly},"function"==typeof define&&define.amd?define(["./blockly_compressed"],factory):"object"==typeof exports?module.exports=factory(require("./blockly_compressed")):root.Blockly=factory(root.Blockly)},{"./blockly_compressed":12}],12:[function(require,module,exports){!function(global){!function(){var root,factory;root=this,factory=function(){"use strict";var Blockly={connectionTypes:{INPUT_VALUE:1,OUTPUT_VALUE:2,NEXT_STATEMENT:3,PREVIOUS_STATEMENT:4},constants:{},LINE_MODE_MULTIPLIER:40,PAGE_MODE_MULTIPLIER:125,DRAG_RADIUS:5,FLYOUT_DRAG_RADIUS:10,SNAP_RADIUS:28};return Blockly.CONNECTING_SNAP_RADIUS=Blockly.SNAP_RADIUS,Blockly.CURRENT_CONNECTION_PREFERENCE=8,Blockly.BUMP_DELAY=250,Blockly.BUMP_RANDOMNESS=10,Blockly.COLLAPSE_CHARS=30,Blockly.LONGPRESS=750,Blockly.SOUND_LIMIT=100,Blockly.DRAG_STACK=!0,Blockly.HSV_SATURATION=.45,Blockly.HSV_VALUE=.65,Blockly.SPRITE={width:96,height:124,url:"sprites.png"},Blockly.constants.ALIGN={LEFT:-1,CENTRE:0,RIGHT:1},Blockly.DRAG_NONE=0,Blockly.DRAG_STICKY=1,Blockly.DRAG_BEGIN=1,Blockly.DRAG_FREE=2,Blockly.OPPOSITE_TYPE=[],Blockly.OPPOSITE_TYPE[Blockly.connectionTypes.INPUT_VALUE]=Blockly.connectionTypes.OUTPUT_VALUE,Blockly.OPPOSITE_TYPE[Blockly.connectionTypes.OUTPUT_VALUE]=Blockly.connectionTypes.INPUT_VALUE,Blockly.OPPOSITE_TYPE[Blockly.connectionTypes.NEXT_STATEMENT]=Blockly.connectionTypes.PREVIOUS_STATEMENT,Blockly.OPPOSITE_TYPE[Blockly.connectionTypes.PREVIOUS_STATEMENT]=Blockly.connectionTypes.NEXT_STATEMENT,Blockly.DELETE_AREA_NONE=null,Blockly.DELETE_AREA_TRASH=1,Blockly.DELETE_AREA_TOOLBOX=2,Blockly.VARIABLE_CATEGORY_NAME="VARIABLE",Blockly.VARIABLE_DYNAMIC_CATEGORY_NAME="VARIABLE_DYNAMIC",Blockly.PROCEDURE_CATEGORY_NAME="PROCEDURE",Blockly.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID",Blockly.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID",Blockly.constants.COLLAPSED_INPUT_NAME="_TEMP_COLLAPSED_INPUT",Blockly.constants.COLLAPSED_FIELD_NAME="_TEMP_COLLAPSED_FIELD",Blockly.utils={},Blockly.utils.global=function(){return"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:this}(),Blockly.Msg={},Blockly.utils.global.Blockly||(Blockly.utils.global.Blockly={}),Blockly.utils.global.Blockly.Msg||(Blockly.utils.global.Blockly.Msg=Blockly.Msg),Blockly.utils.colour={},Blockly.utils.colour.parse=function(a){a=String(a).toLowerCase().trim();var b=Blockly.utils.colour.names[a];if(b)return b;if(b="#"==(b="0x"==a.substring(0,2)?"#"+a.substring(2):a)[0]?b:"#"+b,/^#[0-9a-f]{6}$/.test(b))return b;if(/^#[0-9a-f]{3}$/.test(b))return["#",b[1],b[1],b[2],b[2],b[3],b[3]].join("");var c=a.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return c&&(a=Number(c[1]),b=Number(c[2]),c=Number(c[3]),0<=a&&a<256&&0<=b&&b<256&&0<=c&&c<256)?Blockly.utils.colour.rgbToHex(a,b,c):null},Blockly.utils.colour.rgbToHex=function(a,b,c){return b=a<<16|b<<8|c,a<16?"#"+(16777216|b).toString(16).substr(1):"#"+b.toString(16)},Blockly.utils.colour.hexToRgb=function(a){return(a=Blockly.utils.colour.parse(a))?[(a=parseInt(a.substr(1),16))>>16,a>>8&255,255&a]:[0,0,0]},Blockly.utils.colour.hsvToHex=function(a,b,c){var d=0,e=0,f=0;if(0==b)f=e=d=c;else{var g=Math.floor(a/60),h=a/60-g;a=c*(1-b);var k=c*(1-b*h);switch(b=c*(1-b*(1-h)),g){case 1:d=k,e=c,f=a;break;case 2:d=a,e=c,f=b;break;case 3:d=a,e=k,f=c;break;case 4:d=b,e=a,f=c;break;case 5:d=c,e=a,f=k;break;case 6:case 0:d=c,e=b,f=a}}return Blockly.utils.colour.rgbToHex(Math.floor(d),Math.floor(e),Math.floor(f))},Blockly.utils.colour.blend=function(a,b,c){return(a=Blockly.utils.colour.parse(a))&&(b=Blockly.utils.colour.parse(b))?(a=Blockly.utils.colour.hexToRgb(a),b=Blockly.utils.colour.hexToRgb(b),Blockly.utils.colour.rgbToHex(Math.round(b[0]+c*(a[0]-b[0])),Math.round(b[1]+c*(a[1]-b[1])),Math.round(b[2]+c*(a[2]-b[2])))):null},Blockly.utils.colour.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00"},Blockly.utils.Coordinate=function(a,b){this.x=a,this.y=b},Blockly.utils.Coordinate.equals=function(a,b){return a==b||!(!a||!b)&&(a.x==b.x&&a.y==b.y)},Blockly.utils.Coordinate.distance=function(a,b){var c=a.x-b.x;return a=a.y-b.y,Math.sqrt(c*c+a*a)},Blockly.utils.Coordinate.magnitude=function(a){return Math.sqrt(a.x*a.x+a.y*a.y)},Blockly.utils.Coordinate.difference=function(a,b){return new Blockly.utils.Coordinate(a.x-b.x,a.y-b.y)},Blockly.utils.Coordinate.sum=function(a,b){return new Blockly.utils.Coordinate(a.x+b.x,a.y+b.y)},Blockly.utils.Coordinate.prototype.scale=function(a){return this.x*=a,this.y*=a,this},Blockly.utils.Coordinate.prototype.translate=function(a,b){return this.x+=a,this.y+=b,this},Blockly.utils.Rect=function(a,b,c,d){this.top=a,this.bottom=b,this.left=c,this.right=d},Blockly.utils.Rect.prototype.contains=function(a,b){return a>=this.left&&a<=this.right&&b>=this.top&&b<=this.bottom},Blockly.utils.Rect.prototype.intersects=function(a){return!(this.left>a.right||this.righta.bottom||this.bottomb&&(b=c[d].length);d=-1/0;var e=1;do{var f=d,g=a;a=[];for(var h=c.length/e,k=1,d=0;d/g,"<$1$2>")},Blockly.Xml.domToPrettyText=function(a){a=Blockly.Xml.domToText(a).split("<");for(var b="",c=1;c"!=d.slice(-2)&&(b+=" ")}return(a=(a=a.join("\n")).replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1")).replace(/^\n/,"")},Blockly.Xml.textToDom=function(a){var b=Blockly.utils.xml.textToDomDocument(a);if(!b||!b.documentElement||b.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+a);return b.documentElement},Blockly.Xml.clearWorkspaceAndLoadFromXml=function(a,b){return b.setResizesEnabled(!1),b.clear(),a=Blockly.Xml.domToWorkspace(a,b),b.setResizesEnabled(!0),a},Blockly.Xml.domToWorkspace=function(a,b){var c,d;a instanceof Blockly.Workspace&&(c=a,a=b,b=c,console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")),b.RTL&&(d=b.getWidth()),c=[],Blockly.utils.dom.startTextWidthCache();var e=Blockly.Events.getGroup();e||Blockly.Events.setGroup(!0),b.setResizesEnabled&&b.setResizesEnabled(!1);var f=!0;try{for(var h,g=0;h=a.childNodes[g];g++){var k=h.nodeName.toLowerCase(),l=h;if("block"==k||"shadow"==k&&!Blockly.Events.recordUndo){var m=Blockly.Xml.domToBlock(l,b);c.push(m.id);var n=l.hasAttribute("x")?parseInt(l.getAttribute("x"),10):10,p=l.hasAttribute("y")?parseInt(l.getAttribute("y"),10):10;isNaN(n)||isNaN(p)||m.moveBy(b.RTL?d-n:n,p),f=!1}else{if("shadow"==k)throw TypeError("Shadow block cannot be a top-level block.");if("comment"==k)b.rendered?Blockly.WorkspaceCommentSvg?Blockly.WorkspaceCommentSvg.fromXml(l,b,d):console.warn("Missing require for Blockly.WorkspaceCommentSvg, ignoring workspace comment."):Blockly.WorkspaceComment?Blockly.WorkspaceComment.fromXml(l,b):console.warn("Missing require for Blockly.WorkspaceComment, ignoring workspace comment.");else if("variables"==k){if(!f)throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");Blockly.Xml.domToVariables(l,b),f=!1}}}}finally{e||Blockly.Events.setGroup(!1),Blockly.utils.dom.stopTextWidthCache()}return b.setResizesEnabled&&b.setResizesEnabled(!0),Blockly.Events.fire(new(Blockly.Events.get(Blockly.Events.FINISHED_LOADING))(b)),c},Blockly.Xml.appendDomToWorkspace=function(a,b){if(Object.prototype.hasOwnProperty.call(b,"scale")&&(c=b.getBlocksBoundingBox()),a=Blockly.Xml.domToWorkspace(a,b),c&&c.top!=c.bottom){for(var d=c.bottom,e=b.RTL?c.right:c.left,f=1/0,g=-1/0,h=1/0,c=0;cg&&(g=k.x)}for(d=d-h+10,e=b.RTL?e-g:e-f,c=0;c"),b.domToMutation(d)),Blockly.Events.fire(new(Blockly.Events.get(Blockly.Events.CHANGE))(b,"mutation",null,c,a));break;default:console.warn("Unknown change type: "+this.element)}else console.warn("Can't change non-existent block: "+this.blockId)},Blockly.Events.Create=function(a){Blockly.Events.Create.superClass_.constructor.call(this,a),a&&(a.isShadow()&&(this.recordUndo=!1),this.xml=a.workspace.rendered?Blockly.Xml.blockToDomWithXY(a):Blockly.Xml.blockToDom(a),this.ids=Blockly.Events.getDescendantIds(a))},Blockly.utils.object.inherits(Blockly.Events.Create,Blockly.Events.BlockBase),Blockly.Events.BlockCreate=Blockly.Events.Create,Blockly.Events.Create.prototype.type=Blockly.Events.CREATE,Blockly.Events.Create.prototype.toJson=function(){var a=Blockly.Events.Create.superClass_.toJson.call(this);return a.xml=Blockly.Xml.domToText(this.xml),a.ids=this.ids,this.recordUndo||(a.recordUndo=this.recordUndo),a},Blockly.Events.Create.prototype.fromJson=function(a){Blockly.Events.Create.superClass_.fromJson.call(this,a),this.xml=Blockly.Xml.textToDom(a.xml),this.ids=a.ids,void 0!==a.recordUndo&&(this.recordUndo=a.recordUndo)},Blockly.Events.Create.prototype.run=function(a){var c,b=this.getEventWorkspace_();if(a)(a=Blockly.utils.xml.createElement("xml")).appendChild(this.xml),Blockly.Xml.domToWorkspace(a,b);else{a=0;for(;c=this.ids[a];a++){var d=b.getBlockById(c);d?d.dispose(!1):c==this.blockId&&console.warn("Can't uncreate non-existent block: "+c)}}},Blockly.Events.Delete=function(a){if(Blockly.Events.Delete.superClass_.constructor.call(this,a),a){if(a.getParent())throw Error("Connected blocks cannot be deleted.");a.isShadow()&&(this.recordUndo=!1),this.oldXml=a.workspace.rendered?Blockly.Xml.blockToDomWithXY(a):Blockly.Xml.blockToDom(a),this.ids=Blockly.Events.getDescendantIds(a)}},Blockly.utils.object.inherits(Blockly.Events.Delete,Blockly.Events.BlockBase),Blockly.Events.BlockDelete=Blockly.Events.Delete,Blockly.Events.Delete.prototype.type=Blockly.Events.DELETE,Blockly.Events.Delete.prototype.toJson=function(){var a=Blockly.Events.Delete.superClass_.toJson.call(this);return a.oldXml=Blockly.Xml.domToText(this.oldXml),a.ids=this.ids,this.recordUndo||(a.recordUndo=this.recordUndo),a},Blockly.Events.Delete.prototype.fromJson=function(a){Blockly.Events.Delete.superClass_.fromJson.call(this,a),this.oldXml=Blockly.Xml.textToDom(a.oldXml),this.ids=a.ids,void 0!==a.recordUndo&&(this.recordUndo=a.recordUndo)},Blockly.Events.Delete.prototype.run=function(a){var c,b=this.getEventWorkspace_();if(a){a=0;for(;c=this.ids[a];a++){var d=b.getBlockById(c);d?d.dispose(!1):c==this.blockId&&console.warn("Can't delete non-existent block: "+c)}}else(a=Blockly.utils.xml.createElement("xml")).appendChild(this.oldXml),Blockly.Xml.domToWorkspace(a,b)},Blockly.Events.Move=function(a){Blockly.Events.Move.superClass_.constructor.call(this,a),a&&(a.isShadow()&&(this.recordUndo=!1),a=this.currentLocation_(),this.oldParentId=a.parentId,this.oldInputName=a.inputName,this.oldCoordinate=a.coordinate)},Blockly.utils.object.inherits(Blockly.Events.Move,Blockly.Events.BlockBase),Blockly.Events.BlockMove=Blockly.Events.Move,Blockly.Events.Move.prototype.type=Blockly.Events.MOVE,Blockly.Events.Move.prototype.toJson=function(){var a=Blockly.Events.Move.superClass_.toJson.call(this);return this.newParentId&&(a.newParentId=this.newParentId),this.newInputName&&(a.newInputName=this.newInputName),this.newCoordinate&&(a.newCoordinate=Math.round(this.newCoordinate.x)+","+Math.round(this.newCoordinate.y)),this.recordUndo||(a.recordUndo=this.recordUndo),a},Blockly.Events.Move.prototype.fromJson=function(a){var b;Blockly.Events.Move.superClass_.fromJson.call(this,a),this.newParentId=a.newParentId,this.newInputName=a.newInputName,a.newCoordinate&&(b=a.newCoordinate.split(","),this.newCoordinate=new Blockly.utils.Coordinate(Number(b[0]),Number(b[1]))),void 0!==a.recordUndo&&(this.recordUndo=a.recordUndo)},Blockly.Events.Move.prototype.recordNew=function(){var a=this.currentLocation_();this.newParentId=a.parentId,this.newInputName=a.inputName,this.newCoordinate=a.coordinate},Blockly.Events.Move.prototype.currentLocation_=function(){var a=this.getEventWorkspace_().getBlockById(this.blockId),b={},c=a.getParent();return c?(b.parentId=c.id,(a=c.getInputWithBlock(a))&&(b.inputName=a.name)):b.coordinate=a.getRelativeToSurfaceXY(),b},Blockly.Events.Move.prototype.isNull=function(){return this.oldParentId==this.newParentId&&this.oldInputName==this.newInputName&&Blockly.utils.Coordinate.equals(this.oldCoordinate,this.newCoordinate)},Blockly.Events.Move.prototype.run=function(a){var d,e,f,g,b=this.getEventWorkspace_(),c=b.getBlockById(this.blockId);c?(d=a?this.newParentId:this.oldParentId,e=a?this.newInputName:this.oldInputName,f=a?this.newCoordinate:this.oldCoordinate,a=null,!d||(a=b.getBlockById(d))?(c.getParent()&&c.unplug(),f?(e=c.getRelativeToSurfaceXY(),c.moveBy(f.x-e.x,f.y-e.y)):(b=(c=c.outputConnection||c.previousConnection).type,e?(a=a.getInput(e))&&(g=a.connection):b==Blockly.connectionTypes.PREVIOUS_STATEMENT&&(g=a.nextConnection),g?c.connect(g):console.warn("Can't connect to non-existent input: "+e))):console.warn("Can't connect to non-existent block: "+d)):console.warn("Can't move non-existent block: "+this.blockId)},Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.CREATE,Blockly.Events.Create),Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.DELETE,Blockly.Events.Delete),Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.CHANGE,Blockly.Events.Change),Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.MOVE,Blockly.Events.Move),Blockly.Events.FinishedLoading=function(a){this.isBlank=void 0===a,this.workspaceId=a?a.id:"",this.group=Blockly.Events.getGroup(),this.recordUndo=!1},Blockly.utils.object.inherits(Blockly.Events.FinishedLoading,Blockly.Events.Abstract),Blockly.Events.FinishedLoading.prototype.type=Blockly.Events.FINISHED_LOADING,Blockly.Events.FinishedLoading.prototype.toJson=function(){var a={type:this.type};return this.group&&(a.group=this.group),this.workspaceId&&(a.workspaceId=this.workspaceId),a},Blockly.Events.FinishedLoading.prototype.fromJson=function(a){this.isBlank=!1,this.workspaceId=a.workspaceId,this.group=a.group},Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.FINISHED_LOADING,Blockly.Events.FinishedLoading),Blockly.Events.UiBase=function(a){Blockly.Events.UiBase.superClass_.constructor.call(this),this.isBlank=void 0===a,this.workspaceId=a||"",this.recordUndo=!1},Blockly.utils.object.inherits(Blockly.Events.UiBase,Blockly.Events.Abstract),Blockly.Events.UiBase.prototype.isUiEvent=!0,Blockly.Events.Ui=function(a,b,c,d){Blockly.Events.Ui.superClass_.constructor.call(this,a?a.workspace.id:void 0),this.blockId=a?a.id:null,this.element=void 0===b?"":b,this.oldValue=void 0===c?"":c,this.newValue=void 0===d?"":d},Blockly.utils.object.inherits(Blockly.Events.Ui,Blockly.Events.UiBase),Blockly.Events.Ui.prototype.type=Blockly.Events.UI,Blockly.Events.Ui.prototype.toJson=function(){var a=Blockly.Events.Ui.superClass_.toJson.call(this);return a.element=this.element,void 0!==this.newValue&&(a.newValue=this.newValue),this.blockId&&(a.blockId=this.blockId),a},Blockly.Events.Ui.prototype.fromJson=function(a){Blockly.Events.Ui.superClass_.fromJson.call(this,a),this.element=a.element,this.newValue=a.newValue,this.blockId=a.blockId},Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.UI,Blockly.Events.Ui),Blockly.Events.VarBase=function(a){Blockly.Events.VarBase.superClass_.constructor.call(this),this.varId=(this.isBlank=void 0===a)?"":a.getId(),this.workspaceId=this.isBlank?"":a.workspace.id},Blockly.utils.object.inherits(Blockly.Events.VarBase,Blockly.Events.Abstract),Blockly.Events.VarBase.prototype.toJson=function(){var a=Blockly.Events.VarBase.superClass_.toJson.call(this);return a.varId=this.varId,a},Blockly.Events.VarBase.prototype.fromJson=function(a){Blockly.Events.VarBase.superClass_.toJson.call(this),this.varId=a.varId},Blockly.Events.VarCreate=function(a){Blockly.Events.VarCreate.superClass_.constructor.call(this,a),a&&(this.varType=a.type,this.varName=a.name)},Blockly.utils.object.inherits(Blockly.Events.VarCreate,Blockly.Events.VarBase),Blockly.Events.VarCreate.prototype.type=Blockly.Events.VAR_CREATE,Blockly.Events.VarCreate.prototype.toJson=function(){var a=Blockly.Events.VarCreate.superClass_.toJson.call(this);return a.varType=this.varType,a.varName=this.varName,a},Blockly.Events.VarCreate.prototype.fromJson=function(a){Blockly.Events.VarCreate.superClass_.fromJson.call(this,a),this.varType=a.varType,this.varName=a.varName},Blockly.Events.VarCreate.prototype.run=function(a){var b=this.getEventWorkspace_();a?b.createVariable(this.varName,this.varType,this.varId):b.deleteVariableById(this.varId)},Blockly.Events.VarDelete=function(a){Blockly.Events.VarDelete.superClass_.constructor.call(this,a),a&&(this.varType=a.type,this.varName=a.name)},Blockly.utils.object.inherits(Blockly.Events.VarDelete,Blockly.Events.VarBase),Blockly.Events.VarDelete.prototype.type=Blockly.Events.VAR_DELETE,Blockly.Events.VarDelete.prototype.toJson=function(){var a=Blockly.Events.VarDelete.superClass_.toJson.call(this);return a.varType=this.varType,a.varName=this.varName,a},Blockly.Events.VarDelete.prototype.fromJson=function(a){Blockly.Events.VarDelete.superClass_.fromJson.call(this,a),this.varType=a.varType,this.varName=a.varName},Blockly.Events.VarDelete.prototype.run=function(a){var b=this.getEventWorkspace_();a?b.deleteVariableById(this.varId):b.createVariable(this.varName,this.varType,this.varId)},Blockly.Events.VarRename=function(a,b){Blockly.Events.VarRename.superClass_.constructor.call(this,a),a&&(this.oldName=a.name,this.newName=void 0===b?"":b)},Blockly.utils.object.inherits(Blockly.Events.VarRename,Blockly.Events.VarBase),Blockly.Events.VarRename.prototype.type=Blockly.Events.VAR_RENAME,Blockly.Events.VarRename.prototype.toJson=function(){var a=Blockly.Events.VarRename.superClass_.toJson.call(this);return a.oldName=this.oldName,a.newName=this.newName,a},Blockly.Events.VarRename.prototype.fromJson=function(a){Blockly.Events.VarRename.superClass_.fromJson.call(this,a),this.oldName=a.oldName,this.newName=a.newName},Blockly.Events.VarRename.prototype.run=function(a){var b=this.getEventWorkspace_();a?b.renameVariableById(this.varId,this.newName):b.renameVariableById(this.varId,this.oldName)},Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.VAR_CREATE,Blockly.Events.VarCreate),Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.VAR_DELETE,Blockly.Events.VarDelete),Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.VAR_RENAME,Blockly.Events.VarRename),Blockly.BlockDragSurfaceSvg=function(a){this.container_=a,this.createDom()},Blockly.BlockDragSurfaceSvg.prototype.SVG_=null,Blockly.BlockDragSurfaceSvg.prototype.dragGroup_=null,Blockly.BlockDragSurfaceSvg.prototype.container_=null,Blockly.BlockDragSurfaceSvg.prototype.scale_=1,Blockly.BlockDragSurfaceSvg.prototype.surfaceXY_=null,Blockly.BlockDragSurfaceSvg.prototype.createDom=function(){this.SVG_||(this.SVG_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.SVG,{xmlns:Blockly.utils.dom.SVG_NS,"xmlns:html":Blockly.utils.dom.HTML_NS,"xmlns:xlink":Blockly.utils.dom.XLINK_NS,version:"1.1",class:"blocklyBlockDragSurface"},this.container_),this.dragGroup_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.G,{},this.SVG_))},Blockly.BlockDragSurfaceSvg.prototype.setBlocksAndShow=function(a){if(this.dragGroup_.childNodes.length)throw Error("Already dragging a block.");this.dragGroup_.appendChild(a),this.SVG_.style.display="block",this.surfaceXY_=new Blockly.utils.Coordinate(0,0)},Blockly.BlockDragSurfaceSvg.prototype.translateAndScaleGroup=function(a,b,c){this.scale_=c,a=a.toFixed(0),b=b.toFixed(0),this.dragGroup_.setAttribute("transform","translate("+a+","+b+") scale("+c+")")},Blockly.BlockDragSurfaceSvg.prototype.translateSurfaceInternal_=function(){var a=this.surfaceXY_.x,b=this.surfaceXY_.y,a=a.toFixed(0),b=b.toFixed(0);this.SVG_.style.display="block",Blockly.utils.dom.setCssTransform(this.SVG_,"translate3d("+a+"px, "+b+"px, 0px)")},Blockly.BlockDragSurfaceSvg.prototype.translateSurface=function(a,b){this.surfaceXY_=new Blockly.utils.Coordinate(a*this.scale_,b*this.scale_),this.translateSurfaceInternal_()},Blockly.BlockDragSurfaceSvg.prototype.getSurfaceTranslation=function(){var a=Blockly.utils.getRelativeXY(this.SVG_);return new Blockly.utils.Coordinate(a.x/this.scale_,a.y/this.scale_)},Blockly.BlockDragSurfaceSvg.prototype.getGroup=function(){return this.dragGroup_},Blockly.BlockDragSurfaceSvg.prototype.getCurrentBlock=function(){return this.dragGroup_.firstChild},Blockly.BlockDragSurfaceSvg.prototype.clearAndHide=function(a){if(a?a.appendChild(this.getCurrentBlock()):this.dragGroup_.removeChild(this.getCurrentBlock()),this.SVG_.style.display="none",this.dragGroup_.childNodes.length)throw Error("Drag group was not cleared.");this.surfaceXY_=null},Blockly.Css={},Blockly.Css.injected_=!1,Blockly.Css.register=function(a){if(Blockly.Css.injected_)throw Error("CSS already injected");Array.prototype.push.apply(Blockly.Css.CONTENT,a),a.length=0},Blockly.Css.inject=function(a,b){var c;Blockly.Css.injected_||(Blockly.Css.injected_=!0,c=Blockly.Css.CONTENT.join("\n"),Blockly.Css.CONTENT.length=0,a&&(a=b.replace(/[\\/]$/,""),c=c.replace(/<<>>/g,a),(a=document.createElement("style")).id="blockly-common-style",c=document.createTextNode(c),a.appendChild(c),document.head.insertBefore(a,document.head.firstChild)))},Blockly.Css.CONTENT=[".blocklySvg {","background-color: #fff;","outline: none;","overflow: hidden;","position: absolute;","display: block;","}",".blocklyWidgetDiv {","display: none;","position: absolute;","z-index: 99999;","}",".injectionDiv {","height: 100%;","position: relative;","overflow: hidden;","touch-action: none;","}",".blocklyNonSelectable {","user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","}",".blocklyWsDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;","}",".blocklyWsDragSurface.blocklyOverflowVisible {","overflow: visible;","}",".blocklyBlockDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;","right: 0;","bottom: 0;","overflow: visible !important;","z-index: 50;","}",".blocklyBlockCanvas.blocklyCanvasTransitioning,",".blocklyBubbleCanvas.blocklyCanvasTransitioning {","transition: transform .5s;","}",".blocklyTooltipDiv {","background-color: #ffffc7;","border: 1px solid #ddc;","box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);","color: #000;","display: none;","font: 9pt sans-serif;","opacity: .9;","padding: 2px;","position: absolute;","z-index: 100000;","}",".blocklyDropDownDiv {","position: absolute;","left: 0;","top: 0;","z-index: 1000;","display: none;","border: 1px solid;","border-color: #dadce0;","background-color: #fff;","border-radius: 2px;","padding: 4px;","box-shadow: 0 0 3px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv.blocklyFocused {","box-shadow: 0 0 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownContent {","max-height: 300px;","overflow: auto;","overflow-x: hidden;","position: relative;","}",".blocklyDropDownArrow {","position: absolute;","left: 0;","top: 0;","width: 16px;","height: 16px;","z-index: -1;","background-color: inherit;","border-color: inherit;","}",".blocklyDropDownButton {","display: inline-block;","float: left;","padding: 0;","margin: 4px;","border-radius: 4px;","outline: none;","border: 1px solid;","transition: box-shadow .1s;","cursor: pointer;","}",".blocklyArrowTop {","border-top: 1px solid;","border-left: 1px solid;","border-top-left-radius: 4px;","border-color: inherit;","}",".blocklyArrowBottom {","border-bottom: 1px solid;","border-right: 1px solid;","border-bottom-right-radius: 4px;","border-color: inherit;","}",".blocklyResizeSE {","cursor: se-resize;","fill: #aaa;","}",".blocklyResizeSW {","cursor: sw-resize;","fill: #aaa;","}",".blocklyResizeLine {","stroke: #515A5A;","stroke-width: 1;","}",".blocklyHighlightedConnectionPath {","fill: none;","stroke: #fc3;","stroke-width: 4px;","}",".blocklyPathLight {","fill: none;","stroke-linecap: round;","stroke-width: 1;","}",".blocklySelected>.blocklyPathLight {","display: none;","}",".blocklyDraggable {",'cursor: url("<<>>/handopen.cur"), auto;',"cursor: grab;","cursor: -webkit-grab;","}",".blocklyDragging {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDraggable:active {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyBlockDragSurface .blocklyDraggable {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDragging.blocklyDraggingDelete {",'cursor: url("<<>>/handdelete.cur"), auto;',"}",".blocklyDragging>.blocklyPath,",".blocklyDragging>.blocklyPathLight {","fill-opacity: .8;","stroke-opacity: .8;","}",".blocklyDragging>.blocklyPathDark {","display: none;","}",".blocklyDisabled>.blocklyPath {","fill-opacity: .5;","stroke-opacity: .5;","}",".blocklyDisabled>.blocklyPathLight,",".blocklyDisabled>.blocklyPathDark {","display: none;","}",".blocklyInsertionMarker>.blocklyPath,",".blocklyInsertionMarker>.blocklyPathLight,",".blocklyInsertionMarker>.blocklyPathDark {","fill-opacity: .2;","stroke: none;","}",".blocklyMultilineText {","font-family: monospace;","}",".blocklyNonEditableText>text {","pointer-events: none;","}",".blocklyFlyout {","position: absolute;","z-index: 20;","}",".blocklyText text {","cursor: default;","}",".blocklySvg text,",".blocklyBlockDragSurface text {","user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","cursor: inherit;","}",".blocklyHidden {","display: none;","}",".blocklyFieldDropdown:not(.blocklyHidden) {","display: block;","}",".blocklyIconGroup {","cursor: default;","}",".blocklyIconGroup:not(:hover),",".blocklyIconGroupReadonly {","opacity: .6;","}",".blocklyIconShape {","fill: #00f;","stroke: #fff;","stroke-width: 1px;","}",".blocklyIconSymbol {","fill: #fff;","}",".blocklyMinimalBody {","margin: 0;","padding: 0;","}",".blocklyHtmlInput {","border: none;","border-radius: 4px;","height: 100%;","margin: 0;","outline: none;","padding: 0;","width: 100%;","text-align: center;","display: block;","box-sizing: border-box;","}",".blocklyHtmlInput::-ms-clear {","display: none;","}",".blocklyMainBackground {","stroke-width: 1;","stroke: #c6c6c6;","}",".blocklyMutatorBackground {","fill: #fff;","stroke: #ddd;","stroke-width: 1;","}",".blocklyFlyoutBackground {","fill: #ddd;","fill-opacity: .8;","}",".blocklyMainWorkspaceScrollbar {","z-index: 20;","}",".blocklyFlyoutScrollbar {","z-index: 30;","}",".blocklyScrollbarHorizontal,",".blocklyScrollbarVertical {","position: absolute;","outline: none;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarHandle {","fill: #ccc;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyScrollbarHandle:hover {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarHandle {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyFlyout .blocklyScrollbarHandle:hover {","fill: #aaa;","}",".blocklyInvalidInput {","background: #faa;","}",".blocklyVerticalMarker {","stroke-width: 3px;","fill: rgba(255,255,255,.5);","pointer-events: none;","}",".blocklyComputeCanvas {","position: absolute;","width: 0;","height: 0;","}",".blocklyNoPointerEvents {","pointer-events: none;","}",".blocklyContextMenu {","border-radius: 4px;","max-height: 100%;","}",".blocklyDropdownMenu {","border-radius: 2px;","padding: 0 !important;","}",".blocklyDropdownMenu .blocklyMenuItem {","padding-left: 28px;","}",".blocklyDropdownMenu .blocklyMenuItemRtl {","padding-left: 5px;","padding-right: 28px;","}",".blocklyWidgetDiv .blocklyMenu {","background: #fff;","border: 1px solid transparent;","box-shadow: 0 0 3px 1px rgba(0,0,0,.3);","font: normal 13px Arial, sans-serif;","margin: 0;","outline: none;","padding: 4px 0;","position: absolute;","overflow-y: auto;","overflow-x: hidden;","max-height: 100%;","z-index: 20000;","}",".blocklyWidgetDiv .blocklyMenu.blocklyFocused {","box-shadow: 0 0 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv .blocklyMenu {","background: inherit;","border: inherit;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;',"outline: none;","position: relative;","z-index: 20000;","}",".blocklyMenuItem {","border: none;","color: #000;","cursor: pointer;","list-style: none;","margin: 0;","min-width: 7em;","padding: 6px 15px;","white-space: nowrap;","}",".blocklyMenuItemDisabled {","color: #ccc;","cursor: inherit;","}",".blocklyMenuItemHighlight {","background-color: rgba(0,0,0,.1);","}",".blocklyMenuItemCheckbox {","height: 16px;","position: absolute;","width: 16px;","}",".blocklyMenuItemSelected .blocklyMenuItemCheckbox {","background: url(<<>>/sprites.png) no-repeat -48px -16px;","float: left;","margin-left: -24px;","position: static;","}",".blocklyMenuItemRtl .blocklyMenuItemCheckbox {","float: right;","margin-right: -24px;","}"],Blockly.utils.math={},Blockly.utils.math.toRadians=function(a){return a*Math.PI/180},Blockly.utils.math.toDegrees=function(a){return 180*a/Math.PI},Blockly.utils.math.clamp=function(a,b,c){var d;return ce.top?Blockly.DropDownDiv.getPositionAboveMetrics_(c,d,e,f):b+f.heightdocument.documentElement.clientTop?Blockly.DropDownDiv.getPositionAboveMetrics_(c,d,e,f):Blockly.DropDownDiv.getPositionTopOfPageMetrics_(a,e,f)},Blockly.DropDownDiv.getPositionBelowMetrics_=function(a,b,c,d){return{initialX:(a=Blockly.DropDownDiv.getPositionX(a,c.left,c.right,d.width)).divX,initialY:b,finalX:a.divX,finalY:b+Blockly.DropDownDiv.PADDING_Y,arrowX:a.arrowX,arrowY:-(Blockly.DropDownDiv.ARROW_SIZE/2+Blockly.DropDownDiv.BORDER_SIZE),arrowAtTop:!0,arrowVisible:!0}},Blockly.DropDownDiv.getPositionAboveMetrics_=function(a,b,c,d){return{initialX:(a=Blockly.DropDownDiv.getPositionX(a,c.left,c.right,d.width)).divX,initialY:b-d.height,finalX:a.divX,finalY:b-d.height-Blockly.DropDownDiv.PADDING_Y,arrowX:a.arrowX,arrowY:d.height-2*Blockly.DropDownDiv.BORDER_SIZE-Blockly.DropDownDiv.ARROW_SIZE/2,arrowAtTop:!1,arrowVisible:!0}},Blockly.DropDownDiv.getPositionTopOfPageMetrics_=function(a,b,c){return{initialX:(a=Blockly.DropDownDiv.getPositionX(a,b.left,b.right,c.width)).divX,initialY:0,finalX:a.divX,finalY:0,arrowAtTop:null,arrowX:null,arrowY:null,arrowVisible:!1}},Blockly.DropDownDiv.getPositionX=function(a,b,c,d){var e=a;return a=Blockly.utils.math.clamp(b,a-d/2,c-d),e-=Blockly.DropDownDiv.ARROW_SIZE/2,b=Blockly.DropDownDiv.ARROW_HORIZONTAL_PADDING,{arrowX:d=Blockly.utils.math.clamp(b,e-a,d-b-Blockly.DropDownDiv.ARROW_SIZE),divX:a}},Blockly.DropDownDiv.isVisible=function(){return!!Blockly.DropDownDiv.owner_},Blockly.DropDownDiv.hideIfOwner=function(a,b){return Blockly.DropDownDiv.owner_===a&&(b?Blockly.DropDownDiv.hideWithoutAnimation():Blockly.DropDownDiv.hide(),!0)},Blockly.DropDownDiv.hide=function(){var a=Blockly.DropDownDiv.DIV_;a.style.transform="translate(0, 0)",a.style.opacity=0,Blockly.DropDownDiv.animateOutTimer_=setTimeout(function(){Blockly.DropDownDiv.hideWithoutAnimation()},1e3*Blockly.DropDownDiv.ANIMATION_TIME),Blockly.DropDownDiv.onHide_&&(Blockly.DropDownDiv.onHide_(),Blockly.DropDownDiv.onHide_=null)},Blockly.DropDownDiv.hideWithoutAnimation=function(){var a;Blockly.DropDownDiv.isVisible()&&(Blockly.DropDownDiv.animateOutTimer_&&clearTimeout(Blockly.DropDownDiv.animateOutTimer_),(a=Blockly.DropDownDiv.DIV_).style.transform="",a.style.left="",a.style.top="",a.style.opacity=0,a.style.display="none",a.style.backgroundColor="",a.style.borderColor="",Blockly.DropDownDiv.onHide_&&(Blockly.DropDownDiv.onHide_(),Blockly.DropDownDiv.onHide_=null),Blockly.DropDownDiv.clearContent(),Blockly.DropDownDiv.owner_=null,Blockly.DropDownDiv.rendererClassName_&&(Blockly.utils.dom.removeClass(a,Blockly.DropDownDiv.rendererClassName_),Blockly.DropDownDiv.rendererClassName_=""),Blockly.DropDownDiv.themeClassName_&&(Blockly.utils.dom.removeClass(a,Blockly.DropDownDiv.themeClassName_),Blockly.DropDownDiv.themeClassName_=""),Blockly.getMainWorkspace().markFocused())},Blockly.DropDownDiv.positionInternal_=function(a,b,c,d){(a=Blockly.DropDownDiv.getPositionMetrics_(a,b,c,d)).arrowVisible?(Blockly.DropDownDiv.arrow_.style.display="",Blockly.DropDownDiv.arrow_.style.transform="translate("+a.arrowX+"px,"+a.arrowY+"px) rotate(45deg)",Blockly.DropDownDiv.arrow_.setAttribute("class",a.arrowAtTop?"blocklyDropDownArrow blocklyArrowTop":"blocklyDropDownArrow blocklyArrowBottom")):Blockly.DropDownDiv.arrow_.style.display="none",b=Math.floor(a.initialX),c=Math.floor(a.initialY),d=Math.floor(a.finalX);var e=Math.floor(a.finalY),f=Blockly.DropDownDiv.DIV_;return f.style.left=b+"px",f.style.top=c+"px",f.style.display="block",f.style.opacity=1,f.style.transform="translate("+(d-b)+"px,"+(e-c)+"px)",!!a.arrowAtTop},Blockly.DropDownDiv.repositionForWindowResize=function(){var a,b;Blockly.DropDownDiv.owner_?(b=(a=Blockly.DropDownDiv.owner_).getSourceBlock(),b=(a=Blockly.DropDownDiv.positionToField_?Blockly.DropDownDiv.getScaledBboxOfField_(a):Blockly.DropDownDiv.getScaledBboxOfBlock_(b)).left+(a.right-a.left)/2,Blockly.DropDownDiv.positionInternal_(b,a.bottom,b,a.top)):Blockly.DropDownDiv.hide()},Blockly.Grid=function(a,b){this.gridPattern_=a,this.spacing_=b.spacing,this.length_=b.length,this.line2_=(this.line1_=a.firstChild)&&this.line1_.nextSibling,this.snapToGrid_=b.snap},Blockly.Grid.prototype.scale_=1,Blockly.Grid.prototype.dispose=function(){this.gridPattern_=null},Blockly.Grid.prototype.shouldSnap=function(){return this.snapToGrid_},Blockly.Grid.prototype.getSpacing=function(){return this.spacing_},Blockly.Grid.prototype.getPatternId=function(){return this.gridPattern_.id},Blockly.Grid.prototype.update=function(a){this.scale_=a;var b=this.spacing_*a||100;this.gridPattern_.setAttribute("width",b),this.gridPattern_.setAttribute("height",b);var c=(b=Math.floor(this.spacing_/2)+.5)-this.length_/2,d=b+this.length_/2;this.setLineAttributes_(this.line1_,a,c*=a,d*=a,b*=a,b),this.setLineAttributes_(this.line2_,a,b,b,c,d)},Blockly.Grid.prototype.setLineAttributes_=function(a,b,c,d,e,f){a&&(a.setAttribute("stroke-width",b),a.setAttribute("x1",c),a.setAttribute("y1",e),a.setAttribute("x2",d),a.setAttribute("y2",f))},Blockly.Grid.prototype.moveTo=function(a,b){this.gridPattern_.setAttribute("x",a),this.gridPattern_.setAttribute("y",b),(Blockly.utils.userAgent.IE||Blockly.utils.userAgent.EDGE)&&this.update(this.scale_)},Blockly.Grid.createDom=function(a,b,c){return a=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.PATTERN,{id:"blocklyGridPattern"+a,patternUnits:"userSpaceOnUse"},c),0 document.")}else a=null;return a},Blockly.Options=function(a){var f,g,h,k,c,d,e,l,b=!!a.readOnly;b?(c=null,k=h=g=f=e=d=!1):(c=Blockly.utils.toolbox.convertToolboxDefToJson(a.toolbox),d=Blockly.utils.toolbox.hasCategories(c),e=a.trashcan,l=a.maxTrashcanContents,(e=void 0===e?d:e)?void 0===l&&(l=32):l=0,void 0===(f=a.collapse)&&(f=d),void 0===(g=a.comments)&&(g=d),void 0===(h=a.disable)&&(h=d),void 0===(k=a.sounds)&&(k=!0));var m=!!a.rtl,n=a.horizontalLayout,p="end"!==(p=a.toolboxPosition);p=(n=void 0===n?!1:n)?p?Blockly.utils.toolbox.Position.TOP:Blockly.utils.toolbox.Position.BOTTOM:p==m?Blockly.utils.toolbox.Position.RIGHT:Blockly.utils.toolbox.Position.LEFT;var q=a.css;void 0===q&&(q=!0);var t="https://blockly-demo.appspot.com/static/media/";a.media?t=a.media:a.path&&(t=a.path+"media/");var r=void 0===a.oneBasedIndex||!!a.oneBasedIndex,u=a.renderer||"geras",v=a.plugins||{};this.RTL=m,this.oneBasedIndex=r,this.collapse=f,this.comments=g,this.disable=h,this.readOnly=b,this.maxBlocks=a.maxBlocks||1/0,this.maxInstances=a.maxInstances,this.pathToMedia=t,this.hasCategories=d,this.moveOptions=Blockly.Options.parseMoveOptions_(a,d),this.hasScrollbars=!!this.moveOptions.scrollbars,this.hasTrashcan=e,this.maxTrashcanContents=l,this.hasSounds=k,this.hasCss=q,this.horizontalLayout=n,this.languageTree=c,this.gridOptions=Blockly.Options.parseGridOptions_(a),this.zoomOptions=Blockly.Options.parseZoomOptions_(a),this.toolboxPosition=p,this.theme=Blockly.Options.parseThemeOptions_(a),this.renderer=u,this.rendererOverrides=a.rendererOverrides,this.gridPattern=null,this.parentWorkspace=a.parentWorkspace,this.plugins=v},Blockly.BlocklyOptions=function(){},Blockly.Options.parseMoveOptions_=function(a,b){var c=a.move||{},d={};return void 0===c.scrollbars&&void 0===a.scrollbars?d.scrollbars=b:"object"==typeof c.scrollbars?(d.scrollbars={},d.scrollbars.horizontal=!!c.scrollbars.horizontal,d.scrollbars.vertical=!!c.scrollbars.vertical,d.scrollbars.horizontal&&d.scrollbars.vertical?d.scrollbars=!0:d.scrollbars.horizontal||d.scrollbars.vertical||(d.scrollbars=!1)):d.scrollbars=!!c.scrollbars||!!a.scrollbars,d.wheel=d.scrollbars&&void 0!==c.wheel?!!c.wheel:"object"==typeof d.scrollbars,d.drag=!!d.scrollbars&&(void 0===c.drag||!!c.drag),d},Blockly.Options.parseZoomOptions_=function(a){a=a.zoom||{};var b={};return b.controls=void 0!==a.controls&&!!a.controls,b.wheel=void 0!==a.wheel&&!!a.wheel,b.startScale=void 0===a.startScale?1:Number(a.startScale),b.maxScale=void 0===a.maxScale?3:Number(a.maxScale),b.minScale=void 0===a.minScale?.3:Number(a.minScale),b.scaleSpeed=void 0===a.scaleSpeed?1.2:Number(a.scaleSpeed),b.pinch=void 0===a.pinch?b.wheel||b.controls:!!a.pinch,b},Blockly.Options.parseGridOptions_=function(a){a=a.grid||{};var b={};return b.spacing=Number(a.spacing)||0,b.colour=a.colour||"#888",b.length=void 0===a.length?1:Number(a.length),b.snap=0=a.scrollWidth?(this.setHandleLength_(this.scrollbarLength_),this.setHandlePosition(0),this.pair_||this.setVisible(!1)):(this.pair_||this.setVisible(!0),b=this.scrollbarLength_*a.viewWidth/a.scrollWidth,b=this.constrainHandleLength_(b),this.setHandleLength_(b),b=a.scrollWidth-a.viewWidth,c=this.scrollbarLength_-this.handleLength_,a=(a.viewLeft-a.scrollLeft)/b*c,a=this.constrainHandlePosition_(a),this.setHandlePosition(a),this.ratio=c/b)},Blockly.Scrollbar.prototype.resizeVertical_=function(a){this.requiresViewResize_(a)?this.resizeViewVertical(a):this.resizeContentVertical(a)},Blockly.Scrollbar.prototype.resizeViewVertical=function(a){var b=a.viewHeight-2*Blockly.Scrollbar.SCROLLBAR_MARGIN;this.pair_&&(b-=Blockly.Scrollbar.scrollbarThickness),this.setScrollbarLength_(Math.max(0,b)),this.setPosition(this.workspace_.RTL?a.absoluteLeft+Blockly.Scrollbar.SCROLLBAR_MARGIN:a.absoluteLeft+a.viewWidth-Blockly.Scrollbar.scrollbarThickness-Blockly.Scrollbar.SCROLLBAR_MARGIN,a.absoluteTop+Blockly.Scrollbar.SCROLLBAR_MARGIN),this.resizeContentVertical(a)},Blockly.Scrollbar.prototype.resizeContentVertical=function(a){var b,c;a.viewHeight>=a.scrollHeight?(this.setHandleLength_(this.scrollbarLength_),this.setHandlePosition(0),this.pair_||this.setVisible(!1)):(this.pair_||this.setVisible(!0),b=this.scrollbarLength_*a.viewHeight/a.scrollHeight,b=this.constrainHandleLength_(b),this.setHandleLength_(b),b=a.scrollHeight-a.viewHeight,c=this.scrollbarLength_-this.handleLength_,a=(a.viewTop-a.scrollTop)/b*c,a=this.constrainHandlePosition_(a),this.setHandlePosition(a),this.ratio=c/b)},Blockly.Scrollbar.prototype.createDom_=function(a){var b="blocklyScrollbar"+(this.horizontal_?"Horizontal":"Vertical");a&&(b+=" "+a),this.outerSvg_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.SVG,{class:b},null),this.svgGroup_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.G,{},this.outerSvg_),this.svgBackground_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.RECT,{class:"blocklyScrollbarBackground"},this.svgGroup_),a=Math.floor((Blockly.Scrollbar.scrollbarThickness-5)/2),this.svgHandle_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.RECT,{class:"blocklyScrollbarHandle",rx:a,ry:a},this.svgGroup_),this.workspace_.getThemeManager().subscribe(this.svgHandle_,"scrollbarColour","fill"),this.workspace_.getThemeManager().subscribe(this.svgHandle_,"scrollbarOpacity","fill-opacity"),Blockly.utils.dom.insertAfter(this.outerSvg_,this.workspace_.getParentSvg())},Blockly.Scrollbar.prototype.isVisible=function(){return this.isVisible_},Blockly.Scrollbar.prototype.setContainerVisible=function(a){var b=a!=this.containerVisible_;this.containerVisible_=a,b&&this.updateDisplay_()},Blockly.Scrollbar.prototype.setVisible=function(a){var b=a!=this.isVisible();if(this.pair_)throw Error("Unable to toggle visibility of paired scrollbars.");this.isVisible_=a,b&&this.updateDisplay_()},Blockly.Scrollbar.prototype.updateDisplay_=function(){this.containerVisible_&&this.isVisible()?this.outerSvg_.setAttribute("display","block"):this.outerSvg_.setAttribute("display","none")},Blockly.Scrollbar.prototype.onMouseDownBar_=function(a){var b,c,d,e;this.workspace_.markFocused(),Blockly.Touch.clearTouchIdentifier(),this.cleanUp_(),Blockly.utils.isRightButton(a)?a.stopPropagation():(b=Blockly.utils.mouseToSvg(a,this.workspace_.getParentSvg(),this.workspace_.getInverseScreenCTM()),b=this.horizontal_?b.x:b.y,c=Blockly.utils.getInjectionDivXY_(this.svgHandle_),c=this.horizontal_?c.x:c.y,d=this.handlePosition_,e=.95*this.handleLength_,b<=c?d-=e:b>=c+this.handleLength_&&(d+=e),this.setHandlePosition(this.constrainHandlePosition_(d)),this.updateMetrics_(),a.stopPropagation(),a.preventDefault())},Blockly.Scrollbar.prototype.onMouseDownHandle_=function(a){this.workspace_.markFocused(),this.cleanUp_(),Blockly.utils.isRightButton(a)?a.stopPropagation():(this.startDragHandle=this.handlePosition_,this.workspace_.setupDragSurface(),this.startDragMouse_=this.horizontal_?a.clientX:a.clientY,Blockly.Scrollbar.onMouseUpWrapper_=Blockly.browserEvents.conditionalBind(document,"mouseup",this,this.onMouseUpHandle_),Blockly.Scrollbar.onMouseMoveWrapper_=Blockly.browserEvents.conditionalBind(document,"mousemove",this,this.onMouseMoveHandle_),a.stopPropagation(),a.preventDefault())},Blockly.Scrollbar.prototype.onMouseMoveHandle_=function(a){this.setHandlePosition(this.constrainHandlePosition_(this.startDragHandle+((this.horizontal_?a.clientX:a.clientY)-this.startDragMouse_))),this.updateMetrics_()},Blockly.Scrollbar.prototype.onMouseUpHandle_=function(){this.workspace_.resetDragSurface(),Blockly.Touch.clearTouchIdentifier(),this.cleanUp_()},Blockly.Scrollbar.prototype.cleanUp_=function(){Blockly.hideChaff(!0),Blockly.Scrollbar.onMouseUpWrapper_&&(Blockly.browserEvents.unbind(Blockly.Scrollbar.onMouseUpWrapper_),Blockly.Scrollbar.onMouseUpWrapper_=null),Blockly.Scrollbar.onMouseMoveWrapper_&&(Blockly.browserEvents.unbind(Blockly.Scrollbar.onMouseMoveWrapper_),Blockly.Scrollbar.onMouseMoveWrapper_=null)},Blockly.Scrollbar.prototype.getRatio_=function(){var a=this.handlePosition_/(this.scrollbarLength_-this.handleLength_);return a=isNaN(a)?0:a},Blockly.Scrollbar.prototype.updateMetrics_=function(){var a=this.getRatio_(),b={};this.horizontal_?b.x=a:b.y=a,this.workspace_.setMetrics(b)},Blockly.Scrollbar.prototype.set=function(a,b){this.setHandlePosition(this.constrainHandlePosition_(a*this.ratio)),!b&&void 0!==b||this.updateMetrics_()},Blockly.Scrollbar.prototype.setOrigin=function(a,b){this.origin_=new Blockly.utils.Coordinate(a,b)},Blockly.Tooltip={},Blockly.Tooltip.visible=!1,Blockly.Tooltip.blocked_=!1,Blockly.Tooltip.LIMIT=50,Blockly.Tooltip.mouseOutPid_=0,Blockly.Tooltip.showPid_=0,Blockly.Tooltip.lastX_=0,Blockly.Tooltip.lastY_=0,Blockly.Tooltip.element_=null,Blockly.Tooltip.poisonedElement_=null,Blockly.Tooltip.OFFSET_X=0,Blockly.Tooltip.OFFSET_Y=10,Blockly.Tooltip.RADIUS_OK=10,Blockly.Tooltip.HOVER_MS=750,Blockly.Tooltip.MARGINS=5,Blockly.Tooltip.DIV=null,Blockly.Tooltip.getTooltipOfObject=function(a){if(a=Blockly.Tooltip.getTargetObject_(a)){for(a=a.tooltip;"function"==typeof a;)a=a();if("string"!=typeof a)throw Error("Tooltip function must return a string.");return a}return""},Blockly.Tooltip.getTargetObject_=function(a){for(;a&&a.tooltip;){if("string"==typeof a.tooltip||"function"==typeof a.tooltip)return a;a=a.tooltip}return null},Blockly.Tooltip.createDom=function(){Blockly.Tooltip.DIV||(Blockly.Tooltip.DIV=document.createElement("div"),Blockly.Tooltip.DIV.className="blocklyTooltipDiv",(Blockly.parentContainer||document.body).appendChild(Blockly.Tooltip.DIV))},Blockly.Tooltip.bindMouseEvents=function(a){a.mouseOverWrapper_=Blockly.browserEvents.bind(a,"mouseover",null,Blockly.Tooltip.onMouseOver_),a.mouseOutWrapper_=Blockly.browserEvents.bind(a,"mouseout",null,Blockly.Tooltip.onMouseOut_),a.addEventListener("mousemove",Blockly.Tooltip.onMouseMove_,!1)},Blockly.Tooltip.unbindMouseEvents=function(a){a&&(Blockly.browserEvents.unbind(a.mouseOverWrapper_),Blockly.browserEvents.unbind(a.mouseOutWrapper_),a.removeEventListener("mousemove",Blockly.Tooltip.onMouseMove_))},Blockly.Tooltip.onMouseOver_=function(a){Blockly.Tooltip.blocked_||(a=Blockly.Tooltip.getTargetObject_(a.currentTarget),Blockly.Tooltip.element_!=a&&(Blockly.Tooltip.hide(),Blockly.Tooltip.poisonedElement_=null,Blockly.Tooltip.element_=a),clearTimeout(Blockly.Tooltip.mouseOutPid_))},Blockly.Tooltip.onMouseOut_=function(a){Blockly.Tooltip.blocked_||(Blockly.Tooltip.mouseOutPid_=setTimeout(function(){Blockly.Tooltip.element_=null,Blockly.Tooltip.poisonedElement_=null,Blockly.Tooltip.hide()},1),clearTimeout(Blockly.Tooltip.showPid_))},Blockly.Tooltip.onMouseMove_=function(a){var b;Blockly.Tooltip.element_&&Blockly.Tooltip.element_.tooltip&&!Blockly.Tooltip.blocked_&&(Blockly.Tooltip.visible?(b=Blockly.Tooltip.lastX_-a.pageX,a=Blockly.Tooltip.lastY_-a.pageY,Math.sqrt(b*b+a*a)>Blockly.Tooltip.RADIUS_OK&&Blockly.Tooltip.hide()):Blockly.Tooltip.poisonedElement_!=Blockly.Tooltip.element_&&(clearTimeout(Blockly.Tooltip.showPid_),Blockly.Tooltip.lastX_=a.pageX,Blockly.Tooltip.lastY_=a.pageY,Blockly.Tooltip.showPid_=setTimeout(Blockly.Tooltip.show_,Blockly.Tooltip.HOVER_MS)))},Blockly.Tooltip.dispose=function(){Blockly.Tooltip.element_=null,Blockly.Tooltip.poisonedElement_=null,Blockly.Tooltip.hide()},Blockly.Tooltip.hide=function(){Blockly.Tooltip.visible&&(Blockly.Tooltip.visible=!1,Blockly.Tooltip.DIV&&(Blockly.Tooltip.DIV.style.display="none")),Blockly.Tooltip.showPid_&&clearTimeout(Blockly.Tooltip.showPid_)},Blockly.Tooltip.block=function(){Blockly.Tooltip.hide(),Blockly.Tooltip.blocked_=!0},Blockly.Tooltip.unblock=function(){Blockly.Tooltip.blocked_=!1},Blockly.Tooltip.show_=function(){if(!Blockly.Tooltip.blocked_&&(Blockly.Tooltip.poisonedElement_=Blockly.Tooltip.element_,Blockly.Tooltip.DIV)){Blockly.Tooltip.DIV.textContent="";var a=Blockly.Tooltip.getTooltipOfObject(Blockly.Tooltip.element_);a=(a=Blockly.utils.string.wrap(a,Blockly.Tooltip.LIMIT)).split("\n");for(var b=0;bc+window.scrollY&&(e-=Blockly.Tooltip.DIV.offsetHeight+2*Blockly.Tooltip.OFFSET_Y),a?d=Math.max(Blockly.Tooltip.MARGINS-window.scrollX,d):d+Blockly.Tooltip.DIV.offsetWidth>b+window.scrollX-2*Blockly.Tooltip.MARGINS&&(d=b-Blockly.Tooltip.DIV.offsetWidth-2*Blockly.Tooltip.MARGINS),Blockly.Tooltip.DIV.style.top=e+"px",Blockly.Tooltip.DIV.style.left=d+"px"}},Blockly.utils.aria={},Blockly.utils.aria.ARIA_PREFIX_="aria-",Blockly.utils.aria.ROLE_ATTRIBUTE_="role",Blockly.utils.aria.Role={GRID:"grid",GRIDCELL:"gridcell",GROUP:"group",LISTBOX:"listbox",MENU:"menu",MENUITEM:"menuitem",MENUITEMCHECKBOX:"menuitemcheckbox",OPTION:"option",PRESENTATION:"presentation",ROW:"row",TREE:"tree",TREEITEM:"treeitem"},Blockly.utils.aria.State={ACTIVEDESCENDANT:"activedescendant",COLCOUNT:"colcount",DISABLED:"disabled",EXPANDED:"expanded",INVALID:"invalid",LABEL:"label",LABELLEDBY:"labelledby",LEVEL:"level",ORIENTATION:"orientation",POSINSET:"posinset",ROWCOUNT:"rowcount",SELECTED:"selected",SETSIZE:"setsize",VALUEMAX:"valuemax",VALUEMIN:"valuemin"},Blockly.utils.aria.setRole=function(a,b){a.setAttribute(Blockly.utils.aria.ROLE_ATTRIBUTE_,b)},Blockly.utils.aria.setState=function(a,b,c){Array.isArray(c)&&(c=c.join(" ")),a.setAttribute(Blockly.utils.aria.ARIA_PREFIX_+b,c)},Blockly.WorkspaceDragSurfaceSvg=function(a){this.container_=a,this.createDom()},Blockly.WorkspaceDragSurfaceSvg.prototype.SVG_=null,Blockly.WorkspaceDragSurfaceSvg.prototype.container_=null,Blockly.WorkspaceDragSurfaceSvg.prototype.createDom=function(){this.SVG_||(this.SVG_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.SVG,{xmlns:Blockly.utils.dom.SVG_NS,"xmlns:html":Blockly.utils.dom.HTML_NS,"xmlns:xlink":Blockly.utils.dom.XLINK_NS,version:"1.1",class:"blocklyWsDragSurface blocklyOverflowVisible"},null),this.container_.appendChild(this.SVG_))},Blockly.WorkspaceDragSurfaceSvg.prototype.translateSurface=function(a,b){a=a.toFixed(0),b=b.toFixed(0),this.SVG_.style.display="block",Blockly.utils.dom.setCssTransform(this.SVG_,"translate3d("+a+"px, "+b+"px, 0px)")},Blockly.WorkspaceDragSurfaceSvg.prototype.getSurfaceTranslation=function(){return Blockly.utils.getRelativeXY(this.SVG_)},Blockly.WorkspaceDragSurfaceSvg.prototype.clearAndHide=function(a){if(!a)throw Error("Couldn't clear and hide the drag surface: missing new surface.");var b=this.SVG_.childNodes[0],c=this.SVG_.childNodes[1];if(!(b&&c&&Blockly.utils.dom.hasClass(b,"blocklyBlockCanvas")&&Blockly.utils.dom.hasClass(c,"blocklyBubbleCanvas")))throw Error("Couldn't clear and hide the drag surface. A node was missing.");if(null!=this.previousSibling_?Blockly.utils.dom.insertAfter(b,this.previousSibling_):a.insertBefore(b,a.firstChild),Blockly.utils.dom.insertAfter(c,b),this.SVG_.style.display="none",this.SVG_.childNodes.length)throw Error("Drag surface was not cleared.");Blockly.utils.dom.setCssTransform(this.SVG_,""),this.previousSibling_=null},Blockly.WorkspaceDragSurfaceSvg.prototype.setContentsAndShow=function(a,b,c,d,e,f){if(this.SVG_.childNodes.length)throw Error("Already dragging a block.");this.previousSibling_=c,a.setAttribute("transform","translate(0, 0) scale("+f+")"),b.setAttribute("transform","translate(0, 0) scale("+f+")"),this.SVG_.setAttribute("width",d),this.SVG_.setAttribute("height",e),this.SVG_.appendChild(a),this.SVG_.appendChild(b),this.SVG_.style.display="block"},Blockly.blockRendering={},Blockly.blockRendering.useDebugger=!1,Blockly.blockRendering.register=function(a,b){Blockly.registry.register(Blockly.registry.Type.RENDERER,a,b)},Blockly.blockRendering.unregister=function(a){Blockly.registry.unregister(Blockly.registry.Type.RENDERER,a)},Blockly.blockRendering.startDebugger=function(){Blockly.blockRendering.useDebugger=!0},Blockly.blockRendering.stopDebugger=function(){Blockly.blockRendering.useDebugger=!1},Blockly.blockRendering.init=function(a,b,c){return(a=new(Blockly.registry.getClass(Blockly.registry.Type.RENDERER,a))(a)).init(b,c),a},Blockly.ASTNode=function(a,b,c){if(!b)throw Error("Cannot create a node without a location.");this.type_=a,this.isConnection_=Blockly.ASTNode.isConnectionType_(a),this.location_=b,this.wsCoordinate_=null,this.processParams_(c||null)},Blockly.ASTNode.types={FIELD:"field",BLOCK:"block",INPUT:"input",OUTPUT:"output",NEXT:"next",PREVIOUS:"previous",STACK:"stack",WORKSPACE:"workspace"},Blockly.ASTNode.NAVIGATE_ALL_FIELDS=!1,Blockly.ASTNode.DEFAULT_OFFSET_Y=-20,Blockly.ASTNode.isConnectionType_=function(a){switch(a){case Blockly.ASTNode.types.PREVIOUS:case Blockly.ASTNode.types.NEXT:case Blockly.ASTNode.types.INPUT:case Blockly.ASTNode.types.OUTPUT:return!0}return!1},Blockly.ASTNode.createFieldNode=function(a){return a?new Blockly.ASTNode(Blockly.ASTNode.types.FIELD,a):null},Blockly.ASTNode.createConnectionNode=function(a){if(!a)return null;var b=a.type;return b==Blockly.connectionTypes.INPUT_VALUE||b==Blockly.connectionTypes.NEXT_STATEMENT&&a.getParentInput()?Blockly.ASTNode.createInputNode(a.getParentInput()):b==Blockly.connectionTypes.NEXT_STATEMENT?new Blockly.ASTNode(Blockly.ASTNode.types.NEXT,a):b==Blockly.connectionTypes.OUTPUT_VALUE?new Blockly.ASTNode(Blockly.ASTNode.types.OUTPUT,a):b==Blockly.connectionTypes.PREVIOUS_STATEMENT?new Blockly.ASTNode(Blockly.ASTNode.types.PREVIOUS,a):null},Blockly.ASTNode.createInputNode=function(a){return a&&a.connection?new Blockly.ASTNode(Blockly.ASTNode.types.INPUT,a.connection):null},Blockly.ASTNode.createBlockNode=function(a){return a?new Blockly.ASTNode(Blockly.ASTNode.types.BLOCK,a):null},Blockly.ASTNode.createStackNode=function(a){return a?new Blockly.ASTNode(Blockly.ASTNode.types.STACK,a):null},Blockly.ASTNode.createWorkspaceNode=function(a,b){return b&&a?new Blockly.ASTNode(Blockly.ASTNode.types.WORKSPACE,a,{wsCoordinate:b}):null},Blockly.ASTNode.createTopNode=function(a){var b=a.previousConnection||a.outputConnection;return b?Blockly.ASTNode.createConnectionNode(b):Blockly.ASTNode.createBlockNode(a)},Blockly.ASTNode.prototype.processParams_=function(a){a&&a.wsCoordinate&&(this.wsCoordinate_=a.wsCoordinate)},Blockly.ASTNode.prototype.getLocation=function(){return this.location_},Blockly.ASTNode.prototype.getType=function(){return this.type_},Blockly.ASTNode.prototype.getWsCoordinate=function(){return this.wsCoordinate_},Blockly.ASTNode.prototype.isConnection=function(){return this.isConnection_},Blockly.ASTNode.prototype.findNextForInput_=function(){for(var c,b=(a=this.location_.getParentInput()).getSourceBlock(),a=b.inputList.indexOf(a)+1;c=b.inputList[a];a++){for(var f,d=c.fieldRow,e=0;f=d[e];e++)if(f.isClickable()||Blockly.ASTNode.NAVIGATE_ALL_FIELDS)return Blockly.ASTNode.createFieldNode(f);if(c.connection)return Blockly.ASTNode.createInputNode(c)}return null},Blockly.ASTNode.prototype.findNextForField_=function(){for(var b=(a=this.location_).getParentInput(),c=a.getSourceBlock(),d=c.inputList.indexOf(b),a=b.fieldRow.indexOf(a)+1;b=c.inputList[d];d++){for(var e=b.fieldRow;ab-Blockly.CURRENT_CONNECTION_PREFERENCE)):((this.localConnection_||this.closestConnection_)&&(console.error("Only one of localConnection_ and closestConnection_ was set."),console.error("Returning true from shouldUpdatePreviews, but it's not clear why.")),!0):!(!this.localConnection_||!this.closestConnection_)},Blockly.InsertionMarkerManager.prototype.getCandidate_=function(a){for(var b=this.getStartRadius_(),c=null,d=null,e=0;ec||b.getSourceBlock().isInsertionMarker())return!1;switch(b.type){case Blockly.connectionTypes.PREVIOUS_STATEMENT:return this.canConnectToPrevious_(a,b);case Blockly.connectionTypes.OUTPUT_VALUE:if(b.isConnected()&&!b.targetBlock().isInsertionMarker()||a.isConnected())return!1;break;case Blockly.connectionTypes.INPUT_VALUE:if(b.isConnected()&&!b.targetBlock().isMovable()&&!b.targetBlock().isShadow())return!1;break;case Blockly.connectionTypes.NEXT_STATEMENT:if(b.isConnected()&&!a.getSourceBlock().nextConnection&&!b.targetBlock().isShadow()&&b.targetBlock().nextConnection)return!1;break;default:return!1}return-1==Blockly.draggingConnections.indexOf(b)},Blockly.ConnectionChecker.prototype.canConnectToPrevious_=function(a,b){return!a.targetConnection&&-1==Blockly.draggingConnections.indexOf(b)&&(!b.targetConnection||!!(a=b.targetBlock()).isInsertionMarker()&&!a.getPreviousBlock())},Blockly.registry.register(Blockly.registry.Type.CONNECTION_CHECKER,Blockly.registry.DEFAULT,Blockly.ConnectionChecker),Blockly.VariableMap=function(a){this.variableMap_=Object.create(null),this.workspace=a},Blockly.VariableMap.prototype.clear=function(){this.variableMap_=Object.create(null)},Blockly.VariableMap.prototype.renameVariable=function(a,b){var c=this.getVariable(b,a.type),d=this.workspace.getAllBlocks(!1);Blockly.Events.setGroup(!0);try{c&&c.getId()!=a.getId()?this.renameVariableWithConflict_(a,b,c,d):this.renameVariableAndUses_(a,b,d)}finally{Blockly.Events.setGroup(!1)}},Blockly.VariableMap.prototype.renameVariableById=function(a,b){var c=this.getVariableById(a);if(!c)throw Error("Tried to rename a variable that didn't exist. ID: "+a);this.renameVariable(c,b)},Blockly.VariableMap.prototype.renameVariableAndUses_=function(a,b,c){for(Blockly.Events.fire(new(Blockly.Events.get(Blockly.Events.VAR_RENAME))(a,b)),a.name=b,b=0;bthis.remainingCapacityOfType(c))return!1;b+=a[c]}return!(b>this.remainingCapacity())},Blockly.Workspace.prototype.hasBlockLimits=function(){return 1/0!=this.options.maxBlocks||!!this.options.maxInstances},Blockly.Workspace.prototype.getUndoStack=function(){return this.undoStack_},Blockly.Workspace.prototype.getRedoStack=function(){return this.redoStack_},Blockly.Workspace.prototype.undo=function(a){var b=a?this.redoStack_:this.undoStack_,c=a?this.undoStack_:this.redoStack_,d=b.pop();if(d){for(var e=[d];b.length&&d.group&&d.group==b[b.length-1].group;)e.push(b.pop());for(b=0;d=e[b];b++)c.push(d);e=Blockly.Events.filter(e,a),Blockly.Events.recordUndo=!1;try{for(b=0;d=e[b];b++)d.run(a)}finally{Blockly.Events.recordUndo=!0}}},Blockly.Workspace.prototype.clearUndo=function(){this.undoStack_.length=0,this.redoStack_.length=0,Blockly.Events.clearPendingUndo()},Blockly.Workspace.prototype.addChangeListener=function(a){return this.listeners_.push(a),a},Blockly.Workspace.prototype.removeChangeListener=function(a){Blockly.utils.arrayRemove(this.listeners_,a)},Blockly.Workspace.prototype.fireChangeListener=function(a){if(a.recordUndo)for(this.undoStack_.push(a),this.redoStack_.length=0;this.undoStack_.length>this.MAX_UNDO&&0<=this.MAX_UNDO;)this.undoStack_.shift();for(var c,b=0;c=this.listeners_[b];b++)c(a)},Blockly.Workspace.prototype.getBlockById=function(a){return this.blockDB_[a]||null},Blockly.Workspace.prototype.setBlockById=function(a,b){this.blockDB_[a]=b},Blockly.Workspace.prototype.removeBlockById=function(a){delete this.blockDB_[a]},Blockly.Workspace.prototype.getCommentById=function(a){return this.commentDB_[a]||null},Blockly.Workspace.prototype.allInputsFilled=function(a){for(var d,b=this.getTopBlocks(!1),c=0;d=b[c];c++)if(!d.allInputsFilled(a))return!1;return!0},Blockly.Workspace.prototype.getPotentialVariableMap=function(){return this.potentialVariableMap_},Blockly.Workspace.prototype.createPotentialVariableMap=function(){this.potentialVariableMap_=new Blockly.VariableMap(this)},Blockly.Workspace.prototype.getVariableMap=function(){return this.variableMap_},Blockly.Workspace.prototype.setVariableMap=function(a){this.variableMap_=a},Blockly.Workspace.WorkspaceDB_=Object.create(null),Blockly.Workspace.getById=function(a){return Blockly.Workspace.WorkspaceDB_[a]||null},Blockly.Workspace.getAll=function(){var b,a=[];for(b in Blockly.Workspace.WorkspaceDB_)a.push(Blockly.Workspace.WorkspaceDB_[b]);return a},Blockly.Bubble=function(a,b,c,d,e,f){this.workspace_=a,this.content_=b,this.shape_=c,this.onMouseDownResizeWrapper_=this.onMouseDownBubbleWrapper_=this.moveCallback_=this.resizeCallback_=null,this.disposed=!1,c=Blockly.Bubble.ARROW_ANGLE,this.workspace_.RTL&&(c=-c),this.arrow_radians_=Blockly.utils.math.toRadians(c),a.getBubbleCanvas().appendChild(this.createDom_(b,!(!e||!f))),this.setAnchorLocation(d),e&&f||(e=(a=this.content_.getBBox()).width+2*Blockly.Bubble.BORDER_WIDTH,f=a.height+2*Blockly.Bubble.BORDER_WIDTH),this.setBubbleSize(e,f),this.positionBubble_(),this.renderArrow_(),this.rendered_=!0},Blockly.Bubble.BORDER_WIDTH=6,Blockly.Bubble.ARROW_THICKNESS=5,Blockly.Bubble.ARROW_ANGLE=20,Blockly.Bubble.ARROW_BEND=4,Blockly.Bubble.ANCHOR_RADIUS=8,Blockly.Bubble.onMouseUpWrapper_=null,Blockly.Bubble.onMouseMoveWrapper_=null,Blockly.Bubble.unbindDragEvents_=function(){Blockly.Bubble.onMouseUpWrapper_&&(Blockly.browserEvents.unbind(Blockly.Bubble.onMouseUpWrapper_),Blockly.Bubble.onMouseUpWrapper_=null),Blockly.Bubble.onMouseMoveWrapper_&&(Blockly.browserEvents.unbind(Blockly.Bubble.onMouseMoveWrapper_),Blockly.Bubble.onMouseMoveWrapper_=null)},Blockly.Bubble.bubbleMouseUp_=function(a){Blockly.Touch.clearTouchIdentifier(),Blockly.Bubble.unbindDragEvents_()},Blockly.Bubble.prototype.rendered_=!1,Blockly.Bubble.prototype.anchorXY_=null,Blockly.Bubble.prototype.relativeLeft_=0,Blockly.Bubble.prototype.relativeTop_=0,Blockly.Bubble.prototype.width_=0,Blockly.Bubble.prototype.height_=0,Blockly.Bubble.prototype.autoLayout_=!0,Blockly.Bubble.prototype.createDom_=function(a,b){this.bubbleGroup_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.G,{},null);var c={filter:"url(#"+this.workspace_.getRenderer().getConstants().embossFilterId+")"};return Blockly.utils.userAgent.JAVA_FX&&(c={}),c=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.G,c,this.bubbleGroup_),this.bubbleArrow_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.PATH,{},c),this.bubbleBack_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.RECT,{class:"blocklyDraggable",x:0,y:0,rx:Blockly.Bubble.BORDER_WIDTH,ry:Blockly.Bubble.BORDER_WIDTH},c),b?(this.resizeGroup_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.G,{class:this.workspace_.RTL?"blocklyResizeSW":"blocklyResizeSE"},this.bubbleGroup_),b=2*Blockly.Bubble.BORDER_WIDTH,Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.POLYGON,{points:"0,x x,x x,0".replace(/x/g,b.toString())},this.resizeGroup_),Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.LINE,{class:"blocklyResizeLine",x1:b/3,y1:b-1,x2:b-1,y2:b/3},this.resizeGroup_),Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.LINE,{class:"blocklyResizeLine",x1:2*b/3,y1:b-1,x2:b-1,y2:2*b/3},this.resizeGroup_)):this.resizeGroup_=null,this.workspace_.options.readOnly||(this.onMouseDownBubbleWrapper_=Blockly.browserEvents.conditionalBind(this.bubbleBack_,"mousedown",this,this.bubbleMouseDown_),this.resizeGroup_&&(this.onMouseDownResizeWrapper_=Blockly.browserEvents.conditionalBind(this.resizeGroup_,"mousedown",this,this.resizeMouseDown_))),this.bubbleGroup_.appendChild(a),this.bubbleGroup_},Blockly.Bubble.prototype.getSvgRoot=function(){return this.bubbleGroup_},Blockly.Bubble.prototype.setSvgId=function(a){this.bubbleGroup_.dataset&&(this.bubbleGroup_.dataset.blockId=a)},Blockly.Bubble.prototype.bubbleMouseDown_=function(a){var b=this.workspace_.getGesture(a);b&&b.handleBubbleStart(a,this)},Blockly.Bubble.prototype.showContextMenu=function(a){},Blockly.Bubble.prototype.isDeletable=function(){return!1},Blockly.Bubble.prototype.setDeleteStyle=function(a){},Blockly.Bubble.prototype.resizeMouseDown_=function(a){this.promote(),Blockly.Bubble.unbindDragEvents_(),Blockly.utils.isRightButton(a)||(this.workspace_.startDrag(a,new Blockly.utils.Coordinate(this.workspace_.RTL?-this.width_:this.width_,this.height_)),Blockly.Bubble.onMouseUpWrapper_=Blockly.browserEvents.conditionalBind(document,"mouseup",this,Blockly.Bubble.bubbleMouseUp_),Blockly.Bubble.onMouseMoveWrapper_=Blockly.browserEvents.conditionalBind(document,"mousemove",this,this.resizeMouseMove_),Blockly.hideChaff()),a.stopPropagation()},Blockly.Bubble.prototype.resizeMouseMove_=function(a){this.autoLayout_=!1,a=this.workspace_.moveDrag(a),this.setBubbleSize(this.workspace_.RTL?-a.x:a.x,a.y),this.workspace_.RTL&&this.positionBubble_()},Blockly.Bubble.prototype.registerResizeEvent=function(a){this.resizeCallback_=a},Blockly.Bubble.prototype.registerMoveEvent=function(a){this.moveCallback_=a},Blockly.Bubble.prototype.promote=function(){var a=this.bubbleGroup_.parentNode;return a.lastChild!==this.bubbleGroup_&&(a.appendChild(this.bubbleGroup_),!0)},Blockly.Bubble.prototype.setAnchorLocation=function(a){this.anchorXY_=a,this.rendered_&&this.positionBubble_()},Blockly.Bubble.prototype.layoutBubble_=function(){var a=this.workspace_.getMetricsManager().getViewMetrics(!0),b=this.getOptimalRelativeLeft_(a),c=this.getOptimalRelativeTop_(a),d=this.shape_.getBBox(),e={x:b,y:-this.height_-this.workspace_.getRenderer().getConstants().MIN_BLOCK_HEIGHT},f={x:-this.width_-30,y:c},c={x:d.width,y:c},g={x:b,y:d.height},b=d.widtha.width||(this.workspace_.RTL?(d=(c=this.anchorXY_.x-b)-this.width_,e=a.left+a.width,f=a.left+Blockly.Scrollbar.scrollbarThickness/this.workspace_.scale):(c=(d=b+this.anchorXY_.x)+this.width_,f=a.left,e=a.left+a.width-Blockly.Scrollbar.scrollbarThickness/this.workspace_.scale),this.workspace_.RTL?da.height)return b;var c=this.anchorXY_.y+b,d=c+this.height_,e=a.top;a=a.top+a.height-Blockly.Scrollbar.scrollbarThickness/this.workspace_.scale;var f=this.anchorXY_.y;return c2*Math.PI&&(h-=2*Math.PI),k=Math.sin(h),l=Math.cos(h),h=((m=this.getBubbleSize()).width+m.height)/Blockly.Bubble.ARROW_THICKNESS,h=Math.min(h,m.width,m.height)/4,d=b+(m=1-Blockly.Bubble.ANCHOR_RADIUS/f)*d,e=c+m*e,m=b+h*l,n=c+h*k,b-=h*l,c-=h*k,(k=g+this.arrow_radians_)>2*Math.PI&&(k-=2*Math.PI),g=Math.sin(k)*f/Blockly.Bubble.ARROW_BEND,f=Math.cos(k)*f/Blockly.Bubble.ARROW_BEND,a.push("M"+m+","+n),a.push("C"+(m+f)+","+(n+g)+" "+d+","+e+" "+d+","+e),a.push("C"+d+","+e+" "+(b+f)+","+(c+g)+" "+b+","+c)),a.push("z"),this.bubbleArrow_.setAttribute("d",a.join(" "))},Blockly.Bubble.prototype.setColour=function(a){this.bubbleBack_.setAttribute("fill",a),this.bubbleArrow_.setAttribute("fill",a)},Blockly.Bubble.prototype.dispose=function(){this.onMouseDownBubbleWrapper_&&Blockly.browserEvents.unbind(this.onMouseDownBubbleWrapper_),this.onMouseDownResizeWrapper_&&Blockly.browserEvents.unbind(this.onMouseDownResizeWrapper_),Blockly.Bubble.unbindDragEvents_(),Blockly.utils.dom.removeNode(this.bubbleGroup_),this.disposed=!0},Blockly.Bubble.prototype.moveDuringDrag=function(a,b){a?a.translateSurface(b.x,b.y):this.moveTo(b.x,b.y),this.relativeLeft_=this.workspace_.RTL?this.anchorXY_.x-b.x-this.width_:b.x-this.anchorXY_.x,this.relativeTop_=b.y-this.anchorXY_.y,this.renderArrow_()},Blockly.Bubble.prototype.getRelativeToSurfaceXY=function(){return new Blockly.utils.Coordinate(this.workspace_.RTL?-this.relativeLeft_+this.anchorXY_.x-this.width_:this.anchorXY_.x+this.relativeLeft_,this.anchorXY_.y+this.relativeTop_)},Blockly.Bubble.prototype.setAutoLayout=function(a){this.autoLayout_=a},Blockly.Bubble.textToDom=function(a){var b=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.TEXT,{class:"blocklyText blocklyBubbleText blocklyNoPointerEvents",y:Blockly.Bubble.BORDER_WIDTH},null);a=a.split("\n");for(var c=0;c(this.flyout_?Blockly.FLYOUT_DRAG_RADIUS:Blockly.DRAG_RADIUS))},Blockly.Gesture.prototype.updateIsDraggingFromFlyout_=function(){return!(!this.targetBlock_||!this.flyout_.isBlockCreatable_(this.targetBlock_))&&(!(this.flyout_.isScrollable()&&!this.flyout_.isDragTowardWorkspace(this.currentDragDeltaXY_))&&(this.startWorkspace_=this.flyout_.targetWorkspace,this.startWorkspace_.updateScreenCalculationsIfScrolled(),Blockly.Events.getGroup()||Blockly.Events.setGroup(!0),this.startBlock_=null,this.targetBlock_=this.flyout_.createBlock(this.targetBlock_),this.targetBlock_.select(),!0))},Blockly.Gesture.prototype.updateIsDraggingBubble_=function(){return!!this.startBubble_&&(this.isDraggingBubble_=!0,this.startDraggingBubble_(),!0)},Blockly.Gesture.prototype.updateIsDraggingBlock_=function(){return!!this.targetBlock_&&(this.flyout_?this.isDraggingBlock_=this.updateIsDraggingFromFlyout_():this.targetBlock_.isMovable()&&(this.isDraggingBlock_=!0),!!this.isDraggingBlock_&&(this.startDraggingBlock_(),!0))},Blockly.Gesture.prototype.updateIsDraggingWorkspace_=function(){(this.flyout_?this.flyout_.isScrollable():this.startWorkspace_&&this.startWorkspace_.isDraggable())&&(this.workspaceDragger_=new Blockly.WorkspaceDragger(this.startWorkspace_),this.isDraggingWorkspace_=!0,this.workspaceDragger_.startDrag())},Blockly.Gesture.prototype.updateIsDragging_=function(){if(this.calledUpdateIsDragging_)throw Error("updateIsDragging_ should only be called once per gesture.");this.calledUpdateIsDragging_=!0,this.updateIsDraggingBubble_()||this.updateIsDraggingBlock_()||this.updateIsDraggingWorkspace_()},Blockly.Gesture.prototype.startDraggingBlock_=function(){this.blockDragger_=new Blockly.BlockDragger(this.targetBlock_,this.startWorkspace_),this.blockDragger_.startBlockDrag(this.currentDragDeltaXY_,this.healStack_),this.blockDragger_.dragBlock(this.mostRecentEvent_,this.currentDragDeltaXY_)},Blockly.Gesture.prototype.startDraggingBubble_=function(){this.bubbleDragger_=new Blockly.BubbleDragger(this.startBubble_,this.startWorkspace_),this.bubbleDragger_.startBubbleDrag(),this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_)},Blockly.Gesture.prototype.doStart=function(a){Blockly.utils.isTargetInput(a)?this.cancel():(this.hasStarted_=!0,Blockly.blockAnimations.disconnectUiStop(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),Blockly.hideChaff(!!this.flyout_),this.startWorkspace_.markFocused(),this.mostRecentEvent_=a,Blockly.Tooltip.block(),this.targetBlock_&&this.targetBlock_.select(),Blockly.utils.isRightButton(a)?this.handleRightClick(a):("touchstart"!=a.type.toLowerCase()&&"pointerdown"!=a.type.toLowerCase()||"mouse"==a.pointerType||Blockly.longStart(a,this),this.mouseDownXY_=new Blockly.utils.Coordinate(a.clientX,a.clientY),this.healStack_=a.altKey||a.ctrlKey||a.metaKey,this.bindMouseEvents(a)))},Blockly.Gesture.prototype.bindMouseEvents=function(a){this.onMoveWrapper_=Blockly.browserEvents.conditionalBind(document,"mousemove",null,this.handleMove.bind(this)),this.onUpWrapper_=Blockly.browserEvents.conditionalBind(document,"mouseup",null,this.handleUp.bind(this)),a.preventDefault(),a.stopPropagation()},Blockly.Gesture.prototype.handleMove=function(a){this.updateFromEvent_(a),this.isDraggingWorkspace_?this.workspaceDragger_.drag(this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.dragBlock(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingBubble_&&this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_),a.preventDefault(),a.stopPropagation()},Blockly.Gesture.prototype.handleUp=function(a){this.updateFromEvent_(a),Blockly.longStop_(),this.isEnding_?console.log("Trying to end a gesture recursively."):(this.isEnding_=!0,this.isDraggingBubble_?this.bubbleDragger_.endBubbleDrag(a,this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.endBlockDrag(a,this.currentDragDeltaXY_):this.isDraggingWorkspace_?this.workspaceDragger_.endDrag(this.currentDragDeltaXY_):this.isBubbleClick_()?this.doBubbleClick_():this.isFieldClick_()?this.doFieldClick_():this.isBlockClick_()?this.doBlockClick_():this.isWorkspaceClick_()&&this.doWorkspaceClick_(a),a.preventDefault(),a.stopPropagation(),this.dispose())},Blockly.Gesture.prototype.cancel=function(){this.isEnding_||(Blockly.longStop_(),this.isDraggingBubble_?this.bubbleDragger_.endBubbleDrag(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.endBlockDrag(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingWorkspace_&&this.workspaceDragger_.endDrag(this.currentDragDeltaXY_),this.dispose())},Blockly.Gesture.prototype.handleRightClick=function(a){this.targetBlock_?(this.bringBlockToFront_(),Blockly.hideChaff(!!this.flyout_),this.targetBlock_.showContextMenu(a)):this.startBubble_?this.startBubble_.showContextMenu(a):this.startWorkspace_&&!this.flyout_&&(Blockly.hideChaff(),this.startWorkspace_.showContextMenu(a)),a.preventDefault(),a.stopPropagation(),this.dispose()},Blockly.Gesture.prototype.handleWsStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");this.setStartWorkspace_(b),this.mostRecentEvent_=a,this.doStart(a)},Blockly.Gesture.prototype.fireWorkspaceClick_=function(a){Blockly.Events.fire(new(Blockly.Events.get(Blockly.Events.CLICK))(null,a.id,"workspace"))},Blockly.Gesture.prototype.handleFlyoutStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");this.setStartFlyout_(b),this.handleWsStart(a,b.getWorkspace())},Blockly.Gesture.prototype.handleBlockStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleBlockStart, but the gesture had already been started.");this.setStartBlock(b),this.mostRecentEvent_=a},Blockly.Gesture.prototype.handleBubbleStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");this.setStartBubble(b),this.mostRecentEvent_=a},Blockly.Gesture.prototype.doBubbleClick_=function(){this.startBubble_.setFocus&&this.startBubble_.setFocus(),this.startBubble_.select&&this.startBubble_.select()},Blockly.Gesture.prototype.doFieldClick_=function(){this.startField_.showEditor(this.mostRecentEvent_),this.bringBlockToFront_()},Blockly.Gesture.prototype.doBlockClick_=function(){var a;this.flyout_&&this.flyout_.autoClose?this.targetBlock_.isEnabled()&&(Blockly.Events.getGroup()||Blockly.Events.setGroup(!0),this.flyout_.createBlock(this.targetBlock_).scheduleSnapAndBump()):(a=new(Blockly.Events.get(Blockly.Events.CLICK))(this.startBlock_,this.startWorkspace_.id,"block"),Blockly.Events.fire(a)),this.bringBlockToFront_(),Blockly.Events.setGroup(!1)},Blockly.Gesture.prototype.doWorkspaceClick_=function(a){a=this.creatorWorkspace_,Blockly.selected&&Blockly.selected.unselect(),this.fireWorkspaceClick_(this.startWorkspace_||a)},Blockly.Gesture.prototype.bringBlockToFront_=function(){this.targetBlock_&&!this.flyout_&&this.targetBlock_.bringToFront()},Blockly.Gesture.prototype.setStartField=function(a){if(this.hasStarted_)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");this.startField_||(this.startField_=a)},Blockly.Gesture.prototype.setStartBubble=function(a){this.startBubble_||(this.startBubble_=a)},Blockly.Gesture.prototype.setStartBlock=function(a){this.startBlock_||this.startBubble_||((this.startBlock_=a).isInFlyout&&a!=a.getRootBlock()?this.setTargetBlock_(a.getRootBlock()):this.setTargetBlock_(a))},Blockly.Gesture.prototype.setTargetBlock_=function(a){a.isShadow()?this.setTargetBlock_(a.getParent()):this.targetBlock_=a},Blockly.Gesture.prototype.setStartWorkspace_=function(a){this.startWorkspace_||(this.startWorkspace_=a)},Blockly.Gesture.prototype.setStartFlyout_=function(a){this.flyout_||(this.flyout_=a)},Blockly.Gesture.prototype.isBubbleClick_=function(){return!!this.startBubble_&&!this.hasExceededDragRadius_},Blockly.Gesture.prototype.isBlockClick_=function(){return!!this.startBlock_&&!this.hasExceededDragRadius_&&!this.isFieldClick_()},Blockly.Gesture.prototype.isFieldClick_=function(){return!!this.startField_&&this.startField_.isClickable()&&!this.hasExceededDragRadius_&&(!this.flyout_||!this.flyout_.autoClose)},Blockly.Gesture.prototype.isWorkspaceClick_=function(){return!(this.startBlock_||this.startBubble_||this.startField_||this.hasExceededDragRadius_)},Blockly.Gesture.prototype.isDragging=function(){return this.isDraggingWorkspace_||this.isDraggingBlock_||this.isDraggingBubble_},Blockly.Gesture.prototype.hasStarted=function(){return this.hasStarted_},Blockly.Gesture.prototype.getInsertionMarkers=function(){return this.blockDragger_?this.blockDragger_.getInsertionMarkers():[]},Blockly.Gesture.inProgress=function(){for(var c,a=Blockly.Workspace.getAll(),b=0;c=a[b];b++)if(c.currentGesture_)return!0;return!1},Blockly.Field=function(a,b,c){this.value_=this.DEFAULT_VALUE,this.tooltip_=this.validator_=null,this.size_=new Blockly.utils.Size(0,0),this.constants_=this.mouseDownWrapper_=this.textContent_=this.textElement_=this.borderRect_=this.fieldGroup_=this.markerSvg_=this.cursorSvg_=null,c&&this.configure_(c),this.setValue(a),b&&this.setValidator(b)},Blockly.Field.prototype.DEFAULT_VALUE=null,Blockly.Field.prototype.name=void 0,Blockly.Field.prototype.disposed=!1,Blockly.Field.prototype.maxDisplayLength=50,Blockly.Field.prototype.sourceBlock_=null,Blockly.Field.prototype.isDirty_=!0,Blockly.Field.prototype.visible_=!0,Blockly.Field.prototype.clickTarget_=null,Blockly.Field.NBSP=" ",Blockly.Field.prototype.EDITABLE=!0,Blockly.Field.prototype.SERIALIZABLE=!1,Blockly.Field.prototype.configure_=function(a){var b=a.tooltip;(b="string"==typeof b?Blockly.utils.replaceMessageReferences(a.tooltip):b)&&this.setTooltip(b)},Blockly.Field.prototype.setSourceBlock=function(a){if(this.sourceBlock_)throw Error("Field already bound to a block.");this.sourceBlock_=a},Blockly.Field.prototype.getConstants=function(){return!this.constants_&&this.sourceBlock_&&this.sourceBlock_.workspace&&this.sourceBlock_.workspace.rendered&&(this.constants_=this.sourceBlock_.workspace.getRenderer().getConstants()),this.constants_},Blockly.Field.prototype.getSourceBlock=function(){return this.sourceBlock_},Blockly.Field.prototype.init=function(){this.fieldGroup_||(this.fieldGroup_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.G,{},null),this.isVisible()||(this.fieldGroup_.style.display="none"),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_),this.initView(),this.updateEditable(),this.setTooltip(this.tooltip_),this.bindEvents_(),this.initModel())},Blockly.Field.prototype.initView=function(){this.createBorderRect_(),this.createTextElement_()},Blockly.Field.prototype.initModel=function(){},Blockly.Field.prototype.createBorderRect_=function(){this.borderRect_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.RECT,{rx:this.getConstants().FIELD_BORDER_RECT_RADIUS,ry:this.getConstants().FIELD_BORDER_RECT_RADIUS,x:0,y:0,height:this.size_.height,width:this.size_.width,class:"blocklyFieldRect"},this.fieldGroup_)},Blockly.Field.prototype.createTextElement_=function(){this.textElement_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.TEXT,{class:"blocklyText"},this.fieldGroup_),this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.textElement_.setAttribute("dominant-baseline","central"),this.textContent_=document.createTextNode(""),this.textElement_.appendChild(this.textContent_)},Blockly.Field.prototype.bindEvents_=function(){Blockly.Tooltip.bindMouseEvents(this.getClickTarget_()),this.mouseDownWrapper_=Blockly.browserEvents.conditionalBind(this.getClickTarget_(),"mousedown",this,this.onMouseDown_)},Blockly.Field.prototype.fromXml=function(a){this.setValue(a.textContent)},Blockly.Field.prototype.toXml=function(a){return a.textContent=this.getValue(),a},Blockly.Field.prototype.dispose=function(){Blockly.DropDownDiv.hideIfOwner(this),Blockly.WidgetDiv.hideIfOwner(this),Blockly.Tooltip.unbindMouseEvents(this.getClickTarget_()),this.mouseDownWrapper_&&Blockly.browserEvents.unbind(this.mouseDownWrapper_),Blockly.utils.dom.removeNode(this.fieldGroup_),this.disposed=!0},Blockly.Field.prototype.updateEditable=function(){var a=this.fieldGroup_;this.EDITABLE&&a&&(this.sourceBlock_.isEditable()?(Blockly.utils.dom.addClass(a,"blocklyEditableText"),Blockly.utils.dom.removeClass(a,"blocklyNonEditableText"),a.style.cursor=this.CURSOR):(Blockly.utils.dom.addClass(a,"blocklyNonEditableText"),Blockly.utils.dom.removeClass(a,"blocklyEditableText"),a.style.cursor=""))},Blockly.Field.prototype.isClickable=function(){return!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&!!this.showEditor_&&"function"==typeof this.showEditor_},Blockly.Field.prototype.isCurrentlyEditable=function(){return this.EDITABLE&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()},Blockly.Field.prototype.isSerializable=function(){var a=!1;return this.name&&(this.SERIALIZABLE?a=!0:this.EDITABLE&&(console.warn("Detected an editable field that was not serializable. Please define SERIALIZABLE property as true on all editable custom fields. Proceeding with serialization."),a=!0)),a},Blockly.Field.prototype.isVisible=function(){return this.visible_},Blockly.Field.prototype.setVisible=function(a){var b;this.visible_!=a&&(this.visible_=a,(b=this.getSvgRoot())&&(b.style.display=a?"block":"none"))},Blockly.Field.prototype.setValidator=function(a){this.validator_=a},Blockly.Field.prototype.getValidator=function(){return this.validator_},Blockly.Field.prototype.getSvgRoot=function(){return this.fieldGroup_},Blockly.Field.prototype.applyColour=function(){},Blockly.Field.prototype.render_=function(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_()},Blockly.Field.prototype.showEditor=function(a){this.isClickable()&&this.showEditor_(a)},Blockly.Field.prototype.updateSize_=function(a){var b=this.getConstants(),c=2*(a=null!=a?a:this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0),d=b.FIELD_TEXT_HEIGHT,e=0;this.textElement_&&(c+=e=Blockly.utils.dom.getFastTextWidth(this.textElement_,b.FIELD_TEXT_FONTSIZE,b.FIELD_TEXT_FONTWEIGHT,b.FIELD_TEXT_FONTFAMILY)),this.borderRect_&&(d=Math.max(d,b.FIELD_BORDER_RECT_HEIGHT)),this.size_.height=d,this.size_.width=c,this.positionTextElement_(a,e),this.positionBorderRect_()},Blockly.Field.prototype.positionTextElement_=function(a,b){var c,d;this.textElement_&&(c=this.getConstants(),d=this.size_.height/2,this.textElement_.setAttribute("x",this.sourceBlock_.RTL?this.size_.width-b-a:a),this.textElement_.setAttribute("y",c.FIELD_TEXT_BASELINE_CENTER?d:d-c.FIELD_TEXT_HEIGHT/2+c.FIELD_TEXT_BASELINE))},Blockly.Field.prototype.positionBorderRect_=function(){this.borderRect_&&(this.borderRect_.setAttribute("width",this.size_.width),this.borderRect_.setAttribute("height",this.size_.height),this.borderRect_.setAttribute("rx",this.getConstants().FIELD_BORDER_RECT_RADIUS),this.borderRect_.setAttribute("ry",this.getConstants().FIELD_BORDER_RECT_RADIUS))},Blockly.Field.prototype.getSize=function(){return this.isVisible()?(this.isDirty_?(this.render_(),this.isDirty_=!1):this.visible_&&0==this.size_.width&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.render_()),this.size_):new Blockly.utils.Size(0,0)},Blockly.Field.prototype.getScaledBBox=function(){var b,c,d,a;return this.borderRect_?(a=this.borderRect_.getBoundingClientRect(),c=Blockly.utils.style.getPageOffset(this.borderRect_),d=a.width,a=a.height):(a=this.sourceBlock_.getHeightWidth(),b=this.sourceBlock_.workspace.scale,c=this.getAbsoluteXY_(),d=a.width*b,a=a.height*b,Blockly.utils.userAgent.GECKO?(c.x+=1.5*b,c.y+=1.5*b):Blockly.utils.userAgent.EDGE||Blockly.utils.userAgent.IE||(c.x-=.5*b,c.y-=.5*b),d+=+b,a+=+b),new Blockly.utils.Rect(c.y,c.y+a,c.x,c.x+d)},Blockly.Field.prototype.getDisplayText_=function(){var a=this.getText();return a?(a=(a=a.length>this.maxDisplayLength?a.substring(0,this.maxDisplayLength-2)+"…":a).replace(/\s/g,Blockly.Field.NBSP),this.sourceBlock_&&this.sourceBlock_.RTL&&(a+="‏"),a):Blockly.Field.NBSP},Blockly.Field.prototype.getText=function(){if(this.getText_){var a=this.getText_.call(this);if(null!==a)return String(a)}return String(this.getValue())},Blockly.Field.prototype.markDirty=function(){this.isDirty_=!0,this.constants_=null},Blockly.Field.prototype.forceRerender=function(){this.isDirty_=!0,this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours(),this.updateMarkers_())},Blockly.Field.prototype.setValue=function(a){var c,b;null!==a&&(b=this.doClassValidation_(a),(a=this.processValidation_(a,b))instanceof Error||(b=this.getValidator())&&(b=b.call(this,a),(a=this.processValidation_(a,b))instanceof Error)||(b=this.sourceBlock_)&&b.disposed||((c=this.getValue())===a?this.doValueUpdate_(a):(b&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new(Blockly.Events.get(Blockly.Events.BLOCK_CHANGE))(b,"field",this.name||null,c,a)),this.doValueUpdate_(a),this.isDirty_&&this.forceRerender())))},Blockly.Field.prototype.processValidation_=function(a,b){return null===b?(this.doValueInvalid_(a),this.isDirty_&&this.forceRerender(),Error()):void 0!==b?b:a},Blockly.Field.prototype.getValue=function(){return this.value_},Blockly.Field.prototype.doClassValidation_=function(a){return null==a?null:a},Blockly.Field.prototype.doValueUpdate_=function(a){this.value_=a,this.isDirty_=!0},Blockly.Field.prototype.doValueInvalid_=function(a){},Blockly.Field.prototype.onMouseDown_=function(a){this.sourceBlock_&&this.sourceBlock_.workspace&&(a=this.sourceBlock_.workspace.getGesture(a))&&a.setStartField(this)},Blockly.Field.prototype.setTooltip=function(a){a||""===a||(a=this.sourceBlock_);var b=this.getClickTarget_();b?b.tooltip=a:this.tooltip_=a},Blockly.Field.prototype.getTooltip=function(){var a=this.getClickTarget_();return a?Blockly.Tooltip.getTooltipOfObject(a):Blockly.Tooltip.getTooltipOfObject({tooltip:this.tooltip_})},Blockly.Field.prototype.getClickTarget_=function(){return this.clickTarget_||this.getSvgRoot()},Blockly.Field.prototype.getAbsoluteXY_=function(){return Blockly.utils.style.getPageOffset(this.getClickTarget_())},Blockly.Field.prototype.referencesVariables=function(){return!1},Blockly.Field.prototype.getParentInput=function(){for(var a=null,b=this.sourceBlock_,c=b.inputList,d=0;dthis.fieldRow.length)throw Error("index "+a+" out of bounds.");return(b||""==b&&c)&&((b="string"==typeof b?Blockly.fieldRegistry.fromJson({type:"field_label",text:b}):b).setSourceBlock(this.sourceBlock_),this.sourceBlock_.rendered&&(b.init(),b.applyColour()),b.name=c,b.setVisible(this.isVisible()),b.prefixField&&(a=this.insertFieldAt(a,b.prefixField)),this.fieldRow.splice(a,0,b),++a,b.suffixField&&(a=this.insertFieldAt(a,b.suffixField)),this.sourceBlock_.rendered&&(this.sourceBlock_=this.sourceBlock_,this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours())),a},Blockly.Input.prototype.removeField=function(a,b){for(var d,c=0;d=this.fieldRow[c];c++)if(d.name===a)return d.dispose(),this.fieldRow.splice(c,1),this.sourceBlock_.rendered&&(this.sourceBlock_=this.sourceBlock_,this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours()),!0;if(b)return!1;throw Error('Field "'+a+'" not found.')},Blockly.Input.prototype.isVisible=function(){return this.visible_},Blockly.Input.prototype.setVisible=function(a){var b=[];if(this.visible_==a)return b;this.visible_=a;for(var d,c=0;d=this.fieldRow[c];c++)d.setVisible(a);return this.connection&&(this.connection=this.connection,a?b=this.connection.startTrackingAll():this.connection.stopTrackingAll(),c=this.connection.targetBlock())&&(c.getSvgRoot().style.display=a?"block":"none"),b},Blockly.Input.prototype.markDirty=function(){for(var b,a=0;b=this.fieldRow[a];a++)b.markDirty()},Blockly.Input.prototype.setCheck=function(a){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.setCheck(a),this},Blockly.Input.prototype.setAlign=function(a){return this.align=a,this.sourceBlock_.rendered&&(this.sourceBlock_=this.sourceBlock_,this.sourceBlock_.render()),this},Blockly.Input.prototype.setShadowDom=function(a){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.setShadowDom(a),this},Blockly.Input.prototype.getShadowDom=function(){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.getShadowDom()},Blockly.Input.prototype.init=function(){if(this.sourceBlock_.workspace.rendered)for(var a=0;aa?e.substring(0,a-3)+"...":e},Blockly.Block.prototype.appendValueInput=function(a){return this.appendInput_(Blockly.inputTypes.VALUE,a)},Blockly.Block.prototype.appendStatementInput=function(a){return this.appendInput_(Blockly.inputTypes.STATEMENT,a)},Blockly.Block.prototype.appendDummyInput=function(a){return this.appendInput_(Blockly.inputTypes.DUMMY,a||"")},Blockly.Block.prototype.jsonInit=function(a){var b=a.type?'Block "'+a.type+'": ':"";if(a.output&&a.previousStatement)throw Error(b+"Must not have both an output and a previousStatement.");if(a.style&&a.style.hat&&(this.hat=a.style.hat,a.style=null),a.style&&a.colour)throw Error(b+"Must not have both a colour and a style.");a.style?this.jsonInitStyle_(a,b):this.jsonInitColour_(a,b);for(var c=0;void 0!==a["message"+c];)this.interpolate_(a["message"+c],a["args"+c]||[],a["lastDummyAlign"+c],b),c++;if(void 0!==a.inputsInline&&this.setInputsInline(a.inputsInline),void 0!==a.output&&this.setOutput(!0,a.output),void 0!==a.outputShape&&this.setOutputShape(a.outputShape),void 0!==a.previousStatement&&this.setPreviousStatement(!0,a.previousStatement),void 0!==a.nextStatement&&this.setNextStatement(!0,a.nextStatement),void 0!==a.tooltip&&(c=a.tooltip,c=Blockly.utils.replaceMessageReferences(c),this.setTooltip(c)),void 0!==a.enableContextMenu&&(c=a.enableContextMenu,this.contextMenu=!!c),void 0!==a.helpUrl&&(c=a.helpUrl,c=Blockly.utils.replaceMessageReferences(c),this.setHelpUrl(c)),"string"==typeof a.extensions&&(console.warn(b+"JSON attribute 'extensions' should be an array of strings. Found raw string in JSON for '"+a.type+"' block."),a.extensions=[a.extensions]),void 0!==a.mutator&&Blockly.Extensions.apply(a.mutator,this,!0),Array.isArray(a.extensions))for(a=a.extensions,b=0;b=this.inputList.length)throw RangeError("Input index "+a+" out of bounds.");if(b>this.inputList.length)throw RangeError("Reference input "+b+" out of bounds.");var c=this.inputList[a];this.inputList.splice(a,1),a=a.bottom?b.top-c.height:b.bottom},Blockly.ContextMenu={},Blockly.ContextMenu.currentBlock=null,Blockly.ContextMenu.menu_=null,Blockly.ContextMenu.show=function(a,b,c){var d;Blockly.WidgetDiv.show(Blockly.ContextMenu,c,Blockly.ContextMenu.dispose),b.length?(d=Blockly.ContextMenu.populate_(b,c),Blockly.ContextMenu.menu_=d,Blockly.ContextMenu.position_(d,a,c),setTimeout(function(){d.focus()},1),Blockly.ContextMenu.currentBlock=null):Blockly.ContextMenu.hide()},Blockly.ContextMenu.populate_=function(a,b){var c=new Blockly.Menu;c.setRole(Blockly.utils.aria.Role.MENU);for(var e,d=0;e=a[d];d++){var f=new Blockly.MenuItem(e.text);f.setRightToLeft(b),f.setRole(Blockly.utils.aria.Role.MENUITEM),c.addChild(f),f.setEnabled(e.enabled),e.enabled&&f.onAction(function(g){Blockly.ContextMenu.hide(),this.callback(this.scope)},e)}return c},Blockly.ContextMenu.position_=function(a,b,c){var d=Blockly.utils.getViewportBBox();b=new Blockly.utils.Rect(b.clientY+d.top,b.clientY+d.top,b.clientX+d.left,b.clientX+d.left),Blockly.ContextMenu.createWidget_(a);var e=a.getSize();c&&(b.left+=e.width,b.right+=e.width,d.left+=e.width,d.right+=e.width),Blockly.WidgetDiv.positionWithAnchor(d,b,e,c),a.focus()},Blockly.ContextMenu.createWidget_=function(a){a.render(Blockly.WidgetDiv.DIV);var b=a.getElement();Blockly.utils.dom.addClass(b,"blocklyContextMenu"),Blockly.browserEvents.conditionalBind(b,"contextmenu",null,Blockly.utils.noEvent),a.focus()},Blockly.ContextMenu.hide=function(){Blockly.WidgetDiv.hideIfOwner(Blockly.ContextMenu),Blockly.ContextMenu.currentBlock=null},Blockly.ContextMenu.dispose=function(){Blockly.ContextMenu.menu_&&(Blockly.ContextMenu.menu_.dispose(),Blockly.ContextMenu.menu_=null)},Blockly.ContextMenu.callbackFactory=function(a,b){return function(){Blockly.Events.disable();try{var c=Blockly.Xml.domToBlock(b,a.workspace),d=a.getRelativeToSurfaceXY();d.x=a.RTL?d.x-Blockly.SNAP_RADIUS:d.x+Blockly.SNAP_RADIUS,d.y+=2*Blockly.SNAP_RADIUS,c.moveBy(d.x,d.y)}finally{Blockly.Events.enable()}Blockly.Events.isEnabled()&&!c.isShadow()&&Blockly.Events.fire(new(Blockly.Events.get(Blockly.Events.BLOCK_CREATE))(c)),c.select()}},Blockly.ContextMenu.commentDeleteOption=function(a){return{text:Blockly.Msg.REMOVE_COMMENT,enabled:!0,callback:function(){Blockly.Events.setGroup(!0),a.dispose(!0,!0),Blockly.Events.setGroup(!1)}}},Blockly.ContextMenu.commentDuplicateOption=function(a){return{text:Blockly.Msg.DUPLICATE_COMMENT,enabled:!0,callback:function(){Blockly.duplicate(a)}}},Blockly.ContextMenu.workspaceCommentOption=function(a,b){if(!Blockly.WorkspaceCommentSvg)throw Error("Missing require for Blockly.WorkspaceCommentSvg");var c={enabled:!Blockly.utils.userAgent.IE};return c.text=Blockly.Msg.ADD_COMMENT,c.callback=function(){var d=new Blockly.WorkspaceCommentSvg(a,Blockly.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT,Blockly.WorkspaceCommentSvg.DEFAULT_SIZE,Blockly.WorkspaceCommentSvg.DEFAULT_SIZE),e=a.getInjectionDiv().getBoundingClientRect(),e=new Blockly.utils.Coordinate(b.clientX-e.left,b.clientY-e.top),f=a.getOriginOffsetInPixels();(e=Blockly.utils.Coordinate.difference(e,f)).scale(1/a.scale),d.moveBy(e.x,e.y),a.rendered&&(d.initSvg(),d.render(),d.select())},c},Blockly.ContextMenuRegistry=function(){(Blockly.ContextMenuRegistry.registry=this).registry_={}},Blockly.ContextMenuRegistry.ScopeType={BLOCK:"block",WORKSPACE:"workspace"},Blockly.ContextMenuRegistry.registry=null,Blockly.ContextMenuRegistry.prototype.register=function(a){if(this.registry_[a.id])throw Error('Menu item with id "'+a.id+'" is already registered.');this.registry_[a.id]=a},Blockly.ContextMenuRegistry.prototype.unregister=function(a){if(!this.registry_[a])throw Error('Menu item with id "'+a+'" not found.');delete this.registry_[a]},Blockly.ContextMenuRegistry.prototype.getItem=function(a){return this.registry_[a]||null},Blockly.ContextMenuRegistry.prototype.getContextMenuOptions=function(a,b){var c=[],d=this.registry_;return Object.keys(d).forEach(function(e){var f;e=d[e],a!=e.scopeType||"hidden"!=(f=e.preconditionFn(b))&&(e={text:"function"==typeof e.displayText?e.displayText(b):e.displayText,enabled:"enabled"==f,callback:e.callback,scope:b,weight:e.weight},c.push(e))}),c.sort(function(e,f){return e.weight-f.weight}),c},new Blockly.ContextMenuRegistry,Blockly.Events.Selected=function(a,b,c){Blockly.Events.Selected.superClass_.constructor.call(this,c),this.oldElementId=a,this.newElementId=b},Blockly.utils.object.inherits(Blockly.Events.Selected,Blockly.Events.UiBase),Blockly.Events.Selected.prototype.type=Blockly.Events.SELECTED,Blockly.Events.Selected.prototype.toJson=function(){var a=Blockly.Events.Selected.superClass_.toJson.call(this);return a.oldElementId=this.oldElementId,a.newElementId=this.newElementId,a},Blockly.Events.Selected.prototype.fromJson=function(a){Blockly.Events.Selected.superClass_.fromJson.call(this,a),this.oldElementId=a.oldElementId,this.newElementId=a.newElementId},Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.SELECTED,Blockly.Events.Selected),Blockly.RenderedConnection=function(a,b){Blockly.RenderedConnection.superClass_.constructor.call(this,a,b),this.db_=a.workspace.connectionDBList[b],this.dbOpposite_=a.workspace.connectionDBList[Blockly.OPPOSITE_TYPE[b]],this.offsetInBlock_=new Blockly.utils.Coordinate(0,0),this.trackedState_=Blockly.RenderedConnection.TrackedState.WILL_TRACK,this.targetConnection=null},Blockly.utils.object.inherits(Blockly.RenderedConnection,Blockly.Connection),Blockly.RenderedConnection.TrackedState={WILL_TRACK:-1,UNTRACKED:0,TRACKED:1},Blockly.RenderedConnection.prototype.dispose=function(){Blockly.RenderedConnection.superClass_.dispose.call(this),this.trackedState_==Blockly.RenderedConnection.TrackedState.TRACKED&&this.db_.removeConnection(this,this.y)},Blockly.RenderedConnection.prototype.getSourceBlock=function(){return Blockly.RenderedConnection.superClass_.getSourceBlock.call(this)},Blockly.RenderedConnection.prototype.targetBlock=function(){return Blockly.RenderedConnection.superClass_.targetBlock.call(this)},Blockly.RenderedConnection.prototype.distanceFrom=function(a){var b=this.x-a.x;return a=this.y-a.y,Math.sqrt(b*b+a*a)},Blockly.RenderedConnection.prototype.bumpAwayFrom=function(a){if(!this.sourceBlock_.workspace.isDragging()){var b=this.sourceBlock_.getRootBlock();if(!b.isInFlyout){var c=!1;if(!b.isMovable()){if(!(b=a.getSourceBlock().getRootBlock()).isMovable())return;a=this,c=!0}var d=Blockly.selected==b;d||b.addSelect();var e=a.x+Blockly.SNAP_RADIUS+Math.floor(Math.random()*Blockly.BUMP_RANDOMNESS)-this.x,f=a.y+Blockly.SNAP_RADIUS+Math.floor(Math.random()*Blockly.BUMP_RANDOMNESS)-this.y;c&&(f=-f),b.RTL&&(e=a.x-Blockly.SNAP_RADIUS-Math.floor(Math.random()*Blockly.BUMP_RANDOMNESS)-this.x),b.moveBy(e,f),d||b.removeSelect()}}},Blockly.RenderedConnection.prototype.moveTo=function(a,b){this.trackedState_==Blockly.RenderedConnection.TrackedState.WILL_TRACK?(this.db_.addConnection(this,b),this.trackedState_=Blockly.RenderedConnection.TrackedState.TRACKED):this.trackedState_==Blockly.RenderedConnection.TrackedState.TRACKED&&(this.db_.removeConnection(this,this.y),this.db_.addConnection(this,b)),this.x=a,this.y=b},Blockly.RenderedConnection.prototype.moveBy=function(a,b){this.moveTo(this.x+a,this.y+b)},Blockly.RenderedConnection.prototype.moveToOffset=function(a){this.moveTo(a.x+this.offsetInBlock_.x,a.y+this.offsetInBlock_.y)},Blockly.RenderedConnection.prototype.setOffsetInBlock=function(a,b){this.offsetInBlock_.x=a,this.offsetInBlock_.y=b},Blockly.RenderedConnection.prototype.getOffsetInBlock=function(){return this.offsetInBlock_},Blockly.RenderedConnection.prototype.tighten=function(){var a=this.targetConnection.x-this.x,b=this.targetConnection.y-this.y;if(0!=a||0!=b){var c=this.targetBlock(),d=c.getSvgRoot();if(!d)throw Error("block is not rendered.");d=Blockly.utils.getRelativeXY(d),c.getSvgRoot().setAttribute("transform","translate("+(d.x-a)+","+(d.y-b)+")"),c.moveConnections(-a,-b)}},Blockly.RenderedConnection.prototype.closest=function(a,b){return this.dbOpposite_.searchForClosest(this,a,b)},Blockly.RenderedConnection.prototype.highlight=function(){var b=(a=this.sourceBlock_.workspace.getRenderer().getConstants()).shapeFor(this),b=this.type==Blockly.connectionTypes.INPUT_VALUE||this.type==Blockly.connectionTypes.OUTPUT_VALUE?(a=a.TAB_OFFSET_FROM_TOP,Blockly.utils.svgPaths.moveBy(0,-a)+Blockly.utils.svgPaths.lineOnAxis("v",a)+b.pathDown+Blockly.utils.svgPaths.lineOnAxis("v",a)):(a=a.NOTCH_OFFSET_LEFT-a.CORNER_RADIUS,Blockly.utils.svgPaths.moveBy(-a,0)+Blockly.utils.svgPaths.lineOnAxis("h",a)+b.pathLeft+Blockly.utils.svgPaths.lineOnAxis("h",a)),a=this.sourceBlock_.getRelativeToSurfaceXY();Blockly.Connection.highlightedPath_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.PATH,{class:"blocklyHighlightedConnectionPath",d:b,transform:"translate("+(this.x-a.x)+","+(this.y-a.y)+")"+(this.sourceBlock_.RTL?" scale(-1 1)":"")},this.sourceBlock_.getSvgRoot())},Blockly.RenderedConnection.prototype.unhighlight=function(){Blockly.utils.dom.removeNode(Blockly.Connection.highlightedPath_),delete Blockly.Connection.highlightedPath_},Blockly.RenderedConnection.prototype.setTracking=function(a){a&&this.trackedState_==Blockly.RenderedConnection.TrackedState.TRACKED||!a&&this.trackedState_==Blockly.RenderedConnection.TrackedState.UNTRACKED||this.sourceBlock_.isInFlyout||(a?(this.db_.addConnection(this,this.y),this.trackedState_=Blockly.RenderedConnection.TrackedState.TRACKED):(this.trackedState_==Blockly.RenderedConnection.TrackedState.TRACKED&&this.db_.removeConnection(this,this.y),this.trackedState_=Blockly.RenderedConnection.TrackedState.UNTRACKED))},Blockly.RenderedConnection.prototype.stopTrackingAll=function(){if(this.setTracking(!1),this.targetConnection)for(var a=this.targetBlock().getDescendants(!1),b=0;bb)&&Blockly.RenderedConnection.superClass_.isConnectionAllowed.call(this,a)},Blockly.RenderedConnection.prototype.onFailedConnect=function(a){this.bumpAwayFrom(a)},Blockly.RenderedConnection.prototype.disconnectInternal_=function(a,b){Blockly.RenderedConnection.superClass_.disconnectInternal_.call(this,a,b),a.rendered&&a.render(),b.rendered&&(b.updateDisabled(),b.render(),b.getSvgRoot().style.display="block")},Blockly.RenderedConnection.prototype.respawnShadow_=function(){Blockly.RenderedConnection.superClass_.respawnShadow_.call(this);var a=this.targetBlock();a&&(a.initSvg(),a.render(!1),(a=this.getSourceBlock()).rendered&&a.render())},Blockly.RenderedConnection.prototype.neighbours=function(a){return this.dbOpposite_.getNeighbours(this,a)},Blockly.RenderedConnection.prototype.connect_=function(a){Blockly.RenderedConnection.superClass_.connect_.call(this,a);var b=this.getSourceBlock();a=a.getSourceBlock();var c=b.rendered,d=a.rendered;c&&b.updateDisabled(),d&&a.updateDisabled(),c&&d&&(this.type==Blockly.connectionTypes.NEXT_STATEMENT||this.type==Blockly.connectionTypes.PREVIOUS_STATEMENT?a:b).render(),(b=b.getInputWithBlock(a))&&(b=b.isVisible(),a.getSvgRoot().style.display=b?"block":"none")},Blockly.RenderedConnection.prototype.onCheckChanged_=function(){!this.isConnected()||this.targetConnection&&this.getConnectionChecker().canConnect(this,this.targetConnection,!1)||((this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug(),this.sourceBlock_.bumpNeighbours())},Blockly.Marker=function(){this.drawer_=this.curNode_=this.colour=null,this.type="marker"},Blockly.Marker.prototype.setDrawer=function(a){this.drawer_=a},Blockly.Marker.prototype.getDrawer=function(){return this.drawer_},Blockly.Marker.prototype.getCurNode=function(){return this.curNode_},Blockly.Marker.prototype.setCurNode=function(a){var b=this.curNode_;this.curNode_=a,this.drawer_&&this.drawer_.draw(b,this.curNode_)},Blockly.Marker.prototype.draw=function(){this.drawer_&&this.drawer_.draw(this.curNode_,this.curNode_)},Blockly.Marker.prototype.hide=function(){this.drawer_&&this.drawer_.hide()},Blockly.Marker.prototype.dispose=function(){this.getDrawer()&&this.getDrawer().dispose()},Blockly.Cursor=function(){Blockly.Cursor.superClass_.constructor.call(this),this.type="cursor"},Blockly.utils.object.inherits(Blockly.Cursor,Blockly.Marker),Blockly.Cursor.prototype.next=function(){var a=this.getCurNode();if(!a)return null;for(a=a.next();a&&a.next()&&(a.getType()==Blockly.ASTNode.types.NEXT||a.getType()==Blockly.ASTNode.types.BLOCK);)a=a.next();return a&&this.setCurNode(a),a},Blockly.Cursor.prototype.in=function(){var a=this.getCurNode();return a?((a=(a=a.getType()==Blockly.ASTNode.types.PREVIOUS||a.getType()==Blockly.ASTNode.types.OUTPUT?a.next():a).in())&&this.setCurNode(a),a):null},Blockly.Cursor.prototype.prev=function(){var a=this.getCurNode();if(!a)return null;for(a=a.prev();a&&a.prev()&&(a.getType()==Blockly.ASTNode.types.NEXT||a.getType()==Blockly.ASTNode.types.BLOCK);)a=a.prev();return a&&this.setCurNode(a),a},Blockly.Cursor.prototype.out=function(){var a=this.getCurNode();return a?((a=(a=a.out())&&a.getType()==Blockly.ASTNode.types.BLOCK?a.prev()||a:a)&&this.setCurNode(a),a):null},Blockly.registry.register(Blockly.registry.Type.CURSOR,Blockly.registry.DEFAULT,Blockly.Cursor),Blockly.BasicCursor=function(){Blockly.BasicCursor.superClass_.constructor.call(this)},Blockly.utils.object.inherits(Blockly.BasicCursor,Blockly.Cursor),Blockly.BasicCursor.registrationName="basicCursor",Blockly.BasicCursor.prototype.next=function(){var a=this.getCurNode();return a?((a=this.getNextNode_(a,this.validNode_))&&this.setCurNode(a),a):null},Blockly.BasicCursor.prototype.in=function(){return this.next()},Blockly.BasicCursor.prototype.prev=function(){var a=this.getCurNode();return a?((a=this.getPreviousNode_(a,this.validNode_))&&this.setCurNode(a),a):null},Blockly.BasicCursor.prototype.out=function(){return this.prev()},Blockly.BasicCursor.prototype.getNextNode_=function(a,b){if(!a)return null;var c=a.in()||a.next();return b(c)?c:c?this.getNextNode_(c,b):b(a=this.findSiblingOrParent_(a.out()))?a:a?this.getNextNode_(a,b):null},Blockly.BasicCursor.prototype.getPreviousNode_=function(a,b){if(!a)return null;var c=a.prev();return b(c=c?this.getRightMostChild_(c):a.out())?c:c?this.getPreviousNode_(c,b):null},Blockly.BasicCursor.prototype.validNode_=function(a){var b=!1;return b=(a=a&&a.getType())==Blockly.ASTNode.types.OUTPUT||a==Blockly.ASTNode.types.INPUT||a==Blockly.ASTNode.types.FIELD||a==Blockly.ASTNode.types.NEXT||a==Blockly.ASTNode.types.PREVIOUS||a==Blockly.ASTNode.types.WORKSPACE?!0:b},Blockly.BasicCursor.prototype.findSiblingOrParent_=function(a){if(!a)return null;var b=a.next();return b||this.findSiblingOrParent_(a.out())},Blockly.BasicCursor.prototype.getRightMostChild_=function(a){if(!a.in())return a;for(a=a.in();a.next();)a=a.next();return this.getRightMostChild_(a)},Blockly.registry.register(Blockly.registry.Type.CURSOR,Blockly.BasicCursor.registrationName,Blockly.BasicCursor),Blockly.TabNavigateCursor=function(){Blockly.TabNavigateCursor.superClass_.constructor.call(this)},Blockly.utils.object.inherits(Blockly.TabNavigateCursor,Blockly.BasicCursor),Blockly.TabNavigateCursor.prototype.validNode_=function(a){var b=!1,c=a&&a.getType();return a&&(a=a.getLocation(),c==Blockly.ASTNode.types.FIELD&&a&&a.isTabNavigable()&&a.isClickable()&&(b=!0)),b},Blockly.BlockSvg=function(a,b,c){this.svgGroup_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.G,{},null),this.svgGroup_.translate_="",this.style=a.getRenderer().getConstants().getBlockStyle(null),this.pathObject=a.getRenderer().makePathObject(this.svgGroup_,this.style),this.renderIsInProgress_=this.rendered=!1,this.workspace=a,this.previousConnection=this.nextConnection=this.outputConnection=null,this.useDragSurface_=Blockly.utils.is3dSupported()&&!!a.getBlockDragSurface();var d=this.pathObject.svgPath;d.tooltip=this,Blockly.Tooltip.bindMouseEvents(d),Blockly.BlockSvg.superClass_.constructor.call(this,a,b,c),this.svgGroup_.dataset?this.svgGroup_.dataset.id=this.id:Blockly.utils.userAgent.IE&&this.svgGroup_.setAttribute("data-id",this.id)},Blockly.utils.object.inherits(Blockly.BlockSvg,Blockly.Block),Blockly.BlockSvg.prototype.height=0,Blockly.BlockSvg.prototype.width=0,Blockly.BlockSvg.prototype.warningTextDb_=null,Blockly.BlockSvg.INLINE=-1,Blockly.BlockSvg.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_",Blockly.BlockSvg.prototype.initSvg=function(){if(!this.workspace.rendered)throw TypeError("Workspace is headless.");for(var b,a=0;b=this.inputList[a];a++)b.init();for(b=this.getIcons(),a=0;a=this.connections_.length)return-1;b=a.y;for(var d=c;0<=d&&this.connections_[d].y==b;){if(this.connections_[d]==a)return d;d--}for(;ca)){b=d;break}c=d}}return b},Blockly.ConnectionDB.prototype.removeConnection=function(a,b){if(-1==(a=this.findIndexOfConnection_(a,b)))throw Error("Unable to find connection in connectionDB.");this.connections_.splice(a,1)},Blockly.ConnectionDB.prototype.getNeighbours=function(a,b){function c(l){var m=e-d[l].x,n=f-d[l].y;return Math.sqrt(m*m+n*n)<=b&&k.push(d[l]),nthis.previousScale_&&(c=0<(c=b-this.previousScale_)?c*Blockly.TouchGesture.ZOOM_IN_MULTIPLIER:c*Blockly.TouchGesture.ZOOM_OUT_MULTIPLIER,d=this.startWorkspace_,e=Blockly.utils.mouseToSvg(a,d.getParentSvg(),d.getInverseScreenCTM()),d.zoom(e.x,e.y,c)),this.previousScale_=b,a.preventDefault()},Blockly.TouchGesture.prototype.handleTouchEnd=function(a){a=Blockly.Touch.getTouchIdentifierFromEvent(a),this.cachedPoints_[a]&&delete this.cachedPoints_[a],Object.keys(this.cachedPoints_).length<2&&(this.cachedPoints_=Object.create(null),this.previousScale_=0)},Blockly.TouchGesture.prototype.getTouchPoint=function(a){return this.startWorkspace_?new Blockly.utils.Coordinate(a.pageX||a.changedTouches[0].pageX,a.pageY||a.changedTouches[0].pageY):null},Blockly.WorkspaceAudio=function(a){this.parentWorkspace_=a,this.SOUNDS_=Object.create(null)},Blockly.WorkspaceAudio.prototype.lastSound_=null,Blockly.WorkspaceAudio.prototype.dispose=function(){this.SOUNDS_=this.parentWorkspace_=null},Blockly.WorkspaceAudio.prototype.load=function(a,b){if(a.length){try{var c=new Blockly.utils.global.Audio}catch(h){return}for(var d,e=0;e=this.remainingCapacity()||(this.currentGesture_&&this.currentGesture_.cancel(),"comment"==a.tagName.toLowerCase()?this.pasteWorkspaceComment_(a):this.pasteBlock_(a))},Blockly.WorkspaceSvg.prototype.pasteBlock_=function(a){Blockly.Events.disable();try{var b=Blockly.Xml.domToBlock(a,this),c=parseInt(a.getAttribute("x"),10),d=parseInt(a.getAttribute("y"),10);if(!isNaN(c)&&!isNaN(d)){this.RTL&&(c=-c);do{a=!1;for(var g,e=this.getAllBlocks(!1),f=0;g=e[f];f++){var h=g.getRelativeToSurfaceXY();if(Math.abs(c-h.x)<=1&&Math.abs(d-h.y)<=1){a=!0;break}}if(!a)for(var l,k=b.getConnections_(!1),f=0;l=k[f];f++)if(l.closest(Blockly.SNAP_RADIUS,new Blockly.utils.Coordinate(c,d)).connection){a=!0;break}}while(a&&(c=this.RTL?c-Blockly.SNAP_RADIUS:c+Blockly.SNAP_RADIUS,d+=2*Blockly.SNAP_RADIUS),a);b.moveBy(c,d)}}finally{Blockly.Events.enable()}Blockly.Events.isEnabled()&&!b.isShadow()&&Blockly.Events.fire(new(Blockly.Events.get(Blockly.Events.BLOCK_CREATE))(b)),b.select()},Blockly.WorkspaceSvg.prototype.pasteWorkspaceComment_=function(a){Blockly.Events.disable();try{var b=Blockly.WorkspaceCommentSvg.fromXml(a,this),c=parseInt(a.getAttribute("x"),10),d=parseInt(a.getAttribute("y"),10);isNaN(c)||isNaN(d)||(this.RTL&&(c=-c),b.moveBy(c+50,d+50))}finally{Blockly.Events.enable()}Blockly.Events.isEnabled()&&Blockly.WorkspaceComment.fireCreateEvent(b),b.select()},Blockly.WorkspaceSvg.prototype.refreshToolboxSelection=function(){var a=this.isFlyout?this.targetWorkspace:this;a&&!a.currentGesture_&&a.toolbox_&&a.toolbox_.getFlyout()&&a.toolbox_.refreshSelection()},Blockly.WorkspaceSvg.prototype.renameVariableById=function(a,b){Blockly.WorkspaceSvg.superClass_.renameVariableById.call(this,a,b),this.refreshToolboxSelection()},Blockly.WorkspaceSvg.prototype.deleteVariableById=function(a){Blockly.WorkspaceSvg.superClass_.deleteVariableById.call(this,a),this.refreshToolboxSelection()},Blockly.WorkspaceSvg.prototype.createVariable=function(a,b,c){return a=Blockly.WorkspaceSvg.superClass_.createVariable.call(this,a,b,c),this.refreshToolboxSelection(),a},Blockly.WorkspaceSvg.prototype.recordDeleteAreas=function(){this.deleteAreaTrash_=this.trashcan&&this.svgGroup_.parentNode?this.trashcan.getClientRect():null,this.deleteAreaToolbox_=this.flyout_?this.flyout_.getClientRect():this.toolbox_&&"function"==typeof this.toolbox_.getClientRect?this.toolbox_.getClientRect():null},Blockly.WorkspaceSvg.prototype.isDeleteArea=function(a){return this.deleteAreaTrash_&&this.deleteAreaTrash_.contains(a.clientX,a.clientY)?Blockly.DELETE_AREA_TRASH:this.deleteAreaToolbox_&&this.deleteAreaToolbox_.contains(a.clientX,a.clientY)?Blockly.DELETE_AREA_TOOLBOX:Blockly.DELETE_AREA_NONE},Blockly.WorkspaceSvg.prototype.onMouseDown_=function(a){var b=this.getGesture(a);b&&b.handleWsStart(a,this)},Blockly.WorkspaceSvg.prototype.startDrag=function(a,b){(a=Blockly.utils.mouseToSvg(a,this.getParentSvg(),this.getInverseScreenCTM())).x/=this.scale,a.y/=this.scale,this.dragDeltaXY_=Blockly.utils.Coordinate.difference(b,a)},Blockly.WorkspaceSvg.prototype.moveDrag=function(a){return(a=Blockly.utils.mouseToSvg(a,this.getParentSvg(),this.getInverseScreenCTM())).x/=this.scale,a.y/=this.scale,Blockly.utils.Coordinate.sum(this.dragDeltaXY_,a)},Blockly.WorkspaceSvg.prototype.isDragging=function(){return null!=this.currentGesture_&&this.currentGesture_.isDragging()},Blockly.WorkspaceSvg.prototype.isDraggable=function(){return this.options.moveOptions&&this.options.moveOptions.drag},Blockly.WorkspaceSvg.prototype.isMovable=function(){return this.options.moveOptions&&!!this.options.moveOptions.scrollbars||this.options.moveOptions&&this.options.moveOptions.wheel||this.options.moveOptions&&this.options.moveOptions.drag||this.options.zoomOptions&&this.options.zoomOptions.wheel||this.options.zoomOptions&&this.options.zoomOptions.pinch},Blockly.WorkspaceSvg.prototype.isMovableHorizontally=function(){var a=!!this.scrollbar;return this.isMovable()&&(!a||a&&this.scrollbar.canScrollHorizontally())},Blockly.WorkspaceSvg.prototype.isMovableVertically=function(){var a=!!this.scrollbar;return this.isMovable()&&(!a||a&&this.scrollbar.canScrollVertically())},Blockly.WorkspaceSvg.prototype.onMouseWheel_=function(a){var b,c,d;Blockly.Gesture.inProgress()?(a.preventDefault(),a.stopPropagation()):(b=this.options.zoomOptions&&this.options.zoomOptions.wheel,c=this.options.moveOptions&&this.options.moveOptions.wheel,(b||c)&&(d=Blockly.utils.getScrollDeltaPixels(a),!b||!a.ctrlKey&&c?(b=this.scrollX-d.x,c=this.scrollY-d.y,a.shiftKey&&!d.x&&(b=this.scrollX-d.y,c=this.scrollY),this.scroll(b,c)):(d=-d.y/50,b=Blockly.utils.mouseToSvg(a,this.getParentSvg(),this.getInverseScreenCTM()),this.zoom(b.x,b.y,d)),a.preventDefault()))},Blockly.WorkspaceSvg.prototype.getBlocksBoundingBox=function(){var a=this.getTopBoundedElements();if(!a.length)return new Blockly.utils.Rect(0,0,0,0);for(var b=a[0].getBoundingRectangle(),c=1;cb.bottom&&(b.bottom=d.bottom),d.leftb.right&&(b.right=d.right))}return b},Blockly.WorkspaceSvg.prototype.cleanUp=function(){this.setResizesEnabled(!1),Blockly.Events.setGroup(!0);for(var d,e,a=this.getTopBlocks(!0),b=0,c=0;d=a[c];c++)d.isMovable()&&(e=d.getRelativeToSurfaceXY(),d.moveBy(-e.x,b-e.y),d.snapToGrid(),b=d.getRelativeToSurfaceXY().y+d.getHeightWidth().height+this.renderer_.getConstants().MIN_BLOCK_HEIGHT);Blockly.Events.setGroup(!1),this.setResizesEnabled(!0)},Blockly.WorkspaceSvg.prototype.showContextMenu=function(a){var b;this.options.readOnly||this.isFlyout||(b=Blockly.ContextMenuRegistry.registry.getContextMenuOptions(Blockly.ContextMenuRegistry.ScopeType.WORKSPACE,{workspace:this}),this.configureContextMenu&&this.configureContextMenu(b,a),Blockly.ContextMenu.show(a,b,this.RTL))},Blockly.WorkspaceSvg.prototype.updateToolbox=function(a){if(a=Blockly.utils.toolbox.convertToolboxDefToJson(a)){if(!this.options.languageTree)throw Error("Existing toolbox is null. Can't create new toolbox.");if(Blockly.utils.toolbox.hasCategories(a)){if(!this.toolbox_)throw Error("Existing toolbox has no categories. Can't change mode.");this.options.languageTree=a,this.toolbox_.render(a)}else{if(!this.flyout_)throw Error("Existing toolbox has categories. Can't change mode.");this.options.languageTree=a,this.flyout_.show(a)}}else if(this.options.languageTree)throw Error("Can't nullify an existing toolbox.")},Blockly.WorkspaceSvg.prototype.markFocused=function(){this.options.parentWorkspace?this.options.parentWorkspace.markFocused():(Blockly.mainWorkspace=this).setBrowserFocus()},Blockly.WorkspaceSvg.prototype.setBrowserFocus=function(){document.activeElement&&document.activeElement.blur&&document.activeElement.blur();try{this.getParentSvg().focus({preventScroll:!0})}catch(a){try{this.getParentSvg().parentNode.setActive()}catch(b){this.getParentSvg().parentNode.focus({preventScroll:!0})}}},Blockly.WorkspaceSvg.prototype.zoom=function(a,b,c){c=Math.pow(this.options.zoomOptions.scaleSpeed,c);var e,f,d=this.scale*c;this.scale!=d&&(d>this.options.zoomOptions.maxScale?c=this.options.zoomOptions.maxScale/this.scale:dthis.options.zoomOptions.maxScale?a=this.options.zoomOptions.maxScale:this.options.zoomOptions.minScale&&ab.oldScale&&Blockly.bumpTopObjectsIntoBounds_(a))}},Blockly.bumpObjectIntoBounds_=function(a,b,c){var d=c.getBoundingRectangle(),e=d.right-d.left,f=Blockly.utils.math.clamp(b.top,d.top,b.top+b.height-(d.bottom-d.top))-d.top,g=b.left;return b=b.left+b.width-e,a.RTL?g=Math.min(b,g):b=Math.max(g,b),!(!(a=Blockly.utils.math.clamp(g,d.left,b)-d.left)&&!f)&&(c.moveBy(a,f),!0)},Blockly.init_=function(a){var d,b=a.options,c=a.getParentSvg();Blockly.browserEvents.conditionalBind(c.parentNode,"contextmenu",null,function(e){Blockly.utils.isTargetInput(e)||e.preventDefault()}),c=Blockly.browserEvents.conditionalBind(window,"resize",null,function(){Blockly.hideChaff(!0),Blockly.svgResize(a),Blockly.bumpTopObjectsIntoBounds_(a)}),a.setResizeHandlerWrapper(c),Blockly.inject.bindDocumentEvents_(),b.languageTree&&(c=a.getToolbox(),d=a.getFlyout(!0),c?c.init():d&&(d.init(a),d.show(b.languageTree),"function"==typeof d.scrollToStart&&d.scrollToStart())),c=Blockly.Scrollbar.scrollbarThickness,b.hasTrashcan&&(c=a.trashcan.init(c)),b.zoomOptions&&b.zoomOptions.controls&&a.zoomControls_.init(c),b.moveOptions&&b.moveOptions.scrollbars?(a.scrollbar=new Blockly.ScrollbarPair(a,!0===b.moveOptions.scrollbars||!!b.moveOptions.scrollbars.horizontal,!0===b.moveOptions.scrollbars||!!b.moveOptions.scrollbars.vertical,"blocklyMainWorkspaceScrollbar"),a.scrollbar.resize()):a.setMetrics({x:.5,y:.5}),b.hasSounds&&Blockly.inject.loadSounds_(b.pathToMedia,a)},Blockly.inject.bindDocumentEvents_=function(){Blockly.documentEventsBound_||(Blockly.browserEvents.conditionalBind(document,"scroll",null,function(){for(var c,a=Blockly.Workspace.getAll(),b=0;c=a[b];b++)c.updateInverseScreenCTM&&c.updateInverseScreenCTM()}),Blockly.browserEvents.conditionalBind(document,"keydown",null,Blockly.onKeyDown),Blockly.browserEvents.bind(document,"touchend",null,Blockly.longStop_),Blockly.browserEvents.bind(document,"touchcancel",null,Blockly.longStop_),Blockly.utils.userAgent.IPAD&&Blockly.browserEvents.conditionalBind(window,"orientationchange",document,function(){Blockly.svgResize(Blockly.getMainWorkspace())})),Blockly.documentEventsBound_=!0},Blockly.inject.loadSounds_=function(a,b){var c=b.getAudioManager();c.load([a+"click.mp3",a+"click.wav",a+"click.ogg"],"click"),c.load([a+"disconnect.wav",a+"disconnect.mp3",a+"disconnect.ogg"],"disconnect"),c.load([a+"delete.mp3",a+"delete.ogg",a+"delete.wav"],"delete");var d=[];a=function(){for(;d.length;)Blockly.browserEvents.unbind(d.pop());c.preload()},d.push(Blockly.browserEvents.conditionalBind(document,"mousemove",null,a,!0)),d.push(Blockly.browserEvents.conditionalBind(document,"touchstart",null,a,!0))},Blockly.Names=function(a,b){if(this.variablePrefix_=b||"",this.reservedDict_=Object.create(null),a)for(a=a.split(","),b=0;b1'),d.appendChild(c),b.push(d)),Blockly.Blocks.variables_get){a.sort(Blockly.VariableModel.compareByName),c=0;for(;e=a[c];c++)(d=Blockly.utils.xml.createElement("block")).setAttribute("type","variables_get"),d.setAttribute("gap",8),d.appendChild(Blockly.Variables.generateVariableFieldDom(e)),b.push(d)}}return b},Blockly.Variables.VAR_LETTER_OPTIONS="ijkmnopqrstuvwxyzabcdefgh",Blockly.Variables.generateUniqueName=function(a){return Blockly.Variables.generateUniqueNameFromOptions(Blockly.Variables.VAR_LETTER_OPTIONS.charAt(0),a.getAllVariableNames())},Blockly.Variables.generateUniqueNameFromOptions=function(a,b){if(!b.length)return a;for(var c=Blockly.Variables.VAR_LETTER_OPTIONS,d="",e=c.indexOf(a);;){for(var f=!1,g=0;g>>/sprites.png);","height: 16px;","vertical-align: middle;","visibility: hidden;","width: 16px;","}",".blocklyTreeIconClosed {","background-position: -32px -1px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeIconClosed {',"background-position: 0 -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosed {","background-position: -32px -17px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeSelected>.blocklyTreeIconClosed {',"background-position: 0 -17px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconOpen {","background-position: -16px -17px;","}",".blocklyTreeLabel {","cursor: default;","font: 16px sans-serif;","padding: 0 3px;","vertical-align: middle;","}",".blocklyToolboxDelete .blocklyTreeLabel {",'cursor: url("<<>>/handdelete.cur"), auto;',"}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}"]),Blockly.registry.register(Blockly.registry.Type.TOOLBOX_ITEM,Blockly.ToolboxCategory.registrationName,Blockly.ToolboxCategory),Blockly.ToolboxSeparator=function(a,b){Blockly.ToolboxSeparator.superClass_.constructor.call(this,a,b),this.cssConfig_={container:"blocklyTreeSeparator"},Blockly.utils.object.mixin(this.cssConfig_,a.cssconfig||a.cssConfig)},Blockly.utils.object.inherits(Blockly.ToolboxSeparator,Blockly.ToolboxItem),Blockly.ToolboxSeparator.registrationName="sep",Blockly.ToolboxSeparator.prototype.init=function(){this.createDom_()},Blockly.ToolboxSeparator.prototype.createDom_=function(){var a=document.createElement("div");return Blockly.utils.dom.addClass(a,this.cssConfig_.container),this.htmlDiv_=a},Blockly.ToolboxSeparator.prototype.getDiv=function(){return this.htmlDiv_},Blockly.ToolboxSeparator.prototype.dispose=function(){Blockly.utils.dom.removeNode(this.htmlDiv_)},Blockly.Css.register('.blocklyTreeSeparator {,border-bottom: solid #e5e5e5 1px;,height: 0;,margin: 5px 0;,},.blocklyToolboxDiv[layout="h"] .blocklyTreeSeparator {,border-right: solid #e5e5e5 1px;,border-bottom: none;,height: auto;,margin: 0 5px 0 5px;,padding: 5px 0;,width: 0;,}'.split(",")),Blockly.registry.register(Blockly.registry.Type.TOOLBOX_ITEM,Blockly.ToolboxSeparator.registrationName,Blockly.ToolboxSeparator),Blockly.CollapsibleToolboxCategory=function(a,b,c){this.subcategoriesDiv_=null,this.expanded_=!1,this.toolboxItems_=[],Blockly.CollapsibleToolboxCategory.superClass_.constructor.call(this,a,b,c)},Blockly.utils.object.inherits(Blockly.CollapsibleToolboxCategory,Blockly.ToolboxCategory),Blockly.CollapsibleToolboxCategory.registrationName="collapsibleCategory",Blockly.CollapsibleToolboxCategory.prototype.makeDefaultCssConfig_=function(){var a=Blockly.CollapsibleToolboxCategory.superClass_.makeDefaultCssConfig_.call(this);return a.contents="blocklyToolboxContents",a},Blockly.CollapsibleToolboxCategory.prototype.parseContents_=function(a){var d,b=a.contents,c=!0;if(a.custom)this.flyoutItems_=a.custom;else if(b){a=0;for(;d=b[a];a++)c=!Blockly.registry.hasItem(Blockly.registry.Type.TOOLBOX_ITEM,d.kind)||d.kind.toLowerCase()==Blockly.ToolboxSeparator.registrationName&&c?(this.flyoutItems_.push(d),!0):(this.createToolboxItem_(d),!1)}},Blockly.CollapsibleToolboxCategory.prototype.createToolboxItem_=function(a){var b=a.kind;"CATEGORY"==b.toUpperCase()&&Blockly.utils.toolbox.isCategoryCollapsible(a)&&(b=Blockly.CollapsibleToolboxCategory.registrationName),a=new(Blockly.registry.getClass(Blockly.registry.Type.TOOLBOX_ITEM,b))(a,this.parentToolbox_,this),this.toolboxItems_.push(a)},Blockly.CollapsibleToolboxCategory.prototype.init=function(){Blockly.CollapsibleToolboxCategory.superClass_.init.call(this),this.setExpanded("true"==this.toolboxItemDef_.expanded||this.toolboxItemDef_.expanded)},Blockly.CollapsibleToolboxCategory.prototype.createDom_=function(){Blockly.CollapsibleToolboxCategory.superClass_.createDom_.call(this);var a=this.getChildToolboxItems();return this.subcategoriesDiv_=this.createSubCategoriesDom_(a),Blockly.utils.aria.setRole(this.subcategoriesDiv_,Blockly.utils.aria.Role.GROUP),this.htmlDiv_.appendChild(this.subcategoriesDiv_),this.htmlDiv_},Blockly.CollapsibleToolboxCategory.prototype.createIconDom_=function(){var a=document.createElement("span");return this.parentToolbox_.isHorizontal()||(Blockly.utils.dom.addClass(a,this.cssConfig_.icon),a.style.visibility="visible"),a.style.display="inline-block",a},Blockly.CollapsibleToolboxCategory.prototype.createSubCategoriesDom_=function(a){var b=document.createElement("div");Blockly.utils.dom.addClass(b,this.cssConfig_.contents);for(var c=0;c>>/handdelete.cur"), auto;',"}",".blocklyToolboxGrab {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyToolboxDiv {","background-color: #ddd;","overflow-x: visible;","overflow-y: auto;","padding: 4px 0 4px 0;","position: absolute;","z-index: 70;","-webkit-tap-highlight-color: transparent;","}",".blocklyToolboxContents {","display: flex;","flex-wrap: wrap;","flex-direction: column;","}",".blocklyToolboxContents:focus {","outline: none;","}"]),Blockly.registry.register(Blockly.registry.Type.TOOLBOX,Blockly.registry.DEFAULT,Blockly.Toolbox),Blockly.Events.TrashcanOpen=function(a,b){Blockly.Events.TrashcanOpen.superClass_.constructor.call(this,b),this.isOpen=a},Blockly.utils.object.inherits(Blockly.Events.TrashcanOpen,Blockly.Events.UiBase),Blockly.Events.TrashcanOpen.prototype.type=Blockly.Events.TRASHCAN_OPEN,Blockly.Events.TrashcanOpen.prototype.toJson=function(){var a=Blockly.Events.TrashcanOpen.superClass_.toJson.call(this);return a.isOpen=this.isOpen,a},Blockly.Events.TrashcanOpen.prototype.fromJson=function(a){Blockly.Events.TrashcanOpen.superClass_.fromJson.call(this,a),this.isOpen=a.isOpen},Blockly.registry.register(Blockly.registry.Type.EVENT,Blockly.Events.TRASHCAN_OPEN,Blockly.Events.TrashcanOpen),Blockly.IPlugin=function(){},Blockly.IPositionable=function(){},Blockly.Trashcan=function(a){this.workspace_=a,this.contents_=[],this.flyout=null,this.workspace_.options.maxTrashcanContents<=0||(a=new Blockly.Options({scrollbars:!0,parentWorkspace:this.workspace_,rtl:this.workspace_.RTL,oneBasedIndex:this.workspace_.options.oneBasedIndex,renderer:this.workspace_.options.renderer,rendererOverrides:this.workspace_.options.rendererOverrides,move:{scrollbars:!0}}),this.workspace_.horizontalLayout?(a.toolboxPosition=this.workspace_.toolboxPosition==Blockly.utils.toolbox.Position.TOP?Blockly.utils.toolbox.Position.BOTTOM:Blockly.utils.toolbox.Position.TOP,this.flyout=new(Blockly.registry.getClassFromOptions(Blockly.registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,this.workspace_.options,!0))(a)):(a.toolboxPosition=this.workspace_.toolboxPosition==Blockly.utils.toolbox.Position.RIGHT?Blockly.utils.toolbox.Position.LEFT:Blockly.utils.toolbox.Position.RIGHT,this.flyout=new(Blockly.registry.getClassFromOptions(Blockly.registry.Type.FLYOUTS_VERTICAL_TOOLBOX,this.workspace_.options,!0))(a)),this.workspace_.addChangeListener(this.onDelete_.bind(this)))},Blockly.Trashcan.prototype.WIDTH_=47,Blockly.Trashcan.prototype.BODY_HEIGHT_=44,Blockly.Trashcan.prototype.LID_HEIGHT_=16,Blockly.Trashcan.prototype.MARGIN_BOTTOM_=20,Blockly.Trashcan.prototype.MARGIN_SIDE_=20,Blockly.Trashcan.prototype.MARGIN_HOTSPOT_=10,Blockly.Trashcan.prototype.SPRITE_LEFT_=0,Blockly.Trashcan.prototype.SPRITE_TOP_=32,Blockly.Trashcan.prototype.HAS_BLOCKS_LID_ANGLE_=.1,Blockly.Trashcan.ANIMATION_LENGTH_=80,Blockly.Trashcan.ANIMATION_FRAMES_=4,Blockly.Trashcan.OPACITY_MIN_=.4,Blockly.Trashcan.OPACITY_MAX_=.8,Blockly.Trashcan.MAX_LID_ANGLE_=45,Blockly.Trashcan.prototype.isLidOpen=!1,Blockly.Trashcan.prototype.minOpenness_=0,Blockly.Trashcan.prototype.svgGroup_=null,Blockly.Trashcan.prototype.svgLid_=null,Blockly.Trashcan.prototype.lidTask_=0,Blockly.Trashcan.prototype.lidOpen_=0,Blockly.Trashcan.prototype.left_=0,Blockly.Trashcan.prototype.top_=0,Blockly.Trashcan.prototype.createDom=function(){this.svgGroup_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.G,{class:"blocklyTrash"},null);var a=String(Math.random()).substring(2),b=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.CLIPPATH,{id:"blocklyTrashBodyClipPath"+a},this.svgGroup_);Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.RECT,{width:this.WIDTH_,height:this.BODY_HEIGHT_,y:this.LID_HEIGHT_},b);var c=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.IMAGE,{width:Blockly.SPRITE.width,x:-this.SPRITE_LEFT_,height:Blockly.SPRITE.height,y:-this.SPRITE_TOP_,"clip-path":"url(#blocklyTrashBodyClipPath"+a+")"},this.svgGroup_);return c.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+Blockly.SPRITE.url),b=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.CLIPPATH,{id:"blocklyTrashLidClipPath"+a},this.svgGroup_),Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.RECT,{width:this.WIDTH_,height:this.LID_HEIGHT_},b),this.svgLid_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.IMAGE,{width:Blockly.SPRITE.width,x:-this.SPRITE_LEFT_,height:Blockly.SPRITE.height,y:-this.SPRITE_TOP_,"clip-path":"url(#blocklyTrashLidClipPath"+a+")"},this.svgGroup_),this.svgLid_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+Blockly.SPRITE.url),Blockly.browserEvents.bind(this.svgGroup_,"mousedown",this,this.blockMouseDownWhenOpenable_),Blockly.browserEvents.bind(this.svgGroup_,"mouseup",this,this.click),Blockly.browserEvents.bind(c,"mouseover",this,this.mouseOver_),Blockly.browserEvents.bind(c,"mouseout",this,this.mouseOut_),this.animateLid_(),this.svgGroup_},Blockly.Trashcan.prototype.init=function(a){return 0this.minOpenness_&&this.lidOpen_<1&&(this.lidTask_=setTimeout(this.animateLid_.bind(this),Blockly.Trashcan.ANIMATION_LENGTH_/a))},Blockly.Trashcan.prototype.setLidAngle_=function(a){var b=this.workspace_.toolboxPosition==Blockly.utils.toolbox.Position.RIGHT||this.workspace_.horizontalLayout&&this.workspace_.RTL;this.svgLid_.setAttribute("transform","rotate("+(b?-a:a)+","+(b?4:this.WIDTH_-4)+","+(this.LID_HEIGHT_-2)+")")},Blockly.Trashcan.prototype.setMinOpenness_=function(a){this.minOpenness_=a,this.isLidOpen||this.setLidAngle_(a*Blockly.Trashcan.MAX_LID_ANGLE_)},Blockly.Trashcan.prototype.closeLid=function(){this.setLidOpen(!1)},Blockly.Trashcan.prototype.click=function(){this.hasContents_()&&this.openFlyout()},Blockly.Trashcan.prototype.fireUiEvent_=function(a){a=new(Blockly.Events.get(Blockly.Events.TRASHCAN_OPEN))(a,this.workspace_.id),Blockly.Events.fire(a)},Blockly.Trashcan.prototype.blockMouseDownWhenOpenable_=function(a){!this.contentsIsOpen()&&this.hasContents_()&&a.stopPropagation()},Blockly.Trashcan.prototype.mouseOver_=function(){this.hasContents_()&&this.setLidOpen(!0)},Blockly.Trashcan.prototype.mouseOut_=function(){this.setLidOpen(!1)},Blockly.Trashcan.prototype.onDelete_=function(a){if(!(this.workspace_.options.maxTrashcanContents<=0)&&a.type==Blockly.Events.BLOCK_DELETE&&a.oldXml.tagName&&"shadow"!=a.oldXml.tagName.toLowerCase()&&(a=this.cleanBlockXML_(a.oldXml),-1==this.contents_.indexOf(a))){for(this.contents_.unshift(a);this.contents_.length>this.workspace_.options.maxTrashcanContents;)this.contents_.pop();this.setMinOpenness_(this.HAS_BLOCKS_LID_ANGLE_)}},Blockly.Trashcan.prototype.cleanBlockXML_=function(a){for(var b=a=a.cloneNode(!0);b;){b.removeAttribute&&(b.removeAttribute("x"),b.removeAttribute("y"),b.removeAttribute("id"),b.removeAttribute("disabled"),"comment"==b.nodeName&&(b.removeAttribute("h"),b.removeAttribute("w"),b.removeAttribute("pinned")));var c=b.firstChild||b.nextSibling;if(!c)for(c=b.parentNode;c;){if(c.nextSibling){c=c.nextSibling;break}c=c.parentNode}b=c}return Blockly.Xml.domToText(a)},Blockly.VariablesDynamic={},Blockly.VariablesDynamic.onCreateVariableButtonClick_String=function(a){Blockly.Variables.createVariableButtonHandler(a.getTargetWorkspace(),void 0,"String")},Blockly.VariablesDynamic.onCreateVariableButtonClick_Number=function(a){Blockly.Variables.createVariableButtonHandler(a.getTargetWorkspace(),void 0,"Number")},Blockly.VariablesDynamic.onCreateVariableButtonClick_Colour=function(a){Blockly.Variables.createVariableButtonHandler(a.getTargetWorkspace(),void 0,"Colour")},Blockly.VariablesDynamic.flyoutCategory=function(a){var b=[],c=document.createElement("button");return c.setAttribute("text",Blockly.Msg.NEW_STRING_VARIABLE),c.setAttribute("callbackKey","CREATE_VARIABLE_STRING"),b.push(c),(c=document.createElement("button")).setAttribute("text",Blockly.Msg.NEW_NUMBER_VARIABLE),c.setAttribute("callbackKey","CREATE_VARIABLE_NUMBER"),b.push(c),(c=document.createElement("button")).setAttribute("text",Blockly.Msg.NEW_COLOUR_VARIABLE),c.setAttribute("callbackKey","CREATE_VARIABLE_COLOUR"),b.push(c),a.registerButtonCallback("CREATE_VARIABLE_STRING",Blockly.VariablesDynamic.onCreateVariableButtonClick_String),a.registerButtonCallback("CREATE_VARIABLE_NUMBER",Blockly.VariablesDynamic.onCreateVariableButtonClick_Number),a.registerButtonCallback("CREATE_VARIABLE_COLOUR",Blockly.VariablesDynamic.onCreateVariableButtonClick_Colour),a=Blockly.VariablesDynamic.flyoutCategoryBlocks(a),b.concat(a)},Blockly.VariablesDynamic.flyoutCategoryBlocks=function(a){a=a.getAllVariables();var c,d,e,b=[];if(0image, .blocklyZoom>svg>image {","opacity: .4;","}",".blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {","opacity: .6;","}",".blocklyZoom>image:active, .blocklyZoom>svg>image:active {","opacity: .8;","}"]),Blockly.ShortcutItems={},Blockly.ShortcutItems.names={ESCAPE:"escape",DELETE:"delete",COPY:"copy",CUT:"cut",PASTE:"paste",UNDO:"undo",REDO:"redo"},Blockly.ShortcutItems.registerEscape=function(){var a={name:Blockly.ShortcutItems.names.ESCAPE,preconditionFn:function(b){return!b.options.readOnly},callback:function(){return Blockly.hideChaff(),!0}};Blockly.ShortcutRegistry.registry.register(a),Blockly.ShortcutRegistry.registry.addKeyMapping(Blockly.utils.KeyCodes.ESC,a.name)},Blockly.ShortcutItems.registerDelete=function(){var a={name:Blockly.ShortcutItems.names.DELETE,preconditionFn:function(b){return!b.options.readOnly&&Blockly.selected&&Blockly.selected.isDeletable()},callback:function(b,c){return c.preventDefault(),!Blockly.Gesture.inProgress()&&(Blockly.deleteBlock(Blockly.selected),!0)}};Blockly.ShortcutRegistry.registry.register(a),Blockly.ShortcutRegistry.registry.addKeyMapping(Blockly.utils.KeyCodes.DELETE,a.name),Blockly.ShortcutRegistry.registry.addKeyMapping(Blockly.utils.KeyCodes.BACKSPACE,a.name)},Blockly.ShortcutItems.registerCopy=function(){var a={name:Blockly.ShortcutItems.names.COPY,preconditionFn:function(c){return!c.options.readOnly&&!Blockly.Gesture.inProgress()&&Blockly.selected&&Blockly.selected.isDeletable()&&Blockly.selected.isMovable()},callback:function(){return Blockly.hideChaff(),Blockly.copy(Blockly.selected),!0}};Blockly.ShortcutRegistry.registry.register(a);var b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.C,[Blockly.utils.KeyCodes.CTRL]);Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.C,[Blockly.utils.KeyCodes.ALT]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.C,[Blockly.utils.KeyCodes.META]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name)},Blockly.ShortcutItems.registerCut=function(){var a={name:Blockly.ShortcutItems.names.CUT,preconditionFn:function(c){return!c.options.readOnly&&!Blockly.Gesture.inProgress()&&Blockly.selected&&Blockly.selected.isDeletable()&&Blockly.selected.isMovable()&&!Blockly.selected.workspace.isFlyout},callback:function(){return Blockly.copy(Blockly.selected),Blockly.deleteBlock(Blockly.selected),!0}};Blockly.ShortcutRegistry.registry.register(a);var b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.X,[Blockly.utils.KeyCodes.CTRL]);Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.X,[Blockly.utils.KeyCodes.ALT]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.X,[Blockly.utils.KeyCodes.META]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name)},Blockly.ShortcutItems.registerPaste=function(){var a={name:Blockly.ShortcutItems.names.PASTE,preconditionFn:function(c){return!c.options.readOnly&&!Blockly.Gesture.inProgress()},callback:function(){return Blockly.paste()}};Blockly.ShortcutRegistry.registry.register(a);var b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.V,[Blockly.utils.KeyCodes.CTRL]);Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.V,[Blockly.utils.KeyCodes.ALT]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.V,[Blockly.utils.KeyCodes.META]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name)},Blockly.ShortcutItems.registerUndo=function(){var a={name:Blockly.ShortcutItems.names.UNDO,preconditionFn:function(c){return!c.options.readOnly&&!Blockly.Gesture.inProgress()},callback:function(c){return Blockly.hideChaff(),c.undo(!1),!0}};Blockly.ShortcutRegistry.registry.register(a);var b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.Z,[Blockly.utils.KeyCodes.CTRL]);Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.Z,[Blockly.utils.KeyCodes.ALT]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.Z,[Blockly.utils.KeyCodes.META]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name)},Blockly.ShortcutItems.registerRedo=function(){var a={name:Blockly.ShortcutItems.names.REDO,preconditionFn:function(c){return!Blockly.Gesture.inProgress()&&!c.options.readOnly},callback:function(c){return Blockly.hideChaff(),c.undo(!0),!0}};Blockly.ShortcutRegistry.registry.register(a);var b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.Z,[Blockly.utils.KeyCodes.SHIFT,Blockly.utils.KeyCodes.CTRL]);Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.Z,[Blockly.utils.KeyCodes.SHIFT,Blockly.utils.KeyCodes.ALT]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.Z,[Blockly.utils.KeyCodes.SHIFT,Blockly.utils.KeyCodes.META]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name),b=Blockly.ShortcutRegistry.registry.createSerializedKey(Blockly.utils.KeyCodes.Y,[Blockly.utils.KeyCodes.CTRL]),Blockly.ShortcutRegistry.registry.addKeyMapping(b,a.name)},Blockly.ShortcutItems.registerDefaultShortcuts=function(){Blockly.ShortcutItems.registerEscape(),Blockly.ShortcutItems.registerDelete(),Blockly.ShortcutItems.registerCopy(),Blockly.ShortcutItems.registerCut(),Blockly.ShortcutItems.registerPaste(),Blockly.ShortcutItems.registerUndo(),Blockly.ShortcutItems.registerRedo()},Blockly.ShortcutItems.registerDefaultShortcuts(),Blockly.ContextMenuItems={},Blockly.ContextMenuItems.registerUndo=function(){Blockly.ContextMenuRegistry.registry.register({displayText:function(){return Blockly.Msg.UNDO},preconditionFn:function(a){return 0a||Math.abs(this.workspaceHeight_-d)>a)&&(this.workspaceWidth_=c,this.workspaceHeight_=d,this.bubble_.setBubbleSize(c+a,d+a),this.svgDialog_.setAttribute("width",this.workspaceWidth_),this.svgDialog_.setAttribute("height",this.workspaceHeight_),this.workspace_.setCachedParentSvgSize(this.workspaceWidth_,this.workspaceHeight_)),this.block_.RTL&&(a="translate("+this.workspaceWidth_+",0)",this.workspace_.getCanvas().setAttribute("transform",a)),this.workspace_.resize()},Blockly.Mutator.prototype.onBubbleMove_=function(){this.workspace_&&this.workspace_.recordDeleteAreas()},Blockly.Mutator.prototype.setVisible=function(a){if(a!=this.isVisible())if(Blockly.Events.fire(new(Blockly.Events.get(Blockly.Events.BUBBLE_OPEN))(this.block_,a,"mutator")),a){this.bubble_=new Blockly.Bubble(this.block_.workspace,this.createEditor_(),this.block_.pathObject.svgPath,this.iconXY_,null,null),this.bubble_.setSvgId(this.block_.id),this.bubble_.registerMoveEvent(this.onBubbleMove_.bind(this));var b=this.workspace_.options.languageTree;a=this.workspace_.getFlyout(),b&&(a.init(this.workspace_),a.show(b)),this.rootBlock_=this.block_.decompose(this.workspace_);for(var d,e,f,b=this.rootBlock_.getDescendants(!1),c=0;d=b[c];c++)d.render();this.rootBlock_.setMovable(!1),this.rootBlock_.setDeletable(!1),a=a?(b=2*a.CORNER_RADIUS,this.rootBlock_.RTL?a.getWidth()+b:b):b=16,this.block_.RTL&&(a=-a),this.rootBlock_.moveBy(a,b),this.block_.saveConnections&&((f=(e=this).block_).saveConnections(this.rootBlock_),this.sourceListener_=function(){f.saveConnections(e.rootBlock_)},this.block_.workspace.addChangeListener(this.sourceListener_)),this.resizeBubble_(),this.workspace_.addChangeListener(this.workspaceChanged_.bind(this)),this.applyColour()}else this.svgDialog_=null,this.workspace_.dispose(),this.rootBlock_=this.workspace_=null,this.bubble_.dispose(),this.bubble_=null,this.workspaceHeight_=this.workspaceWidth_=0,this.sourceListener_&&(this.block_.workspace.removeChangeListener(this.sourceListener_),this.sourceListener_=null)},Blockly.Mutator.prototype.workspaceChanged_=function(a){if(!(a.isUiEvent||a.type==Blockly.Events.CHANGE&&"disabled"==a.element)){if(!this.workspace_.isDragging()){a=this.workspace_.getTopBlocks(!1);for(var c,b=0;c=a[b];b++){var e,f,d=c.getRelativeToSurfaceXY();d.y<20&&c.moveBy(0,20-d.y),c.RTL?(e=-20,(f=this.workspace_.getFlyout())&&(e-=f.getWidth()),d.x>e&&c.moveBy(e-d.x,0)):d.x<20&&c.moveBy(20-d.x,0)}}var g;this.rootBlock_.workspace==this.workspace_&&(Blockly.Events.setGroup(!0),a=(a=(c=this.block_).mutationToDom())&&Blockly.Xml.domToText(a),b=c.rendered,c.rendered=!1,c.compose(this.rootBlock_),c.rendered=b,c.initSvg(),c.rendered&&c.render(),a!=(b=(b=c.mutationToDom())&&Blockly.Xml.domToText(b))&&(Blockly.Events.fire(new(Blockly.Events.get(Blockly.Events.BLOCK_CHANGE))(c,"mutation",null,a,b)),g=Blockly.Events.getGroup(),setTimeout(function(){Blockly.Events.setGroup(g),c.bumpNeighbours(),Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY)),this.workspace_.isDragging()||this.resizeBubble_(),Blockly.Events.setGroup(!1))}},Blockly.Mutator.prototype.dispose=function(){this.block_.mutator=null,Blockly.Icon.prototype.dispose.call(this)},Blockly.Mutator.prototype.updateBlockStyle=function(){var a=this.workspace_;if(a&&a.getAllBlocks(!1)){for(var b=a.getAllBlocks(!1),c=0;cthis.wrap_&&(a-=360),a},Blockly.Css.register(".blocklyAngleCircle {,stroke: #444;,stroke-width: 1;,fill: #ddd;,fill-opacity: .8;,},.blocklyAngleMarks {,stroke: #444;,stroke-width: 1;,},.blocklyAngleGauge {,fill: #f88;,fill-opacity: .8;,pointer-events: none;,},.blocklyAngleLine {,stroke: #f00;,stroke-width: 2;,stroke-linecap: round;,pointer-events: none;,}".split(",")),Blockly.fieldRegistry.register("field_angle",Blockly.FieldAngle),Blockly.FieldCheckbox=function(a,b,c){this.checkChar_=null,Blockly.FieldCheckbox.superClass_.constructor.call(this,a,b,c)},Blockly.utils.object.inherits(Blockly.FieldCheckbox,Blockly.Field),Blockly.FieldCheckbox.prototype.DEFAULT_VALUE=!1,Blockly.FieldCheckbox.fromJson=function(a){return new Blockly.FieldCheckbox(a.checked,void 0,a)},Blockly.FieldCheckbox.CHECK_CHAR="✓",Blockly.FieldCheckbox.prototype.SERIALIZABLE=!0,Blockly.FieldCheckbox.prototype.CURSOR="default",Blockly.FieldCheckbox.prototype.configure_=function(a){Blockly.FieldCheckbox.superClass_.configure_.call(this,a),a.checkCharacter&&(this.checkChar_=a.checkCharacter)},Blockly.FieldCheckbox.prototype.initView=function(){Blockly.FieldCheckbox.superClass_.initView.call(this),Blockly.utils.dom.addClass(this.textElement_,"blocklyCheckbox"),this.textElement_.style.display=this.value_?"block":"none"},Blockly.FieldCheckbox.prototype.render_=function(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_(this.getConstants().FIELD_CHECKBOX_X_OFFSET)},Blockly.FieldCheckbox.prototype.getDisplayText_=function(){return this.checkChar_||Blockly.FieldCheckbox.CHECK_CHAR},Blockly.FieldCheckbox.prototype.setCheckCharacter=function(a){this.checkChar_=a,this.forceRerender()},Blockly.FieldCheckbox.prototype.showEditor_=function(){this.setValue(!this.value_)},Blockly.FieldCheckbox.prototype.doClassValidation_=function(a){return!0===a||"TRUE"===a?"TRUE":!1===a||"FALSE"===a?"FALSE":null},Blockly.FieldCheckbox.prototype.doValueUpdate_=function(a){this.value_=this.convertValueToBool_(a),this.textElement_&&(this.textElement_.style.display=this.value_?"block":"none")},Blockly.FieldCheckbox.prototype.getValue=function(){return this.value_?"TRUE":"FALSE"},Blockly.FieldCheckbox.prototype.getValueBoolean=function(){return this.value_},Blockly.FieldCheckbox.prototype.getText=function(){return String(this.convertValueToBool_(this.value_))},Blockly.FieldCheckbox.prototype.convertValueToBool_=function(a){return"string"==typeof a?"TRUE"==a:!!a},Blockly.fieldRegistry.register("field_checkbox",Blockly.FieldCheckbox),Blockly.FieldColour=function(a,b,c){Blockly.FieldColour.superClass_.constructor.call(this,a,b,c),this.onKeyDownWrapper_=this.onMouseLeaveWrapper_=this.onMouseEnterWrapper_=this.onMouseMoveWrapper_=this.onClickWrapper_=this.highlightedIndex_=this.picker_=null},Blockly.utils.object.inherits(Blockly.FieldColour,Blockly.Field),Blockly.FieldColour.fromJson=function(a){return new Blockly.FieldColour(a.colour,void 0,a)},Blockly.FieldColour.prototype.SERIALIZABLE=!0,Blockly.FieldColour.prototype.CURSOR="default",Blockly.FieldColour.prototype.isDirty_=!1,Blockly.FieldColour.prototype.colours_=null,Blockly.FieldColour.prototype.titles_=null,Blockly.FieldColour.prototype.columns_=0,Blockly.FieldColour.prototype.configure_=function(a){Blockly.FieldColour.superClass_.configure_.call(this,a),a.colourOptions&&(this.colours_=a.colourOptions,this.titles_=a.colourTitles),a.columns&&(this.columns_=a.columns)},Blockly.FieldColour.prototype.initView=function(){this.size_=new Blockly.utils.Size(this.getConstants().FIELD_COLOUR_DEFAULT_WIDTH,this.getConstants().FIELD_COLOUR_DEFAULT_HEIGHT),this.getConstants().FIELD_COLOUR_FULL_BLOCK?this.clickTarget_=this.sourceBlock_.getSvgRoot():(this.createBorderRect_(),this.borderRect_.style.fillOpacity="1")},Blockly.FieldColour.prototype.applyColour=function(){this.getConstants().FIELD_COLOUR_FULL_BLOCK?(this.sourceBlock_.pathObject.svgPath.setAttribute("fill",this.getValue()),this.sourceBlock_.pathObject.svgPath.setAttribute("stroke","#fff")):this.borderRect_&&(this.borderRect_.style.fill=this.getValue())},Blockly.FieldColour.prototype.doClassValidation_=function(a){return"string"!=typeof a?null:Blockly.utils.colour.parse(a)},Blockly.FieldColour.prototype.doValueUpdate_=function(a){this.value_=a,this.borderRect_?this.borderRect_.style.fill=a:this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.pathObject.svgPath.setAttribute("fill",a),this.sourceBlock_.pathObject.svgPath.setAttribute("stroke","#fff"))},Blockly.FieldColour.prototype.getText=function(){var a=this.value_;return a=/^#(.)\1(.)\2(.)\3$/.test(a)?"#"+a[1]+a[3]+a[5]:a},Blockly.FieldColour.COLOURS="#ffffff #cccccc #c0c0c0 #999999 #666666 #333333 #000000 #ffcccc #ff6666 #ff0000 #cc0000 #990000 #660000 #330000 #ffcc99 #ff9966 #ff9900 #ff6600 #cc6600 #993300 #663300 #ffff99 #ffff66 #ffcc66 #ffcc33 #cc9933 #996633 #663333 #ffffcc #ffff33 #ffff00 #ffcc00 #999900 #666600 #333300 #99ff99 #66ff99 #33ff33 #33cc00 #009900 #006600 #003300 #99ffff #33ffff #66cccc #00cccc #339999 #336666 #003333 #ccffff #66ffff #33ccff #3366ff #3333ff #000099 #000066 #ccccff #9999ff #6666cc #6633ff #6600cc #333399 #330099 #ffccff #ff99ff #cc66cc #cc33cc #993399 #663366 #330033".split(" "),Blockly.FieldColour.prototype.DEFAULT_VALUE=Blockly.FieldColour.COLOURS[0],Blockly.FieldColour.TITLES=[],Blockly.FieldColour.COLUMNS=7,Blockly.FieldColour.prototype.setColours=function(a,b){return this.colours_=a,b&&(this.titles_=b),this},Blockly.FieldColour.prototype.setColumns=function(a){return this.columns_=a,this},Blockly.FieldColour.prototype.showEditor_=function(){this.picker_=this.dropdownCreate_(),Blockly.DropDownDiv.getContentDiv().appendChild(this.picker_),Blockly.DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this)),this.picker_.focus({preventScroll:!0})},Blockly.FieldColour.prototype.onClick_=function(a){null!==(a=(a=a.target)&&a.label)&&(this.setValue(a),Blockly.DropDownDiv.hideIfOwner(this))},Blockly.FieldColour.prototype.onKeyDown_=function(a){var b=!1;a.keyCode===Blockly.utils.KeyCodes.UP?(this.moveHighlightBy_(0,-1),b=!0):a.keyCode===Blockly.utils.KeyCodes.DOWN?(this.moveHighlightBy_(0,1),b=!0):a.keyCode===Blockly.utils.KeyCodes.LEFT?(this.moveHighlightBy_(-1,0),b=!0):a.keyCode===Blockly.utils.KeyCodes.RIGHT?(this.moveHighlightBy_(1,0),b=!0):a.keyCode===Blockly.utils.KeyCodes.ENTER&&(!(b=this.getHighlighted_())||null!==(b=b&&b.label)&&this.setValue(b),Blockly.DropDownDiv.hideWithoutAnimation(),b=!0),b&&a.stopPropagation()},Blockly.FieldColour.prototype.moveHighlightBy_=function(a,b){var c=this.colours_||Blockly.FieldColour.COLOURS,d=this.columns_||Blockly.FieldColour.COLUMNS,e=this.highlightedIndex_%d,f=Math.floor(this.highlightedIndex_/d);e+=a,f+=b,a<0?e<0&&0Math.floor(c.length/d)-1&&(f=Math.floor(c.length/d)-1),this.setHighlightedCell_(this.picker_.childNodes[f].childNodes[e],f*d+e)},Blockly.FieldColour.prototype.onMouseMove_=function(a){var b=(a=a.target)&&Number(a.getAttribute("data-index"));null!==b&&b!==this.highlightedIndex_&&this.setHighlightedCell_(a,b)},Blockly.FieldColour.prototype.onMouseEnter_=function(){this.picker_.focus({preventScroll:!0})},Blockly.FieldColour.prototype.onMouseLeave_=function(){this.picker_.blur();var a=this.getHighlighted_();a&&Blockly.utils.dom.removeClass(a,"blocklyColourHighlighted")},Blockly.FieldColour.prototype.getHighlighted_=function(){var a=this.columns_||Blockly.FieldColour.COLUMNS,b=this.picker_.childNodes[Math.floor(this.highlightedIndex_/a)];return b?b.childNodes[this.highlightedIndex_%a]:null},Blockly.FieldColour.prototype.setHighlightedCell_=function(a,b){var c=this.getHighlighted_();c&&Blockly.utils.dom.removeClass(c,"blocklyColourHighlighted"),Blockly.utils.dom.addClass(a,"blocklyColourHighlighted"),this.highlightedIndex_=b,Blockly.utils.aria.setState(this.picker_,Blockly.utils.aria.State.ACTIVEDESCENDANT,a.getAttribute("id"))},Blockly.FieldColour.prototype.dropdownCreate_=function(){var a=this.columns_||Blockly.FieldColour.COLUMNS,b=this.colours_||Blockly.FieldColour.COLOURS,c=this.titles_||Blockly.FieldColour.TITLES,d=this.getValue(),e=document.createElement("table");e.className="blocklyColourTable",e.tabIndex=0,e.dir="ltr",Blockly.utils.aria.setRole(e,Blockly.utils.aria.Role.GRID),Blockly.utils.aria.setState(e,Blockly.utils.aria.State.EXPANDED,!0),Blockly.utils.aria.setState(e,Blockly.utils.aria.State.ROWCOUNT,Math.floor(b.length/a)),Blockly.utils.aria.setState(e,Blockly.utils.aria.State.COLCOUNT,a);for(var f,g=0;gtr>td {","border: .5px solid #888;","box-sizing: border-box;","cursor: pointer;","display: inline-block;","height: 20px;","padding: 0;","width: 20px;","}",".blocklyColourTable>tr>td.blocklyColourHighlighted {","border-color: #eee;","box-shadow: 2px 2px 7px 2px rgba(0,0,0,.3);","position: relative;","}",".blocklyColourSelected, .blocklyColourSelected:hover {","border-color: #eee !important;","outline: 1px solid #333;","position: relative;","}"]),Blockly.fieldRegistry.register("field_colour",Blockly.FieldColour),Blockly.FieldDropdown=function(a,b,c){"function"!=typeof a&&Blockly.FieldDropdown.validateOptions_(a),this.menuGenerator_=a,this.suffixField=this.prefixField=this.generatedOptions_=null,this.trimOptions_(),this.selectedOption_=this.getOptions(!1)[0],Blockly.FieldDropdown.superClass_.constructor.call(this,this.selectedOption_[1],b,c),this.svgArrow_=this.arrow_=this.imageElement_=this.menu_=this.selectedMenuItem_=null},Blockly.utils.object.inherits(Blockly.FieldDropdown,Blockly.Field),Blockly.FieldDropdown.fromJson=function(a){return new Blockly.FieldDropdown(a.options,void 0,a)},Blockly.FieldDropdown.prototype.fromXml=function(a){this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(a.textContent)},Blockly.FieldDropdown.prototype.SERIALIZABLE=!0,Blockly.FieldDropdown.CHECKMARK_OVERHANG=25,Blockly.FieldDropdown.MAX_MENU_HEIGHT_VH=.45,Blockly.FieldDropdown.IMAGE_Y_OFFSET=5,Blockly.FieldDropdown.IMAGE_Y_PADDING=2*Blockly.FieldDropdown.IMAGE_Y_OFFSET,Blockly.FieldDropdown.ARROW_CHAR=Blockly.utils.userAgent.ANDROID?"▼":"▾",Blockly.FieldDropdown.prototype.CURSOR="default",Blockly.FieldDropdown.prototype.initView=function(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot(),this.createTextElement_(),this.imageElement_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.IMAGE,{},this.fieldGroup_),this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_(),this.borderRect_&&Blockly.utils.dom.addClass(this.borderRect_,"blocklyDropdownRect")},Blockly.FieldDropdown.prototype.shouldAddBorderRect_=function(){return!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&!this.sourceBlock_.isShadow()},Blockly.FieldDropdown.prototype.createTextArrow_=function(){this.arrow_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.TSPAN,{},this.textElement_),this.arrow_.appendChild(document.createTextNode(this.sourceBlock_.RTL?Blockly.FieldDropdown.ARROW_CHAR+" ":" "+Blockly.FieldDropdown.ARROW_CHAR)),this.sourceBlock_.RTL?this.textElement_.insertBefore(this.arrow_,this.textContent_):this.textElement_.appendChild(this.arrow_)},Blockly.FieldDropdown.prototype.createSVGArrow_=function(){this.svgArrow_=Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.IMAGE,{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_),this.svgArrow_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI)},Blockly.FieldDropdown.prototype.showEditor_=function(a){var b;this.menu_=this.dropdownCreate_(),this.menu_.openingCoords=a&&"number"==typeof a.clientX?new Blockly.utils.Coordinate(a.clientX,a.clientY):null,this.menu_.render(Blockly.DropDownDiv.getContentDiv()),a=this.menu_.getElement(),Blockly.utils.dom.addClass(a,"blocklyDropdownMenu"),this.getConstants().FIELD_DROPDOWN_COLOURED_DIV&&(a=(this.sourceBlock_.isShadow()?this.sourceBlock_.getParent():this.sourceBlock_).getColour(),b=(this.sourceBlock_.isShadow()?this.sourceBlock_.getParent():this.sourceBlock_).style.colourTertiary,Blockly.DropDownDiv.setColour(a,b)),Blockly.DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this)),this.menu_.focus(),this.selectedMenuItem_&&this.menu_.setHighlighted(this.selectedMenuItem_),this.applyColour()},Blockly.FieldDropdown.prototype.dropdownCreate_=function(){var a=new Blockly.Menu;a.setRole(Blockly.utils.aria.Role.LISTBOX);var b=this.getOptions(!1);this.selectedMenuItem_=null;for(var c=0;cthis.maxDisplayLength?e=e.substring(0,this.maxDisplayLength-4)+"...":this.isOverflowedY_&&d===c-1&&(e=e.substring(0,e.length-3)+"..."),a+=e=e.replace(/\s/g,Blockly.Field.NBSP),d!==c-1&&(a+="\n")}return this.sourceBlock_.RTL&&(a+="‏"),a},Blockly.FieldMultilineInput.prototype.doValueUpdate_=function(a){Blockly.FieldMultilineInput.superClass_.doValueUpdate_.call(this,a),this.isOverflowedY_=this.value_.split("\n").length>this.maxLines_},Blockly.FieldMultilineInput.prototype.render_=function(){for(;a=this.textGroup_.firstChild;)this.textGroup_.removeChild(a);for(var a=this.getDisplayText_().split("\n"),b=0,c=0;cthis.maxDisplayLength&&(a[d]=a[d].substring(0,this.maxDisplayLength)),e.textContent=a[d];var k=Blockly.utils.dom.getFastTextWidth(e,f,g,h);bthis.max_&&Blockly.utils.aria.setState(a,Blockly.utils.aria.State.VALUEMAX,this.max_),a},Blockly.fieldRegistry.register("field_number",Blockly.FieldNumber),Blockly.FieldVariable=function(a,b,c,d,e){this.menuGenerator_=Blockly.FieldVariable.dropdownCreate,this.defaultVariableName="string"==typeof a?a:"",this.size_=new Blockly.utils.Size(0,0),e&&this.configure_(e),b&&this.setValidator(b),e||this.setTypes_(c,d)},Blockly.utils.object.inherits(Blockly.FieldVariable,Blockly.FieldDropdown),Blockly.FieldVariable.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.variable);return new Blockly.FieldVariable(b,void 0,void 0,void 0,a)},Blockly.FieldVariable.prototype.SERIALIZABLE=!0,Blockly.FieldVariable.prototype.configure_=function(a){Blockly.FieldVariable.superClass_.configure_.call(this,a),this.setTypes_(a.variableTypes,a.defaultType)},Blockly.FieldVariable.prototype.initModel=function(){var a;this.variable_||(a=Blockly.Variables.getOrCreateVariablePackage(this.sourceBlock_.workspace,null,this.defaultVariableName,this.defaultType_),this.doValueUpdate_(a.getId()))},Blockly.FieldVariable.prototype.shouldAddBorderRect_=function(){return Blockly.FieldVariable.superClass_.shouldAddBorderRect_.call(this)&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||"variables_get"!=this.sourceBlock_.type)},Blockly.FieldVariable.prototype.fromXml=function(a){var b=a.getAttribute("id"),c=a.textContent,d=a.getAttribute("variabletype")||a.getAttribute("variableType")||"",b=Blockly.Variables.getOrCreateVariablePackage(this.sourceBlock_.workspace,b,c,d);if(null!=d&&d!==b.type)throw Error("Serialized variable type with id '"+b.getId()+"' had type "+b.type+", and does not match variable field that references it: "+Blockly.Xml.domToText(a)+".");this.setValue(b.getId())},Blockly.FieldVariable.prototype.toXml=function(a){return this.initModel(),a.id=this.variable_.getId(),a.textContent=this.variable_.name,this.variable_.type&&a.setAttribute("variabletype",this.variable_.type),a},Blockly.FieldVariable.prototype.setSourceBlock=function(a){if(a.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");Blockly.FieldVariable.superClass_.setSourceBlock.call(this,a)},Blockly.FieldVariable.prototype.getValue=function(){return this.variable_?this.variable_.getId():null},Blockly.FieldVariable.prototype.getText=function(){return this.variable_?this.variable_.name:""},Blockly.FieldVariable.prototype.getVariable=function(){return this.variable_},Blockly.FieldVariable.prototype.getValidator=function(){return this.variable_?this.validator_:null},Blockly.FieldVariable.prototype.doClassValidation_=function(a){if(null===a)return null;var b=Blockly.Variables.getVariable(this.sourceBlock_.workspace,a);return b?(b=b.type,this.typeIsAllowed_(b)?a:(console.warn("Variable type doesn't match this field! Type was "+b),null)):(console.warn("Variable id doesn't point to a real variable! ID was "+a),null)},Blockly.FieldVariable.prototype.doValueUpdate_=function(a){this.variable_=Blockly.Variables.getVariable(this.sourceBlock_.workspace,a),Blockly.FieldVariable.superClass_.doValueUpdate_.call(this,a)},Blockly.FieldVariable.prototype.typeIsAllowed_=function(a){var b=this.getVariableTypes_();if(!b)return!0;for(var c=0;crect,",a+" .blocklyEditableText>rect {","fill: "+this.FIELD_BORDER_RECT_COLOUR+";","fill-opacity: .6;","stroke: none;","}",a+" .blocklyNonEditableText>text,",a+" .blocklyEditableText>text {","fill: #000;","}",a+" .blocklyFlyoutLabelText {","fill: #000;","}",a+" .blocklyText.blocklyBubbleText {","fill: #000;","}",a+" .blocklyEditableText:not(.editing):hover>rect {","stroke: #fff;","stroke-width: 2;","}",a+" .blocklyHtmlInput {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","font-weight: "+this.FIELD_TEXT_FONTWEIGHT+";","}",a+" .blocklySelected>.blocklyPath {","stroke: #fc3;","stroke-width: 3px;","}",a+" .blocklyHighlightedConnectionPath {","stroke: #fc3;","}",a+" .blocklyReplaceable .blocklyPath {","fill-opacity: .5;","}",a+" .blocklyReplaceable .blocklyPathLight,",a+" .blocklyReplaceable .blocklyPathDark {","display: none;","}",a+" .blocklyInsertionMarker>.blocklyPath {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none;","}"]},Blockly.blockRendering.Types={NONE:0,FIELD:1,HAT:2,ICON:4,SPACER:8,BETWEEN_ROW_SPACER:16,IN_ROW_SPACER:32,EXTERNAL_VALUE_INPUT:64,INPUT:128,INLINE_INPUT:256,STATEMENT_INPUT:512,CONNECTION:1024,PREVIOUS_CONNECTION:2048,NEXT_CONNECTION:4096,OUTPUT_CONNECTION:8192,CORNER:16384,LEFT_SQUARE_CORNER:32768,LEFT_ROUND_CORNER:65536,RIGHT_SQUARE_CORNER:131072,RIGHT_ROUND_CORNER:262144,JAGGED_EDGE:524288,ROW:1048576,TOP_ROW:2097152,BOTTOM_ROW:4194304,INPUT_ROW:8388608},Blockly.blockRendering.Types.LEFT_CORNER=Blockly.blockRendering.Types.LEFT_SQUARE_CORNER|Blockly.blockRendering.Types.LEFT_ROUND_CORNER,Blockly.blockRendering.Types.RIGHT_CORNER=Blockly.blockRendering.Types.RIGHT_SQUARE_CORNER|Blockly.blockRendering.Types.RIGHT_ROUND_CORNER,Blockly.blockRendering.Types.nextTypeValue_=16777216,Blockly.blockRendering.Types.getType=function(a){return Object.prototype.hasOwnProperty.call(Blockly.blockRendering.Types,a)||(Blockly.blockRendering.Types[a]=Blockly.blockRendering.Types.nextTypeValue_,Blockly.blockRendering.Types.nextTypeValue_<<=1),Blockly.blockRendering.Types[a]},Blockly.blockRendering.Types.isField=function(a){return a.type&Blockly.blockRendering.Types.FIELD},Blockly.blockRendering.Types.isHat=function(a){return a.type&Blockly.blockRendering.Types.HAT},Blockly.blockRendering.Types.isIcon=function(a){return a.type&Blockly.blockRendering.Types.ICON},Blockly.blockRendering.Types.isSpacer=function(a){return a.type&Blockly.blockRendering.Types.SPACER},Blockly.blockRendering.Types.isInRowSpacer=function(a){return a.type&Blockly.blockRendering.Types.IN_ROW_SPACER},Blockly.blockRendering.Types.isInput=function(a){return a.type&Blockly.blockRendering.Types.INPUT},Blockly.blockRendering.Types.isExternalInput=function(a){return a.type&Blockly.blockRendering.Types.EXTERNAL_VALUE_INPUT},Blockly.blockRendering.Types.isInlineInput=function(a){return a.type&Blockly.blockRendering.Types.INLINE_INPUT},Blockly.blockRendering.Types.isStatementInput=function(a){return a.type&Blockly.blockRendering.Types.STATEMENT_INPUT},Blockly.blockRendering.Types.isPreviousConnection=function(a){return a.type&Blockly.blockRendering.Types.PREVIOUS_CONNECTION},Blockly.blockRendering.Types.isNextConnection=function(a){return a.type&Blockly.blockRendering.Types.NEXT_CONNECTION},Blockly.blockRendering.Types.isPreviousOrNextConnection=function(a){return a.type&(Blockly.blockRendering.Types.PREVIOUS_CONNECTION|Blockly.blockRendering.Types.NEXT_CONNECTION)},Blockly.blockRendering.Types.isLeftRoundedCorner=function(a){return a.type&Blockly.blockRendering.Types.LEFT_ROUND_CORNER},Blockly.blockRendering.Types.isRightRoundedCorner=function(a){return a.type&Blockly.blockRendering.Types.RIGHT_ROUND_CORNER},Blockly.blockRendering.Types.isLeftSquareCorner=function(a){return a.type&Blockly.blockRendering.Types.LEFT_SQUARE_CORNER},Blockly.blockRendering.Types.isRightSquareCorner=function(a){return a.type&Blockly.blockRendering.Types.RIGHT_SQUARE_CORNER},Blockly.blockRendering.Types.isCorner=function(a){return a.type&Blockly.blockRendering.Types.CORNER},Blockly.blockRendering.Types.isJaggedEdge=function(a){return a.type&Blockly.blockRendering.Types.JAGGED_EDGE},Blockly.blockRendering.Types.isRow=function(a){return a.type&Blockly.blockRendering.Types.ROW},Blockly.blockRendering.Types.isBetweenRowSpacer=function(a){return a.type&Blockly.blockRendering.Types.BETWEEN_ROW_SPACER},Blockly.blockRendering.Types.isTopRow=function(a){return a.type&Blockly.blockRendering.Types.TOP_ROW},Blockly.blockRendering.Types.isBottomRow=function(a){return a.type&Blockly.blockRendering.Types.BOTTOM_ROW},Blockly.blockRendering.Types.isTopOrBottomRow=function(a){return a.type&(Blockly.blockRendering.Types.TOP_ROW|Blockly.blockRendering.Types.BOTTOM_ROW)},Blockly.blockRendering.Types.isInputRow=function(a){return a.type&Blockly.blockRendering.Types.INPUT_ROW},Blockly.blockRendering.Measurable=function(a){this.height=this.width=0,this.type=Blockly.blockRendering.Types.NONE,this.centerline=this.xPos=0,this.constants_=a,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT},Blockly.blockRendering.Connection=function(a,b){Blockly.blockRendering.Connection.superClass_.constructor.call(this,a),this.connectionModel=b,this.shape=this.constants_.shapeFor(b),this.isDynamicShape=!!this.shape.isDynamic,this.type|=Blockly.blockRendering.Types.CONNECTION},Blockly.utils.object.inherits(Blockly.blockRendering.Connection,Blockly.blockRendering.Measurable),Blockly.blockRendering.OutputConnection=function(a,b){Blockly.blockRendering.OutputConnection.superClass_.constructor.call(this,a,b),this.type|=Blockly.blockRendering.Types.OUTPUT_CONNECTION,this.height=this.isDynamicShape?0:this.shape.height,this.startX=this.width=this.isDynamicShape?0:this.shape.width,this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP,this.connectionOffsetX=0},Blockly.utils.object.inherits(Blockly.blockRendering.OutputConnection,Blockly.blockRendering.Connection),Blockly.blockRendering.PreviousConnection=function(a,b){Blockly.blockRendering.PreviousConnection.superClass_.constructor.call(this,a,b),this.type|=Blockly.blockRendering.Types.PREVIOUS_CONNECTION,this.height=this.shape.height,this.width=this.shape.width},Blockly.utils.object.inherits(Blockly.blockRendering.PreviousConnection,Blockly.blockRendering.Connection),Blockly.blockRendering.NextConnection=function(a,b){Blockly.blockRendering.NextConnection.superClass_.constructor.call(this,a,b),this.type|=Blockly.blockRendering.Types.NEXT_CONNECTION,this.height=this.shape.height,this.width=this.shape.width},Blockly.utils.object.inherits(Blockly.blockRendering.NextConnection,Blockly.blockRendering.Connection),Blockly.blockRendering.InputConnection=function(a,b){Blockly.blockRendering.InputConnection.superClass_.constructor.call(this,a,b.connection),this.type|=Blockly.blockRendering.Types.INPUT,this.input=b,this.align=b.align,(this.connectedBlock=b.connection&&b.connection.targetBlock()?b.connection.targetBlock():null)?(a=this.connectedBlock.getHeightWidth(),this.connectedBlockWidth=a.width,this.connectedBlockHeight=a.height):this.connectedBlockHeight=this.connectedBlockWidth=0,this.connectionOffsetY=this.connectionOffsetX=0},Blockly.utils.object.inherits(Blockly.blockRendering.InputConnection,Blockly.blockRendering.Connection),Blockly.blockRendering.InlineInput=function(a,b){Blockly.blockRendering.InlineInput.superClass_.constructor.call(this,a,b),this.type|=Blockly.blockRendering.Types.INLINE_INPUT,this.connectedBlock?(this.width=this.connectedBlockWidth,this.height=this.connectedBlockHeight):(this.height=this.constants_.EMPTY_INLINE_INPUT_HEIGHT,this.width=this.constants_.EMPTY_INLINE_INPUT_PADDING),this.connectionHeight=this.isDynamicShape?this.shape.height(this.height):this.shape.height,this.connectionWidth=this.isDynamicShape?this.shape.width(this.height):this.shape.width,this.connectedBlock||(this.width+=this.connectionWidth*(this.isDynamicShape?2:1)),this.connectionOffsetY=this.isDynamicShape?this.shape.connectionOffsetY(this.connectionHeight):this.constants_.TAB_OFFSET_FROM_TOP,this.connectionOffsetX=this.isDynamicShape?this.shape.connectionOffsetX(this.connectionWidth):0},Blockly.utils.object.inherits(Blockly.blockRendering.InlineInput,Blockly.blockRendering.InputConnection),Blockly.blockRendering.StatementInput=function(a,b){Blockly.blockRendering.StatementInput.superClass_.constructor.call(this,a,b),this.type|=Blockly.blockRendering.Types.STATEMENT_INPUT,this.height=this.connectedBlock?this.connectedBlockHeight+this.constants_.STATEMENT_BOTTOM_SPACER:this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT,this.width=this.constants_.STATEMENT_INPUT_NOTCH_OFFSET+this.shape.width},Blockly.utils.object.inherits(Blockly.blockRendering.StatementInput,Blockly.blockRendering.InputConnection),Blockly.blockRendering.ExternalValueInput=function(a,b){Blockly.blockRendering.ExternalValueInput.superClass_.constructor.call(this,a,b),this.type|=Blockly.blockRendering.Types.EXTERNAL_VALUE_INPUT,this.height=this.connectedBlock?this.connectedBlockHeight-this.constants_.TAB_OFFSET_FROM_TOP-this.constants_.MEDIUM_PADDING:this.shape.height,this.width=this.shape.width+this.constants_.EXTERNAL_VALUE_INPUT_PADDING,this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP,this.connectionHeight=this.shape.height,this.connectionWidth=this.shape.width},Blockly.utils.object.inherits(Blockly.blockRendering.ExternalValueInput,Blockly.blockRendering.InputConnection),Blockly.blockRendering.Icon=function(a,b){Blockly.blockRendering.Icon.superClass_.constructor.call(this,a),this.icon=b,this.isVisible=b.isVisible(),this.type|=Blockly.blockRendering.Types.ICON,a=b.getCorrectedSize(),this.height=a.height,this.width=a.width},Blockly.utils.object.inherits(Blockly.blockRendering.Icon,Blockly.blockRendering.Measurable),Blockly.blockRendering.JaggedEdge=function(a){Blockly.blockRendering.JaggedEdge.superClass_.constructor.call(this,a),this.type|=Blockly.blockRendering.Types.JAGGED_EDGE,this.height=this.constants_.JAGGED_TEETH.height,this.width=this.constants_.JAGGED_TEETH.width},Blockly.utils.object.inherits(Blockly.blockRendering.JaggedEdge,Blockly.blockRendering.Measurable),Blockly.blockRendering.Field=function(a,b,c){Blockly.blockRendering.Field.superClass_.constructor.call(this,a),this.field=b,this.isEditable=b.EDITABLE,this.flipRtl=b.getFlipRtl(),this.type|=Blockly.blockRendering.Types.FIELD,a=this.field.getSize(),this.height=a.height,this.width=a.width,this.parentInput=c},Blockly.utils.object.inherits(Blockly.blockRendering.Field,Blockly.blockRendering.Measurable),Blockly.blockRendering.Hat=function(a){Blockly.blockRendering.Hat.superClass_.constructor.call(this,a),this.type|=Blockly.blockRendering.Types.HAT,this.height=this.constants_.START_HAT.height,this.width=this.constants_.START_HAT.width,this.ascenderHeight=this.height},Blockly.utils.object.inherits(Blockly.blockRendering.Hat,Blockly.blockRendering.Measurable),Blockly.blockRendering.SquareCorner=function(a,b){Blockly.blockRendering.SquareCorner.superClass_.constructor.call(this,a),this.type=(b&&"left"!=b?Blockly.blockRendering.Types.RIGHT_SQUARE_CORNER:Blockly.blockRendering.Types.LEFT_SQUARE_CORNER)|Blockly.blockRendering.Types.CORNER,this.width=this.height=this.constants_.NO_PADDING},Blockly.utils.object.inherits(Blockly.blockRendering.SquareCorner,Blockly.blockRendering.Measurable),Blockly.blockRendering.RoundCorner=function(a,b){Blockly.blockRendering.RoundCorner.superClass_.constructor.call(this,a),this.type=(b&&"left"!=b?Blockly.blockRendering.Types.RIGHT_ROUND_CORNER:Blockly.blockRendering.Types.LEFT_ROUND_CORNER)|Blockly.blockRendering.Types.CORNER,this.width=this.constants_.CORNER_RADIUS,this.height=this.constants_.CORNER_RADIUS/2},Blockly.utils.object.inherits(Blockly.blockRendering.RoundCorner,Blockly.blockRendering.Measurable),Blockly.blockRendering.InRowSpacer=function(a,b){Blockly.blockRendering.InRowSpacer.superClass_.constructor.call(this,a),this.type=this.type|Blockly.blockRendering.Types.SPACER|Blockly.blockRendering.Types.IN_ROW_SPACER,this.width=b,this.height=this.constants_.SPACER_DEFAULT_HEIGHT},Blockly.utils.object.inherits(Blockly.blockRendering.InRowSpacer,Blockly.blockRendering.Measurable),Blockly.blockRendering.Row=function(a){this.type=Blockly.blockRendering.Types.ROW,this.elements=[],this.xPos=this.yPos=this.widthWithConnectedBlocks=this.minWidth=this.minHeight=this.width=this.height=0,this.hasJaggedEdge=this.hasDummyInput=this.hasInlineInput=this.hasStatement=this.hasExternalInput=!1,this.constants_=a,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT,this.align=null},Blockly.blockRendering.Row.prototype.measure=function(){throw Error("Unexpected attempt to measure a base Row.")},Blockly.blockRendering.Row.prototype.getLastInput=function(){for(var b,a=this.elements.length-1;b=this.elements[a];a--)if(Blockly.blockRendering.Types.isInput(b))return b;return null},Blockly.blockRendering.Row.prototype.startsWithElemSpacer=function(){return!0},Blockly.blockRendering.Row.prototype.endsWithElemSpacer=function(){return!0},Blockly.blockRendering.Row.prototype.getFirstSpacer=function(){for(var b,a=0;b=this.elements[a];a++)if(Blockly.blockRendering.Types.isSpacer(b))return b;return null},Blockly.blockRendering.Row.prototype.getLastSpacer=function(){for(var b,a=this.elements.length-1;b=this.elements[a];a--)if(Blockly.blockRendering.Types.isSpacer(b))return b;return null},Blockly.blockRendering.TopRow=function(a){Blockly.blockRendering.TopRow.superClass_.constructor.call(this,a),this.type|=Blockly.blockRendering.Types.TOP_ROW,this.ascenderHeight=this.capline=0,this.hasPreviousConnection=!1,this.connection=null},Blockly.utils.object.inherits(Blockly.blockRendering.TopRow,Blockly.blockRendering.Row),Blockly.blockRendering.TopRow.prototype.hasLeftSquareCorner=function(a){var b=(a.hat?"cap"===a.hat:this.constants_.ADD_START_HATS)&&!a.outputConnection&&!a.previousConnection,c=a.getPreviousBlock();return!!a.outputConnection||b||!!c&&c.getNextBlock()==a},Blockly.blockRendering.TopRow.prototype.hasRightSquareCorner=function(a){return!0},Blockly.blockRendering.TopRow.prototype.measure=function(){for(var e,a=0,b=0,c=0,d=0;e=this.elements[d];d++)b+=e.width,Blockly.blockRendering.Types.isSpacer(e)||(Blockly.blockRendering.Types.isHat(e)?c=Math.max(c,e.ascenderHeight):a=Math.max(a,e.height));this.width=Math.max(this.minWidth,b),this.height=Math.max(this.minHeight,a)+c,this.capline=this.ascenderHeight=c,this.widthWithConnectedBlocks=this.width},Blockly.blockRendering.TopRow.prototype.startsWithElemSpacer=function(){return!1},Blockly.blockRendering.TopRow.prototype.endsWithElemSpacer=function(){return!1},Blockly.blockRendering.BottomRow=function(a){Blockly.blockRendering.BottomRow.superClass_.constructor.call(this,a),this.type|=Blockly.blockRendering.Types.BOTTOM_ROW,this.hasNextConnection=!1,this.connection=null,this.baseline=this.descenderHeight=0},Blockly.utils.object.inherits(Blockly.blockRendering.BottomRow,Blockly.blockRendering.Row),Blockly.blockRendering.BottomRow.prototype.hasLeftSquareCorner=function(a){return!!a.outputConnection||!!a.getNextBlock()},Blockly.blockRendering.BottomRow.prototype.hasRightSquareCorner=function(a){return!0},Blockly.blockRendering.BottomRow.prototype.measure=function(){for(var e,a=0,b=0,c=0,d=0;e=this.elements[d];d++)b+=e.width,Blockly.blockRendering.Types.isSpacer(e)||(Blockly.blockRendering.Types.isNextConnection(e)?c=Math.max(c,e.height):a=Math.max(a,e.height));this.width=Math.max(this.minWidth,b),this.height=Math.max(this.minHeight,a)+c,this.descenderHeight=c,this.widthWithConnectedBlocks=this.width},Blockly.blockRendering.BottomRow.prototype.startsWithElemSpacer=function(){return!1},Blockly.blockRendering.BottomRow.prototype.endsWithElemSpacer=function(){return!1},Blockly.blockRendering.SpacerRow=function(a,b,c){Blockly.blockRendering.SpacerRow.superClass_.constructor.call(this,a),this.type=this.type|Blockly.blockRendering.Types.SPACER|Blockly.blockRendering.Types.BETWEEN_ROW_SPACER,this.width=c,this.height=b,this.followsStatement=!1,this.widthWithConnectedBlocks=0,this.elements=[new Blockly.blockRendering.InRowSpacer(this.constants_,c)]},Blockly.utils.object.inherits(Blockly.blockRendering.SpacerRow,Blockly.blockRendering.Row),Blockly.blockRendering.SpacerRow.prototype.measure=function(){},Blockly.blockRendering.InputRow=function(a){Blockly.blockRendering.InputRow.superClass_.constructor.call(this,a),this.type|=Blockly.blockRendering.Types.INPUT_ROW,this.connectedBlockWidths=0},Blockly.utils.object.inherits(Blockly.blockRendering.InputRow,Blockly.blockRendering.Row),Blockly.blockRendering.InputRow.prototype.measure=function(){this.width=this.minWidth,this.height=this.minHeight;for(var c,a=0,b=0;c=this.elements[b];b++)this.width+=c.width,Blockly.blockRendering.Types.isInput(c)&&(Blockly.blockRendering.Types.isStatementInput(c)?a+=c.connectedBlockWidth:Blockly.blockRendering.Types.isExternalInput(c)&&0!=c.connectedBlockWidth&&(a+=c.connectedBlockWidth-c.connectionWidth)),Blockly.blockRendering.Types.isSpacer(c)||(this.height=Math.max(this.height,c.height));this.connectedBlockWidths=a,this.widthWithConnectedBlocks=this.width+a},Blockly.blockRendering.InputRow.prototype.endsWithElemSpacer=function(){return!this.hasExternalInput&&!this.hasStatement},Blockly.blockRendering.RenderInfo=function(a,b){this.block_=b,this.renderer_=a,this.constants_=this.renderer_.getConstants(),this.outputConnection=b.outputConnection?new Blockly.blockRendering.OutputConnection(this.constants_,b.outputConnection):null,this.isInline=b.getInputsInline()&&!b.isCollapsed(),this.isCollapsed=b.isCollapsed(),this.isInsertionMarker=b.isInsertionMarker(),this.RTL=b.RTL,this.statementEdge=this.width=this.widthWithChildren=this.height=0,this.rows=[],this.inputRows=[],this.hiddenIcons=[],this.topRow=new Blockly.blockRendering.TopRow(this.constants_),this.bottomRow=new Blockly.blockRendering.BottomRow(this.constants_),this.startY=this.startX=0},Blockly.blockRendering.RenderInfo.prototype.getRenderer=function(){return this.renderer_},Blockly.blockRendering.RenderInfo.prototype.measure=function(){this.createRows_(),this.addElemSpacing_(),this.addRowSpacing_(),this.computeBounds_(),this.alignRowElements_(),this.finalize_()},Blockly.blockRendering.RenderInfo.prototype.createRows_=function(){this.populateTopRow_(),this.rows.push(this.topRow);var a=new Blockly.blockRendering.InputRow(this.constants_);this.inputRows.push(a);var b=this.block_.getIcons();if(b.length)for(var d,c=0;d=b[c];c++){var e=new Blockly.blockRendering.Icon(this.constants_,d);(this.isCollapsed&&d.collapseHidden?this.hiddenIcons:a.elements).push(e)}for(d=null,c=0;b=this.block_.inputList[c];c++)if(b.isVisible()){for(this.shouldStartNewRow_(b,d)&&(this.rows.push(a),a=new Blockly.blockRendering.InputRow(this.constants_),this.inputRows.push(a)),d=0;e=b.fieldRow[d];d++)a.elements.push(new Blockly.blockRendering.Field(this.constants_,e,b));this.addInput_(b,a),d=b}this.isCollapsed&&(a.hasJaggedEdge=!0,a.elements.push(new Blockly.blockRendering.JaggedEdge(this.constants_))),(a.elements.length||a.hasDummyInput)&&this.rows.push(a),this.populateBottomRow_(),this.rows.push(this.bottomRow)},Blockly.blockRendering.RenderInfo.prototype.populateTopRow_=function(){var a=!!this.block_.previousConnection,b=(this.block_.hat?"cap"===this.block_.hat:this.constants_.ADD_START_HATS)&&!this.outputConnection&&!a;this.topRow.hasLeftSquareCorner(this.block_)?this.topRow.elements.push(new Blockly.blockRendering.SquareCorner(this.constants_)):this.topRow.elements.push(new Blockly.blockRendering.RoundCorner(this.constants_)),b?(a=new Blockly.blockRendering.Hat(this.constants_),this.topRow.elements.push(a),this.topRow.capline=a.ascenderHeight):a&&(this.topRow.hasPreviousConnection=!0,this.topRow.connection=new Blockly.blockRendering.PreviousConnection(this.constants_,this.block_.previousConnection),this.topRow.elements.push(this.topRow.connection)),this.block_.inputList.length&&this.block_.inputList[0].type==Blockly.inputTypes.STATEMENT&&!this.block_.isCollapsed()?this.topRow.minHeight=this.constants_.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT:this.topRow.minHeight=this.constants_.TOP_ROW_MIN_HEIGHT,this.topRow.hasRightSquareCorner(this.block_)?this.topRow.elements.push(new Blockly.blockRendering.SquareCorner(this.constants_,"right")):this.topRow.elements.push(new Blockly.blockRendering.RoundCorner(this.constants_,"right"))},Blockly.blockRendering.RenderInfo.prototype.populateBottomRow_=function(){this.bottomRow.hasNextConnection=!!this.block_.nextConnection,this.bottomRow.minHeight=this.block_.inputList.length&&this.block_.inputList[this.block_.inputList.length-1].type==Blockly.inputTypes.STATEMENT?this.constants_.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT:this.constants_.BOTTOM_ROW_MIN_HEIGHT,this.bottomRow.hasLeftSquareCorner(this.block_)?this.bottomRow.elements.push(new Blockly.blockRendering.SquareCorner(this.constants_)):this.bottomRow.elements.push(new Blockly.blockRendering.RoundCorner(this.constants_)),this.bottomRow.hasNextConnection&&(this.bottomRow.connection=new Blockly.blockRendering.NextConnection(this.constants_,this.block_.nextConnection),this.bottomRow.elements.push(this.bottomRow.connection)),this.bottomRow.hasRightSquareCorner(this.block_)?this.bottomRow.elements.push(new Blockly.blockRendering.SquareCorner(this.constants_,"right")):this.bottomRow.elements.push(new Blockly.blockRendering.RoundCorner(this.constants_,"right"))},Blockly.blockRendering.RenderInfo.prototype.addInput_=function(a,b){this.isInline&&a.type==Blockly.inputTypes.VALUE?(b.elements.push(new Blockly.blockRendering.InlineInput(this.constants_,a)),b.hasInlineInput=!0):a.type==Blockly.inputTypes.STATEMENT?(b.elements.push(new Blockly.blockRendering.StatementInput(this.constants_,a)),b.hasStatement=!0):a.type==Blockly.inputTypes.VALUE?(b.elements.push(new Blockly.blockRendering.ExternalValueInput(this.constants_,a)),b.hasExternalInput=!0):a.type==Blockly.inputTypes.DUMMY&&(b.minHeight=Math.max(b.minHeight,a.getSourceBlock()&&a.getSourceBlock().isShadow()?this.constants_.DUMMY_INPUT_SHADOW_MIN_HEIGHT:this.constants_.DUMMY_INPUT_MIN_HEIGHT),b.hasDummyInput=!0),null==b.align&&(b.align=a.align)},Blockly.blockRendering.RenderInfo.prototype.shouldStartNewRow_=function(a,b){return!!b&&(a.type==Blockly.inputTypes.STATEMENT||b.type==Blockly.inputTypes.STATEMENT||(a.type==Blockly.inputTypes.VALUE||a.type==Blockly.inputTypes.DUMMY)&&!this.isInline)},Blockly.blockRendering.RenderInfo.prototype.addElemSpacing_=function(){for(var b,a=0;b=this.rows[a];a++){var c=b.elements;if(b.elements=[],b.startsWithElemSpacer()&&b.elements.push(new Blockly.blockRendering.InRowSpacer(this.constants_,this.getInRowSpacing_(null,c[0]))),c.length){for(var d=0;d.blocklyPathLight,",a+" .blocklyInsertionMarker>.blocklyPathDark {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none;","}"])},Blockly.geras.Highlighter=function(a){this.info_=a,this.inlineSteps_=this.steps_="",this.RTL_=this.info_.RTL,a=a.getRenderer(),this.constants_=a.getConstants(),this.highlightConstants_=a.getHighlightConstants(),this.highlightOffset_=this.highlightConstants_.OFFSET,this.outsideCornerPaths_=this.highlightConstants_.OUTSIDE_CORNER,this.insideCornerPaths_=this.highlightConstants_.INSIDE_CORNER,this.puzzleTabPaths_=this.highlightConstants_.PUZZLE_TAB,this.notchPaths_=this.highlightConstants_.NOTCH,this.startPaths_=this.highlightConstants_.START_HAT,this.jaggedTeethPaths_=this.highlightConstants_.JAGGED_TEETH},Blockly.geras.Highlighter.prototype.getPath=function(){return this.steps_+"\n"+this.inlineSteps_},Blockly.geras.Highlighter.prototype.drawTopCorner=function(a){this.steps_+=Blockly.utils.svgPaths.moveBy(a.xPos,this.info_.startY);for(var c,b=0;c=a.elements[b];b++)Blockly.blockRendering.Types.isLeftSquareCorner(c)?this.steps_+=this.highlightConstants_.START_POINT:Blockly.blockRendering.Types.isLeftRoundedCorner(c)?this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):Blockly.blockRendering.Types.isPreviousConnection(c)?this.steps_+=this.notchPaths_.pathLeft:Blockly.blockRendering.Types.isHat(c)?this.steps_+=this.startPaths_.path(this.RTL_):Blockly.blockRendering.Types.isSpacer(c)&&0!=c.width&&(this.steps_+=Blockly.utils.svgPaths.lineOnAxis("H",c.xPos+c.width-this.highlightOffset_));this.steps_+=Blockly.utils.svgPaths.lineOnAxis("H",a.xPos+a.width-this.highlightOffset_)},Blockly.geras.Highlighter.prototype.drawJaggedEdge_=function(a){this.info_.RTL&&(this.steps_+=this.jaggedTeethPaths_.pathLeft+Blockly.utils.svgPaths.lineOnAxis("v",a.height-this.jaggedTeethPaths_.height-this.highlightOffset_))},Blockly.geras.Highlighter.prototype.drawValueInput=function(a){var c,b=a.getLastInput();this.RTL_?(c=a.height-b.connectionHeight,this.steps_+=Blockly.utils.svgPaths.moveTo(b.xPos+b.width-this.highlightOffset_,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+Blockly.utils.svgPaths.lineOnAxis("v",c)):this.steps_+=Blockly.utils.svgPaths.moveTo(b.xPos+b.width,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)},Blockly.geras.Highlighter.prototype.drawStatementInput=function(a){var c,b=a.getLastInput();this.RTL_?(c=a.height-2*this.insideCornerPaths_.height,this.steps_+=Blockly.utils.svgPaths.moveTo(b.xPos,a.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+Blockly.utils.svgPaths.lineOnAxis("v",c)+this.insideCornerPaths_.pathBottom(this.RTL_)+Blockly.utils.svgPaths.lineTo(a.width-b.xPos-this.insideCornerPaths_.width,0)):this.steps_+=Blockly.utils.svgPaths.moveTo(b.xPos,a.yPos+a.height)+this.insideCornerPaths_.pathBottom(this.RTL_)+Blockly.utils.svgPaths.lineTo(a.width-b.xPos-this.insideCornerPaths_.width,0)},Blockly.geras.Highlighter.prototype.drawRightSideRow=function(a){var b=a.xPos+a.width-this.highlightOffset_;a.followsStatement&&(this.steps_+=Blockly.utils.svgPaths.lineOnAxis("H",b)),this.RTL_&&(this.steps_+=Blockly.utils.svgPaths.lineOnAxis("H",b),a.height>this.highlightOffset_&&(this.steps_+=Blockly.utils.svgPaths.lineOnAxis("V",a.yPos+a.height-this.highlightOffset_)))},Blockly.geras.Highlighter.prototype.drawBottomRow=function(a){var b;this.RTL_?this.steps_+=Blockly.utils.svgPaths.lineOnAxis("V",a.baseline-this.highlightOffset_):(b=this.info_.bottomRow.elements[0],Blockly.blockRendering.Types.isLeftSquareCorner(b)?this.steps_+=Blockly.utils.svgPaths.moveTo(a.xPos+this.highlightOffset_,a.baseline-this.highlightOffset_):Blockly.blockRendering.Types.isLeftRoundedCorner(b)&&(this.steps_+=Blockly.utils.svgPaths.moveTo(a.xPos,a.baseline),this.steps_+=this.outsideCornerPaths_.bottomLeft()))},Blockly.geras.Highlighter.prototype.drawLeft=function(){var a=this.info_.outputConnection;a&&(a=a.connectionOffsetY+a.height,this.RTL_?this.steps_+=Blockly.utils.svgPaths.moveTo(this.info_.startX,a):(this.steps_+=Blockly.utils.svgPaths.moveTo(this.info_.startX+this.highlightOffset_,this.info_.bottomRow.baseline-this.highlightOffset_),this.steps_+=Blockly.utils.svgPaths.lineOnAxis("V",a)),this.steps_+=this.puzzleTabPaths_.pathUp(this.RTL_)),this.RTL_||(a=this.info_.topRow,Blockly.blockRendering.Types.isLeftRoundedCorner(a.elements[0])?this.steps_+=Blockly.utils.svgPaths.lineOnAxis("V",this.outsideCornerPaths_.height):this.steps_+=Blockly.utils.svgPaths.lineOnAxis("V",a.capline+this.highlightOffset_))},Blockly.geras.Highlighter.prototype.drawInlineInput=function(a){var b=this.highlightOffset_,c=a.xPos+a.connectionWidth,d=a.centerline-a.height/2,e=a.width-a.connectionWidth,f=d+b;this.RTL_?(d=a.connectionOffsetY-b,a=a.height-(a.connectionOffsetY+a.connectionHeight)+b,this.inlineSteps_+=Blockly.utils.svgPaths.moveTo(c-b,f)+Blockly.utils.svgPaths.lineOnAxis("v",d)+this.puzzleTabPaths_.pathDown(this.RTL_)+Blockly.utils.svgPaths.lineOnAxis("v",a)+Blockly.utils.svgPaths.lineOnAxis("h",e)):this.inlineSteps_+=Blockly.utils.svgPaths.moveTo(a.xPos+a.width+b,f)+Blockly.utils.svgPaths.lineOnAxis("v",a.height)+Blockly.utils.svgPaths.lineOnAxis("h",-e)+Blockly.utils.svgPaths.moveTo(c,d+a.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_)},Blockly.geras.InlineInput=function(a,b){Blockly.geras.InlineInput.superClass_.constructor.call(this,a,b),this.connectedBlock&&(this.width+=this.constants_.DARK_PATH_OFFSET,this.height+=this.constants_.DARK_PATH_OFFSET)},Blockly.utils.object.inherits(Blockly.geras.InlineInput,Blockly.blockRendering.InlineInput),Blockly.geras.StatementInput=function(a,b){Blockly.geras.StatementInput.superClass_.constructor.call(this,a,b),this.connectedBlock&&(this.height+=this.constants_.DARK_PATH_OFFSET)},Blockly.utils.object.inherits(Blockly.geras.StatementInput,Blockly.blockRendering.StatementInput),Blockly.geras.RenderInfo=function(a,b){Blockly.geras.RenderInfo.superClass_.constructor.call(this,a,b)},Blockly.utils.object.inherits(Blockly.geras.RenderInfo,Blockly.blockRendering.RenderInfo),Blockly.geras.RenderInfo.prototype.getRenderer=function(){return this.renderer_},Blockly.geras.RenderInfo.prototype.populateBottomRow_=function(){Blockly.geras.RenderInfo.superClass_.populateBottomRow_.call(this),this.block_.inputList.length&&this.block_.inputList[this.block_.inputList.length-1].type==Blockly.inputTypes.STATEMENT||(this.bottomRow.minHeight=this.constants_.MEDIUM_PADDING-this.constants_.DARK_PATH_OFFSET)},Blockly.geras.RenderInfo.prototype.addInput_=function(a,b){this.isInline&&a.type==Blockly.inputTypes.VALUE?(b.elements.push(new Blockly.geras.InlineInput(this.constants_,a)),b.hasInlineInput=!0):a.type==Blockly.inputTypes.STATEMENT?(b.elements.push(new Blockly.geras.StatementInput(this.constants_,a)),b.hasStatement=!0):a.type==Blockly.inputTypes.VALUE?(b.elements.push(new Blockly.blockRendering.ExternalValueInput(this.constants_,a)),b.hasExternalInput=!0):a.type==Blockly.inputTypes.DUMMY&&(b.minHeight=Math.max(b.minHeight,this.constants_.DUMMY_INPUT_MIN_HEIGHT),b.hasDummyInput=!0),this.isInline||null!=b.align||(b.align=a.align)},Blockly.geras.RenderInfo.prototype.addElemSpacing_=function(){for(var c,a=!1,b=0;c=this.rows[b];b++)c.hasExternalInput&&(a=!0);for(b=0;c=this.rows[b];b++){var d=c.elements;if(c.elements=[],c.startsWithElemSpacer()&&c.elements.push(new Blockly.blockRendering.InRowSpacer(this.constants_,this.getInRowSpacing_(null,d[0]))),d.length){for(var e=0;erect:not(.blocklyDropdownRect),",a+" .blocklyEditableText>rect:not(.blocklyDropdownRect) {","fill: "+this.FIELD_BORDER_RECT_COLOUR+";","}",a+" .blocklyNonEditableText>text,",a+" .blocklyEditableText>text,",a+" .blocklyNonEditableText>g>text,",a+" .blocklyEditableText>g>text {","fill: #575E75;","}",a+" .blocklyFlyoutLabelText {","fill: #575E75;","}",a+" .blocklyText.blocklyBubbleText {","fill: #575E75;","}",a+" .blocklyDraggable:not(.blocklyDisabled)"," .blocklyEditableText:not(.editing):hover>rect,",a+" .blocklyDraggable:not(.blocklyDisabled)"," .blocklyEditableText:not(.editing):hover>.blocklyPath {","stroke: #fff;","stroke-width: 2;","}",a+" .blocklyHtmlInput {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","font-weight: "+this.FIELD_TEXT_FONTWEIGHT+";","color: #575E75;","}",a+" .blocklyDropdownText {","fill: #fff !important;","}",a+".blocklyWidgetDiv .goog-menuitem,",a+".blocklyDropDownDiv .goog-menuitem {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","}",a+".blocklyDropDownDiv .goog-menuitem-content {","color: #fff;","}",a+" .blocklyHighlightedConnectionPath {","stroke: "+this.SELECTED_GLOW_COLOUR+";","}",a+" .blocklyDisabled > .blocklyOutlinePath {","fill: url(#blocklyDisabledPattern"+this.randomIdentifier+")","}",a+" .blocklyInsertionMarker>.blocklyPath {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none;","}"]},Blockly.zelos.TopRow=function(a){Blockly.zelos.TopRow.superClass_.constructor.call(this,a)},Blockly.utils.object.inherits(Blockly.zelos.TopRow,Blockly.blockRendering.TopRow),Blockly.zelos.TopRow.prototype.endsWithElemSpacer=function(){return!1},Blockly.zelos.TopRow.prototype.hasLeftSquareCorner=function(a){var b=(a.hat?"cap"===a.hat:this.constants_.ADD_START_HATS)&&!a.outputConnection&&!a.previousConnection;return!!a.outputConnection||b},Blockly.zelos.TopRow.prototype.hasRightSquareCorner=function(a){return!!a.outputConnection&&!a.statementInputCount&&!a.nextConnection},Blockly.zelos.BottomRow=function(a){Blockly.zelos.BottomRow.superClass_.constructor.call(this,a)},Blockly.utils.object.inherits(Blockly.zelos.BottomRow,Blockly.blockRendering.BottomRow),Blockly.zelos.BottomRow.prototype.endsWithElemSpacer=function(){return!1},Blockly.zelos.BottomRow.prototype.hasLeftSquareCorner=function(a){return!!a.outputConnection},Blockly.zelos.BottomRow.prototype.hasRightSquareCorner=function(a){return!!a.outputConnection&&!a.statementInputCount&&!a.nextConnection},Blockly.zelos.RightConnectionShape=function(a){Blockly.zelos.RightConnectionShape.superClass_.constructor.call(this,a),this.type|=Blockly.blockRendering.Types.getType("RIGHT_CONNECTION"),this.width=this.height=0},Blockly.utils.object.inherits(Blockly.zelos.RightConnectionShape,Blockly.blockRendering.Measurable),Blockly.zelos.RenderInfo=function(a,b){Blockly.zelos.RenderInfo.superClass_.constructor.call(this,a,b),this.topRow=new Blockly.zelos.TopRow(this.constants_),this.bottomRow=new Blockly.zelos.BottomRow(this.constants_),this.isInline=!0,this.isMultiRow=!b.getInputsInline()||b.isCollapsed(),this.hasStatementInput=0=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!f.precedesStatement,Blockly.blockRendering.Types.isInputRow(e)&&e.hasStatement)e.measure(),b=e.width-e.getLastInput().width+a;else if(d&&(2==c||f)&&Blockly.blockRendering.Types.isInputRow(e)&&!e.hasStatement)for(var h,f=e.xPos,d=null,g=0;h=e.elements[g];g++)!((d=Blockly.blockRendering.Types.isSpacer(h)?h:d)&&(Blockly.blockRendering.Types.isField(h)||Blockly.blockRendering.Types.isInput(h))&&fc?c:this.height/2)*(1-Math.sin(Math.acos((c-this.constants_.SMALL_PADDING)/c))));if(Blockly.blockRendering.Types.isInlineInput(a)){var e=a.connectedBlock;return a=e?e.pathObject.outputShapeType:a.shape.type,e&&e.outputConnection&&(e.statementInputCount||e.nextConnection)||c==d.SHAPES.HEXAGONAL&&c!=a?0:b-this.constants_.SHAPE_IN_SHAPE_PADDING[c][a]}return Blockly.blockRendering.Types.isField(a)?c==d.SHAPES.ROUND&&a.field instanceof Blockly.FieldTextInput?b-2.75*d.GRID_UNIT:b-this.constants_.SHAPE_IN_SHAPE_PADDING[c][0]:Blockly.blockRendering.Types.isIcon(a)?this.constants_.SMALL_PADDING:0},Blockly.zelos.RenderInfo.prototype.finalizeVerticalAlignment_=function(){if(!this.outputConnection)for(var a=2;a=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!d.precedesStatement;if(e?this.topRow.hasPreviousConnection:b.followsStatement){var g=3==c.elements.length&&(c.elements[1].field instanceof Blockly.FieldLabel||c.elements[1].field instanceof Blockly.FieldImage);if(!e&&g)b.height-=this.constants_.SMALL_PADDING,d.height-=this.constants_.SMALL_PADDING,c.height-=this.constants_.MEDIUM_PADDING;else if(e||f){if(f){for(e=!1,f=0;g=c.elements[f];f++)if(Blockly.blockRendering.Types.isInlineInput(g)&&g.connectedBlock&&!g.connectedBlock.isShadow()&&40<=g.connectedBlock.getHeightWidth().height){e=!0;break}e&&(b.height-=this.constants_.SMALL_PADDING,d.height-=this.constants_.SMALL_PADDING)}}else b.height+=this.constants_.SMALL_PADDING}}},Blockly.zelos.RenderInfo.prototype.finalize_=function(){this.finalizeOutputConnection_(),this.finalizeHorizontalAlignment_(),this.finalizeVerticalAlignment_(),Blockly.zelos.RenderInfo.superClass_.finalize_.call(this),this.rightSide&&(this.widthWithChildren+=this.rightSide.width)},Blockly.zelos.Drawer=function(a,b){Blockly.zelos.Drawer.superClass_.constructor.call(this,a,b)},Blockly.utils.object.inherits(Blockly.zelos.Drawer,Blockly.blockRendering.Drawer),Blockly.zelos.Drawer.prototype.draw=function(){var a=this.block_.pathObject;a.beginDrawing(),this.hideHiddenIcons_(),this.drawOutline_(),this.drawInternals_(),a.setPath(this.outlinePath_+"\n"+this.inlinePath_),this.info_.RTL&&a.flipRTL(),Blockly.blockRendering.useDebugger&&this.block_.renderingDebugger.drawDebug(this.block_,this.info_),this.recordSizeOnBlock_(),this.info_.outputConnection&&(a.outputShapeType=this.info_.outputConnection.shape.type),a.endDrawing()},Blockly.zelos.Drawer.prototype.drawOutline_=function(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape&&!this.info_.hasStatementInput&&!this.info_.bottomRow.hasNextConnection?(this.drawFlatTop_(),this.drawRightDynamicConnection_(),this.drawFlatBottom_(),this.drawLeftDynamicConnection_()):Blockly.zelos.Drawer.superClass_.drawOutline_.call(this)},Blockly.zelos.Drawer.prototype.drawLeft_=function(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape?this.drawLeftDynamicConnection_():Blockly.zelos.Drawer.superClass_.drawLeft_.call(this)},Blockly.zelos.Drawer.prototype.drawRightSideRow_=function(a){var b;a.height<=0||(a.precedesStatement||a.followsStatement?(b=this.constants_.INSIDE_CORNERS.rightHeight,b=a.height-(a.precedesStatement?b:0),this.outlinePath_+=(a.followsStatement?this.constants_.INSIDE_CORNERS.pathBottomRight:"")+(0","GT"],["‏≥","GTE"]]},{type:"input_value",name:"B"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",check:"Boolean"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},{type:"logic_negate",message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",check:"Boolean"}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value",name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",extensions:["logic_ternary"]}]),Blockly.defineBlocksWithJsonArray([{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",previousStatement:null,nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]),Blockly.Constants.Logic.TOOLTIPS_BY_OP={EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"},Blockly.Extensions.register("logic_op_tooltip",Blockly.Extensions.buildTooltipForDropdown("OP",Blockly.Constants.Logic.TOOLTIPS_BY_OP)),Blockly.Constants.Logic.CONTROLS_IF_MUTATOR_MIXIN={elseifCount_:0,elseCount_:0,suppressPrefixSuffix:!0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var a=Blockly.utils.xml.createElement("mutation");return this.elseifCount_&&a.setAttribute("elseif",this.elseifCount_),this.elseCount_&&a.setAttribute("else",1),a},domToMutation:function(a){this.elseifCount_=parseInt(a.getAttribute("elseif"),10)||0,this.elseCount_=parseInt(a.getAttribute("else"),10)||0,this.rebuildShape_()},decompose:function(a){var b=a.newBlock("controls_if_if");b.initSvg();for(var c=b.nextConnection,d=1;d<=this.elseifCount_;d++){var e=a.newBlock("controls_if_elseif");e.initSvg(),c.connect(e.previousConnection),c=e.nextConnection}return this.elseCount_&&((a=a.newBlock("controls_if_else")).initSvg(),c.connect(a.previousConnection)),b},compose:function(a){a=a.nextConnection.targetBlock(),this.elseCount_=this.elseifCount_=0;for(var b=[null],c=[null],d=null;a&&!a.isInsertionMarker();){switch(a.type){case"controls_if_elseif":this.elseifCount_++,b.push(a.valueConnection_),c.push(a.statementConnection_);break;case"controls_if_else":this.elseCount_++,d=a.statementConnection_;break;default:throw TypeError("Unknown block type: "+a.type)}a=a.nextConnection&&a.nextConnection.targetBlock()}this.updateShape_(),this.reconnectChildBlocks_(b,c,d)},saveConnections:function(a){a=a.nextConnection.targetBlock();for(var b=1;a;){switch(a.type){case"controls_if_elseif":var c=this.getInput("IF"+b),d=this.getInput("DO"+b);a.valueConnection_=c&&c.connection.targetConnection,a.statementConnection_=d&&d.connection.targetConnection,b++;break;case"controls_if_else":d=this.getInput("ELSE"),a.statementConnection_=d&&d.connection.targetConnection;break;default:throw TypeError("Unknown block type: "+a.type)}a=a.nextConnection&&a.nextConnection.targetBlock()}},rebuildShape_:function(){var a=[null],b=[null],c=null;this.getInput("ELSE")&&(c=this.getInput("ELSE").connection.targetConnection);for(var d=1;this.getInput("IF"+d);){var e=this.getInput("IF"+d),f=this.getInput("DO"+d);a.push(e.connection.targetConnection),b.push(f.connection.targetConnection),d++}this.updateShape_(),this.reconnectChildBlocks_(a,b,c)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var a=1;this.getInput("IF"+a);)this.removeInput("IF"+a),this.removeInput("DO"+a),a++;for(a=1;a<=this.elseifCount_;a++)this.appendValueInput("IF"+a).setCheck("Boolean").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+a).appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE)},reconnectChildBlocks_:function(a,b,c){for(var d=1;d<=this.elseifCount_;d++)Blockly.Mutator.reconnect(a[d],this,"IF"+d),Blockly.Mutator.reconnect(b[d],this,"DO"+d);Blockly.Mutator.reconnect(c,this,"ELSE")}},Blockly.Extensions.registerMutator("controls_if_mutator",Blockly.Constants.Logic.CONTROLS_IF_MUTATOR_MIXIN,null,["controls_if_elseif","controls_if_else"]),Blockly.Constants.Logic.CONTROLS_IF_TOOLTIP_EXTENSION=function(){this.setTooltip(function(){return this.elseifCount_||this.elseCount_?!this.elseifCount_&&this.elseCount_?Blockly.Msg.CONTROLS_IF_TOOLTIP_2:this.elseifCount_&&!this.elseCount_?Blockly.Msg.CONTROLS_IF_TOOLTIP_3:this.elseifCount_&&this.elseCount_?Blockly.Msg.CONTROLS_IF_TOOLTIP_4:"":Blockly.Msg.CONTROLS_IF_TOOLTIP_1}.bind(this))},Blockly.Extensions.register("controls_if_tooltip",Blockly.Constants.Logic.CONTROLS_IF_TOOLTIP_EXTENSION),Blockly.Constants.Logic.LOGIC_COMPARE_ONCHANGE_MIXIN={onchange:function(a){this.prevBlocks_||(this.prevBlocks_=[null,null]);var b=this.getInputTargetBlock("A"),c=this.getInputTargetBlock("B");b&&c&&!this.workspace.connectionChecker.doTypeChecks(b.outputConnection,c.outputConnection)&&(Blockly.Events.setGroup(a.group),(a=this.prevBlocks_[0])!==b&&(b.unplug(),!a||a.isDisposed()||a.isShadow()||this.getInput("A").connection.connect(a.outputConnection)),(b=this.prevBlocks_[1])!==c&&(c.unplug(),!b||b.isDisposed()||b.isShadow()||this.getInput("B").connection.connect(b.outputConnection)),this.bumpNeighbours(),Blockly.Events.setGroup(!1)),this.prevBlocks_[0]=this.getInputTargetBlock("A"),this.prevBlocks_[1]=this.getInputTargetBlock("B")}},Blockly.Constants.Logic.LOGIC_COMPARE_EXTENSION=function(){this.mixin(Blockly.Constants.Logic.LOGIC_COMPARE_ONCHANGE_MIXIN)},Blockly.Extensions.register("logic_compare",Blockly.Constants.Logic.LOGIC_COMPARE_EXTENSION),Blockly.Constants.Logic.LOGIC_TERNARY_ONCHANGE_MIXIN={prevParentConnection_:null,onchange:function(a){var b=this.getInputTargetBlock("THEN"),c=this.getInputTargetBlock("ELSE"),d=this.outputConnection.targetConnection;if((b||c)&&d)for(var e=0;e<2;e++){var f=1==e?b:c;f&&!f.workspace.connectionChecker.doTypeChecks(f.outputConnection,d)&&(Blockly.Events.setGroup(a.group),d===this.prevParentConnection_?(this.unplug(),d.getSourceBlock().bumpNeighbours()):(f.unplug(),f.bumpNeighbours()),Blockly.Events.setGroup(!1))}this.prevParentConnection_=d}},Blockly.Extensions.registerMixin("logic_ternary",Blockly.Constants.Logic.LOGIC_TERNARY_ONCHANGE_MIXIN),Blockly.Blocks.loops={},Blockly.Constants.Loops={},Blockly.Constants.Loops.HUE=120,Blockly.defineBlocksWithJsonArray([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",name:"TIMES",value:10,min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}","UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_for_tooltip"]},{type:"controls_forEach",message0:"%{BKY_CONTROLS_FOREACH_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"LIST",check:"Array"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",extensions:["controls_flow_tooltip","controls_flow_in_loop_check"]}]),Blockly.Constants.Loops.WHILE_UNTIL_TOOLTIPS={WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"},Blockly.Extensions.register("controls_whileUntil_tooltip",Blockly.Extensions.buildTooltipForDropdown("MODE",Blockly.Constants.Loops.WHILE_UNTIL_TOOLTIPS)),Blockly.Constants.Loops.BREAK_CONTINUE_TOOLTIPS={BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"},Blockly.Extensions.register("controls_flow_tooltip",Blockly.Extensions.buildTooltipForDropdown("FLOW",Blockly.Constants.Loops.BREAK_CONTINUE_TOOLTIPS)),Blockly.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN={customContextMenu:function(a){var b,c,d;this.isInFlyout||(c=(b=this.getField("VAR").getVariable()).name,this.isCollapsed()||null==c||((d={enabled:!0}).text=Blockly.Msg.VARIABLES_SET_CREATE_GET.replace("%1",c),b=Blockly.Variables.generateVariableFieldDom(b),(c=Blockly.utils.xml.createElement("block")).setAttribute("type","variables_get"),c.appendChild(b),d.callback=Blockly.ContextMenu.callbackFactory(this,c),a.push(d)))}},Blockly.Extensions.registerMixin("contextMenu_newGetVariableBlock",Blockly.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN),Blockly.Extensions.register("controls_for_tooltip",Blockly.Extensions.buildTooltipWithFieldText("%{BKY_CONTROLS_FOR_TOOLTIP}","VAR")),Blockly.Extensions.register("controls_forEach_tooltip",Blockly.Extensions.buildTooltipWithFieldText("%{BKY_CONTROLS_FOREACH_TOOLTIP}","VAR")),Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN={LOOP_TYPES:["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"],suppressPrefixSuffix:!0,getSurroundLoop:function(a){do{if(-1!=Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.LOOP_TYPES.indexOf(a.type))return a}while(a=a.getSurroundParent());return null},onchange:function(a){var b,c;this.workspace.isDragging&&!this.workspace.isDragging()&&a.type==Blockly.Events.BLOCK_MOVE&&(b=Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.getSurroundLoop(this),this.setWarningText(b?null:Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING),this.isInFlyout||(c=Blockly.Events.getGroup(),Blockly.Events.setGroup(a.group),this.setEnabled(b),Blockly.Events.setGroup(c)))}},Blockly.Extensions.registerMixin("controls_flow_in_loop_check",Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN),Blockly.Blocks.math={},Blockly.Constants.Math={},Blockly.Constants.Math.HUE=230,Blockly.defineBlocksWithJsonArray([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD"],["%{BKY_MATH_SUBTRACTION_SYMBOL}","MINUS"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}","MULTIPLY"],["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE"],["%{BKY_MATH_POWER_SYMBOL}","POWER"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}","ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN"],["%{BKY_MATH_TRIG_COS}","COS"],["%{BKY_MATH_TRIG_TAN}","TAN"],["%{BKY_MATH_TRIG_ASIN}","ASIN"],["%{BKY_MATH_TRIG_ACOS}","ACOS"],["%{BKY_MATH_TRIG_ATAN}","ATAN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_TRIG_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_constant",message0:"%1",args0:[{type:"field_dropdown",name:"CONSTANT",options:[["π","PI"],["e","E"],["φ","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(½)","SQRT1_2"],["∞","INFINITY"]]}],output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTANT_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTANT_HELPURL}"},{type:"math_number_property",message0:"%1 %2",args0:[{type:"input_value",name:"NUMBER_TO_CHECK",check:"Number"},{type:"field_dropdown",name:"PROPERTY",options:[["%{BKY_MATH_IS_EVEN}","EVEN"],["%{BKY_MATH_IS_ODD}","ODD"],["%{BKY_MATH_IS_PRIME}","PRIME"],["%{BKY_MATH_IS_WHOLE}","WHOLE"],["%{BKY_MATH_IS_POSITIVE}","POSITIVE"],["%{BKY_MATH_IS_NEGATIVE}","NEGATIVE"],["%{BKY_MATH_IS_DIVISIBLE_BY}","DIVISIBLE_BY"]]}],inputsInline:!0,output:"Boolean",style:"math_blocks",tooltip:"%{BKY_MATH_IS_TOOLTIP}",mutator:"math_is_divisibleby_mutator"},{type:"math_change",message0:"%{BKY_MATH_CHANGE_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_MATH_CHANGE_TITLE_ITEM}"},{type:"input_value",name:"DELTA",check:"Number"}],previousStatement:null,nextStatement:null,style:"variable_blocks",helpUrl:"%{BKY_MATH_CHANGE_HELPURL}",extensions:["math_change_tooltip"]},{type:"math_round",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ROUND_OPERATOR_ROUND}","ROUND"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDUP}","ROUNDUP"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDDOWN}","ROUNDDOWN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ROUND_HELPURL}",tooltip:"%{BKY_MATH_ROUND_TOOLTIP}"},{type:"math_on_list",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ONLIST_OPERATOR_SUM}","SUM"],["%{BKY_MATH_ONLIST_OPERATOR_MIN}","MIN"],["%{BKY_MATH_ONLIST_OPERATOR_MAX}","MAX"],["%{BKY_MATH_ONLIST_OPERATOR_AVERAGE}","AVERAGE"],["%{BKY_MATH_ONLIST_OPERATOR_MEDIAN}","MEDIAN"],["%{BKY_MATH_ONLIST_OPERATOR_MODE}","MODE"],["%{BKY_MATH_ONLIST_OPERATOR_STD_DEV}","STD_DEV"],["%{BKY_MATH_ONLIST_OPERATOR_RANDOM}","RANDOM"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ONLIST_HELPURL}",mutator:"math_modes_of_list_mutator",extensions:["math_op_tooltip"]},{type:"math_modulo",message0:"%{BKY_MATH_MODULO_TITLE}",args0:[{type:"input_value",name:"DIVIDEND",check:"Number"},{type:"input_value",name:"DIVISOR",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_MODULO_TOOLTIP}",helpUrl:"%{BKY_MATH_MODULO_HELPURL}"},{type:"math_constrain",message0:"%{BKY_MATH_CONSTRAIN_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"Number"},{type:"input_value",name:"LOW",check:"Number"},{type:"input_value",name:"HIGH",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTRAIN_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTRAIN_HELPURL}"},{type:"math_random_int",message0:"%{BKY_MATH_RANDOM_INT_TITLE}",args0:[{type:"input_value",name:"FROM",check:"Number"},{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_INT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_INT_HELPURL}"},{type:"math_random_float",message0:"%{BKY_MATH_RANDOM_FLOAT_TITLE_RANDOM}",output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_FLOAT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_FLOAT_HELPURL}"},{type:"math_atan2",message0:"%{BKY_MATH_ATAN2_TITLE}",args0:[{type:"input_value",name:"X",check:"Number"},{type:"input_value",name:"Y",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_ATAN2_TOOLTIP}",helpUrl:"%{BKY_MATH_ATAN2_HELPURL}"}]),Blockly.Constants.Math.TOOLTIPS_BY_OP={ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}",MULTIPLY:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}",DIVIDE:"%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}",POWER:"%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}",ROOT:"%{BKY_MATH_SINGLE_TOOLTIP_ROOT}",ABS:"%{BKY_MATH_SINGLE_TOOLTIP_ABS}",NEG:"%{BKY_MATH_SINGLE_TOOLTIP_NEG}",LN:"%{BKY_MATH_SINGLE_TOOLTIP_LN}",LOG10:"%{BKY_MATH_SINGLE_TOOLTIP_LOG10}",EXP:"%{BKY_MATH_SINGLE_TOOLTIP_EXP}",POW10:"%{BKY_MATH_SINGLE_TOOLTIP_POW10}",SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"},Blockly.Extensions.register("math_op_tooltip",Blockly.Extensions.buildTooltipForDropdown("OP",Blockly.Constants.Math.TOOLTIPS_BY_OP)),Blockly.Constants.Math.IS_DIVISIBLEBY_MUTATOR_MIXIN={mutationToDom:function(){var a=Blockly.utils.xml.createElement("mutation"),b="DIVISIBLE_BY"==this.getFieldValue("PROPERTY");return a.setAttribute("divisor_input",b),a},domToMutation:function(a){a="true"==a.getAttribute("divisor_input"),this.updateShape_(a)},updateShape_:function(a){var b=this.getInput("DIVISOR");a?b||this.appendValueInput("DIVISOR").setCheck("Number"):b&&this.removeInput("DIVISOR")}},Blockly.Constants.Math.IS_DIVISIBLE_MUTATOR_EXTENSION=function(){this.getField("PROPERTY").setValidator(function(a){a="DIVISIBLE_BY"==a,this.getSourceBlock().updateShape_(a)})},Blockly.Extensions.registerMutator("math_is_divisibleby_mutator",Blockly.Constants.Math.IS_DIVISIBLEBY_MUTATOR_MIXIN,Blockly.Constants.Math.IS_DIVISIBLE_MUTATOR_EXTENSION),Blockly.Extensions.register("math_change_tooltip",Blockly.Extensions.buildTooltipWithFieldText("%{BKY_MATH_CHANGE_TOOLTIP}","VAR")),Blockly.Constants.Math.LIST_MODES_MUTATOR_MIXIN={updateType_:function(a){"MODE"==a?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){var a=Blockly.utils.xml.createElement("mutation");return a.setAttribute("op",this.getFieldValue("OP")),a},domToMutation:function(a){this.updateType_(a.getAttribute("op"))}},Blockly.Constants.Math.LIST_MODES_MUTATOR_EXTENSION=function(){this.getField("OP").setValidator(function(a){this.updateType_(a)}.bind(this))},Blockly.Extensions.registerMutator("math_modes_of_list_mutator",Blockly.Constants.Math.LIST_MODES_MUTATOR_MIXIN,Blockly.Constants.Math.LIST_MODES_MUTATOR_EXTENSION),Blockly.Blocks.procedures={},Blockly.Blocks.procedures_defnoreturn={init:function(){var a=Blockly.Procedures.findLegalName("",this);(a=new Blockly.FieldTextInput(a,Blockly.Procedures.rename)).setSpellcheck(!1),this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE).appendField(a,"NAME").appendField("","PARAMS"),this.setMutator(new Blockly.Mutator(["procedures_mutatorarg"])),(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText(Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT),this.setStyle("procedure_blocks"),this.setTooltip(Blockly.Msg.PROCEDURES_DEFNORETURN_TOOLTIP),this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.setStatements_(!0),this.statementConnection_=null},setStatements_:function(a){this.hasStatements_!==a&&(a?(this.appendStatementInput("STACK").appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=a)},updateParams_:function(){var a="";this.arguments_.length&&(a=Blockly.Msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", ")),Blockly.Events.disable();try{this.setFieldValue(a,"PARAMS")}finally{Blockly.Events.enable()}},mutationToDom:function(a){var b=Blockly.utils.xml.createElement("mutation");a&&b.setAttribute("name",this.getFieldValue("NAME"));for(var c=0;c b.toString() ? 1 : -1; },",' "IGNORE_CASE": function(a, b) {'," return a.toString().toLowerCase() > b.toString().toLowerCase() ? 1 : -1; },"," };"," var compare = compareFuncs[type];"," return function(a, b) { return compare(a, b) * direction; }","}"])+'("'+a+'", '+c+"))",Blockly.JavaScript.ORDER_FUNCTION_CALL]},Blockly.JavaScript.lists_split=function(a){var b=Blockly.JavaScript.valueToCode(a,"INPUT",Blockly.JavaScript.ORDER_MEMBER),c=Blockly.JavaScript.valueToCode(a,"DELIM",Blockly.JavaScript.ORDER_NONE)||"''";if("SPLIT"==(a=a.getFieldValue("MODE")))b=b||"''",a="split";else{if("JOIN"!=a)throw Error("Unknown mode: "+a);b=b||"[]",a="join"}return[b+"."+a+"("+c+")",Blockly.JavaScript.ORDER_FUNCTION_CALL]},Blockly.JavaScript.lists_reverse=function(a){return[(Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_FUNCTION_CALL)||"[]")+".slice().reverse()",Blockly.JavaScript.ORDER_FUNCTION_CALL]},Blockly.JavaScript.logic={},Blockly.JavaScript.controls_if=function(a){var b=0,c="";Blockly.JavaScript.STATEMENT_PREFIX&&(c+=Blockly.JavaScript.injectId(Blockly.JavaScript.STATEMENT_PREFIX,a));do{var d=Blockly.JavaScript.valueToCode(a,"IF"+b,Blockly.JavaScript.ORDER_NONE)||"false",e=Blockly.JavaScript.statementToCode(a,"DO"+b)}while(c+=(0",GTE:">="}[a.getFieldValue("OP")],c="=="==b||"!="==b?Blockly.JavaScript.ORDER_EQUALITY:Blockly.JavaScript.ORDER_RELATIONAL;return[(Blockly.JavaScript.valueToCode(a,"A",c)||"0")+" "+b+" "+(a=Blockly.JavaScript.valueToCode(a,"B",c)||"0"),c]},Blockly.JavaScript.logic_operation=function(a){var e,b="AND"==a.getFieldValue("OP")?"&&":"||",c="&&"==b?Blockly.JavaScript.ORDER_LOGICAL_AND:Blockly.JavaScript.ORDER_LOGICAL_OR,d=Blockly.JavaScript.valueToCode(a,"A",c);return a=Blockly.JavaScript.valueToCode(a,"B",c),a=d||a?(e="&&"==b?"true":"false",d=d||e,a||e):d="false",[d+" "+b+" "+a,c]},Blockly.JavaScript.logic_negate=function(a){var b=Blockly.JavaScript.ORDER_LOGICAL_NOT;return["!"+(Blockly.JavaScript.valueToCode(a,"BOOL",b)||"true"),b]},Blockly.JavaScript.logic_boolean=function(a){return["TRUE"==a.getFieldValue("BOOL")?"true":"false",Blockly.JavaScript.ORDER_ATOMIC]},Blockly.JavaScript.logic_null=function(a){return["null",Blockly.JavaScript.ORDER_ATOMIC]},Blockly.JavaScript.logic_ternary=function(a){return[(Blockly.JavaScript.valueToCode(a,"IF",Blockly.JavaScript.ORDER_CONDITIONAL)||"false")+" ? "+(Blockly.JavaScript.valueToCode(a,"THEN",Blockly.JavaScript.ORDER_CONDITIONAL)||"null")+" : "+(a=Blockly.JavaScript.valueToCode(a,"ELSE",Blockly.JavaScript.ORDER_CONDITIONAL)||"null"),Blockly.JavaScript.ORDER_CONDITIONAL]},Blockly.JavaScript.loops={},Blockly.JavaScript.controls_repeat_ext=function(a){var b=a.getField("TIMES")?String(Number(a.getFieldValue("TIMES"))):Blockly.JavaScript.valueToCode(a,"TIMES",Blockly.JavaScript.ORDER_ASSIGNMENT)||"0",c=Blockly.JavaScript.statementToCode(a,"DO"),c=Blockly.JavaScript.addLoopTrap(c,a);a="";var d=Blockly.JavaScript.variableDB_.getDistinctName("count",Blockly.VARIABLE_CATEGORY_NAME),e=b;return b.match(/^\w+$/)||Blockly.isNumber(b)||(a+="var "+(e=Blockly.JavaScript.variableDB_.getDistinctName("repeat_end",Blockly.VARIABLE_CATEGORY_NAME))+" = "+b+";\n"),a+"for (var "+d+" = 0; "+d+" < "+e+"; "+d+"++) {\n"+c+"}\n"},Blockly.JavaScript.controls_repeat=Blockly.JavaScript.controls_repeat_ext,Blockly.JavaScript.controls_whileUntil=function(a){var b="UNTIL"==a.getFieldValue("MODE"),c=Blockly.JavaScript.valueToCode(a,"BOOL",b?Blockly.JavaScript.ORDER_LOGICAL_NOT:Blockly.JavaScript.ORDER_NONE)||"false",d=Blockly.JavaScript.statementToCode(a,"DO");return"while ("+(c=b?"!"+c:c)+") {\n"+(d=Blockly.JavaScript.addLoopTrap(d,a))+"}\n"},Blockly.JavaScript.controls_for=function(a){var g,b=Blockly.JavaScript.variableDB_.getName(a.getFieldValue("VAR"),Blockly.VARIABLE_CATEGORY_NAME),c=Blockly.JavaScript.valueToCode(a,"FROM",Blockly.JavaScript.ORDER_ASSIGNMENT)||"0",d=Blockly.JavaScript.valueToCode(a,"TO",Blockly.JavaScript.ORDER_ASSIGNMENT)||"0",e=Blockly.JavaScript.valueToCode(a,"BY",Blockly.JavaScript.ORDER_ASSIGNMENT)||"1",f=Blockly.JavaScript.statementToCode(a,"DO"),f=Blockly.JavaScript.addLoopTrap(f,a);return Blockly.isNumber(c)&&Blockly.isNumber(d)&&Blockly.isNumber(e)?(a="for ("+b+" = "+c+"; "+b+((g=Number(c)<=Number(d))?" <= ":" >= ")+d+"; "+b,a=(1==(b=Math.abs(Number(e)))?a+(g?"++":"--"):a+(g?" += ":" -= ")+b)+") {\n"+f+"}\n"):(a="",(g=c).match(/^\w+$/)||Blockly.isNumber(c)||(a+="var "+(g=Blockly.JavaScript.variableDB_.getDistinctName(b+"_start",Blockly.VARIABLE_CATEGORY_NAME))+" = "+c+";\n"),(c=d).match(/^\w+$/)||Blockly.isNumber(d)||(a+="var "+(c=Blockly.JavaScript.variableDB_.getDistinctName(b+"_end",Blockly.VARIABLE_CATEGORY_NAME))+" = "+d+";\n"),a+="var "+(d=Blockly.JavaScript.variableDB_.getDistinctName(b+"_inc",Blockly.VARIABLE_CATEGORY_NAME))+" = ",a=(a=Blockly.isNumber(e)?a+(Math.abs(e)+";\n"):a+"Math.abs("+e+");\n")+"if ("+g+" > "+c+") {\n"+(Blockly.JavaScript.INDENT+d)+" = -"+d+";\n",a+="}\n",a+="for ("+b+" = "+g+"; "+d+" >= 0 ? "+b+" <= "+c+" : "+b+" >= "+c+"; "+b+" += "+d+") {\n"+f+"}\n"),a},Blockly.JavaScript.controls_forEach=function(a){var b=Blockly.JavaScript.variableDB_.getName(a.getFieldValue("VAR"),Blockly.VARIABLE_CATEGORY_NAME),c=Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_ASSIGNMENT)||"[]",d=Blockly.JavaScript.statementToCode(a,"DO"),d=Blockly.JavaScript.addLoopTrap(d,a);a="";var e=c;return c.match(/^\w+$/)||(a+="var "+(e=Blockly.JavaScript.variableDB_.getDistinctName(b+"_list",Blockly.VARIABLE_CATEGORY_NAME))+" = "+c+";\n"),a+"for (var "+(c=Blockly.JavaScript.variableDB_.getDistinctName(b+"_index",Blockly.VARIABLE_CATEGORY_NAME))+" in "+e+") {\n"+(Blockly.JavaScript.INDENT+b+" = "+e+"["+c+"];\n"+d)+"}\n"},Blockly.JavaScript.controls_flow_statements=function(a){var c,b="";switch(Blockly.JavaScript.STATEMENT_PREFIX&&(b+=Blockly.JavaScript.injectId(Blockly.JavaScript.STATEMENT_PREFIX,a)),Blockly.JavaScript.STATEMENT_SUFFIX&&(b+=Blockly.JavaScript.injectId(Blockly.JavaScript.STATEMENT_SUFFIX,a)),!Blockly.JavaScript.STATEMENT_PREFIX||(c=Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.getSurroundLoop(a))&&!c.suppressPrefixSuffix&&(b+=Blockly.JavaScript.injectId(Blockly.JavaScript.STATEMENT_PREFIX,c)),a.getFieldValue("FLOW")){case"BREAK":return b+"break;\n";case"CONTINUE":return b+"continue;\n"}throw Error("Unknown flow statement.")},Blockly.JavaScript.math={},Blockly.JavaScript.math_number=function(a){return[a=Number(a.getFieldValue("NUM")),0<=a?Blockly.JavaScript.ORDER_ATOMIC:Blockly.JavaScript.ORDER_UNARY_NEGATION]},Blockly.JavaScript.math_arithmetic=function(a){var c=(b={ADD:[" + ",Blockly.JavaScript.ORDER_ADDITION],MINUS:[" - ",Blockly.JavaScript.ORDER_SUBTRACTION],MULTIPLY:[" * ",Blockly.JavaScript.ORDER_MULTIPLICATION],DIVIDE:[" / ",Blockly.JavaScript.ORDER_DIVISION],POWER:[null,Blockly.JavaScript.ORDER_NONE]}[a.getFieldValue("OP")])[0],b=b[1],d=Blockly.JavaScript.valueToCode(a,"A",b)||"0";return a=Blockly.JavaScript.valueToCode(a,"B",b)||"0",c?[d+c+a,b]:["Math.pow("+d+", "+a+")",Blockly.JavaScript.ORDER_FUNCTION_CALL]},Blockly.JavaScript.math_single=function(a){var b=a.getFieldValue("OP");if("NEG"==b)return["-"+(a="-"==(a=Blockly.JavaScript.valueToCode(a,"NUM",Blockly.JavaScript.ORDER_UNARY_NEGATION)||"0")[0]?" "+a:a),Blockly.JavaScript.ORDER_UNARY_NEGATION];switch(a="SIN"==b||"COS"==b||"TAN"==b?Blockly.JavaScript.valueToCode(a,"NUM",Blockly.JavaScript.ORDER_DIVISION)||"0":Blockly.JavaScript.valueToCode(a,"NUM",Blockly.JavaScript.ORDER_NONE)||"0",b){case"ABS":var c="Math.abs("+a+")";break;case"ROOT":c="Math.sqrt("+a+")";break;case"LN":c="Math.log("+a+")";break;case"EXP":c="Math.exp("+a+")";break;case"POW10":c="Math.pow(10,"+a+")";break;case"ROUND":c="Math.round("+a+")";break;case"ROUNDUP":c="Math.ceil("+a+")";break;case"ROUNDDOWN":c="Math.floor("+a+")";break;case"SIN":c="Math.sin("+a+" / 180 * Math.PI)";break;case"COS":c="Math.cos("+a+" / 180 * Math.PI)";break;case"TAN":c="Math.tan("+a+" / 180 * Math.PI)"}if(c)return[c,Blockly.JavaScript.ORDER_FUNCTION_CALL];switch(b){case"LOG10":c="Math.log("+a+") / Math.log(10)";break;case"ASIN":c="Math.asin("+a+") / Math.PI * 180";break;case"ACOS":c="Math.acos("+a+") / Math.PI * 180";break;case"ATAN":c="Math.atan("+a+") / Math.PI * 180";break;default:throw Error("Unknown math operator: "+b)}return[c,Blockly.JavaScript.ORDER_DIVISION]},Blockly.JavaScript.math_constant=function(a){return{PI:["Math.PI",Blockly.JavaScript.ORDER_MEMBER],E:["Math.E",Blockly.JavaScript.ORDER_MEMBER],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",Blockly.JavaScript.ORDER_DIVISION],SQRT2:["Math.SQRT2",Blockly.JavaScript.ORDER_MEMBER],SQRT1_2:["Math.SQRT1_2",Blockly.JavaScript.ORDER_MEMBER],INFINITY:["Infinity",Blockly.JavaScript.ORDER_ATOMIC]}[a.getFieldValue("CONSTANT")]},Blockly.JavaScript.math_number_property=function(a){var b=Blockly.JavaScript.valueToCode(a,"NUMBER_TO_CHECK",Blockly.JavaScript.ORDER_MODULUS)||"0",c=a.getFieldValue("PROPERTY");if("PRIME"==c)return[Blockly.JavaScript.provideFunction_("mathIsPrime",["function "+Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(n) {"," // https://en.wikipedia.org/wiki/Primality_test#Naive_methods"," if (n == 2 || n == 3) {"," return true;"," }"," // False if n is NaN, negative, is 1, or not whole."," // And false if n is divisible by 2 or 3."," if (isNaN(n) || n <= 1 || n % 1 != 0 || n % 2 == 0 || n % 3 == 0) {"," return false;"," }"," // Check all the numbers of form 6k +/- 1, up to sqrt(n)."," for (var x = 6; x <= Math.sqrt(n) + 1; x += 6) {"," if (n % (x - 1) == 0 || n % (x + 1) == 0) {"," return false;"," }"," }"," return true;","}"])+"("+b+")",Blockly.JavaScript.ORDER_FUNCTION_CALL];switch(c){case"EVEN":var d=b+" % 2 == 0";break;case"ODD":d=b+" % 2 == 1";break;case"WHOLE":d=b+" % 1 == 0";break;case"POSITIVE":d=b+" > 0";break;case"NEGATIVE":d=b+" < 0";break;case"DIVISIBLE_BY":d=b+" % "+(a=Blockly.JavaScript.valueToCode(a,"DIVISOR",Blockly.JavaScript.ORDER_MODULUS)||"0")+" == 0"}return[d,Blockly.JavaScript.ORDER_EQUALITY]},Blockly.JavaScript.math_change=function(a){var b=Blockly.JavaScript.valueToCode(a,"DELTA",Blockly.JavaScript.ORDER_ADDITION)||"0";return(a=Blockly.JavaScript.variableDB_.getName(a.getFieldValue("VAR"),Blockly.VARIABLE_CATEGORY_NAME))+" = (typeof "+a+" == 'number' ? "+a+" : 0) + "+b+";\n"},Blockly.JavaScript.math_round=Blockly.JavaScript.math_single,Blockly.JavaScript.math_trig=Blockly.JavaScript.math_single,Blockly.JavaScript.math_on_list=function(a){var b=a.getFieldValue("OP");switch(b){case"SUM":a=Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_MEMBER)||"[]",a+=".reduce(function(x, y) {return x + y;})";break;case"MIN":a="Math.min.apply(null, "+(a=Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_NONE)||"[]")+")";break;case"MAX":a="Math.max.apply(null, "+(a=Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_NONE)||"[]")+")";break;case"AVERAGE":a=(b=Blockly.JavaScript.provideFunction_("mathMean",["function "+Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(myList) {"," return myList.reduce(function(x, y) {return x + y;}) / myList.length;","}"]))+"("+(a=Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_NONE)||"[]")+")";break;case"MEDIAN":a=(b=Blockly.JavaScript.provideFunction_("mathMedian",["function "+Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(myList) {"," var localList = myList.filter(function (x) {return typeof x == 'number';});"," if (!localList.length) return null;"," localList.sort(function(a, b) {return b - a;});"," if (localList.length % 2 == 0) {"," return (localList[localList.length / 2 - 1] + localList[localList.length / 2]) / 2;"," } else {"," return localList[(localList.length - 1) / 2];"," }","}"]))+"("+(a=Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_NONE)||"[]")+")";break;case"MODE":a=(b=Blockly.JavaScript.provideFunction_("mathModes",["function "+Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(values) {"," var modes = [];"," var counts = [];"," var maxCount = 0;"," for (var i = 0; i < values.length; i++) {"," var value = values[i];"," var found = false;"," var thisCount;"," for (var j = 0; j < counts.length; j++) {"," if (counts[j][0] === value) {"," thisCount = ++counts[j][1];"," found = true;"," break;"," }"," }"," if (!found) {"," counts.push([value, 1]);"," thisCount = 1;"," }"," maxCount = Math.max(thisCount, maxCount);"," }"," for (var j = 0; j < counts.length; j++) {"," if (counts[j][1] == maxCount) {"," modes.push(counts[j][0]);"," }"," }"," return modes;","}"]))+"("+(a=Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_NONE)||"[]")+")";break;case"STD_DEV":a=(b=Blockly.JavaScript.provideFunction_("mathStandardDeviation",["function "+Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(numbers) {"," var n = numbers.length;"," if (!n) return null;"," var mean = numbers.reduce(function(x, y) {return x + y;}) / n;"," var variance = 0;"," for (var j = 0; j < n; j++) {"," variance += Math.pow(numbers[j] - mean, 2);"," }"," variance = variance / n;"," return Math.sqrt(variance);","}"]))+"("+(a=Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_NONE)||"[]")+")";break;case"RANDOM":a=(b=Blockly.JavaScript.provideFunction_("mathRandomList",["function "+Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(list) {"," var x = Math.floor(Math.random() * list.length);"," return list[x];","}"]))+"("+(a=Blockly.JavaScript.valueToCode(a,"LIST",Blockly.JavaScript.ORDER_NONE)||"[]")+")";break;default:throw Error("Unknown operator: "+b)}return[a,Blockly.JavaScript.ORDER_FUNCTION_CALL]},Blockly.JavaScript.math_modulo=function(a){return[(Blockly.JavaScript.valueToCode(a,"DIVIDEND",Blockly.JavaScript.ORDER_MODULUS)||"0")+" % "+(a=Blockly.JavaScript.valueToCode(a,"DIVISOR",Blockly.JavaScript.ORDER_MODULUS)||"0"),Blockly.JavaScript.ORDER_MODULUS]},Blockly.JavaScript.math_constrain=function(a){return["Math.min(Math.max("+(Blockly.JavaScript.valueToCode(a,"VALUE",Blockly.JavaScript.ORDER_NONE)||"0")+", "+(Blockly.JavaScript.valueToCode(a,"LOW",Blockly.JavaScript.ORDER_NONE)||"0")+"), "+(a=Blockly.JavaScript.valueToCode(a,"HIGH",Blockly.JavaScript.ORDER_NONE)||"Infinity")+")",Blockly.JavaScript.ORDER_FUNCTION_CALL]},Blockly.JavaScript.math_random_int=function(a){var b=Blockly.JavaScript.valueToCode(a,"FROM",Blockly.JavaScript.ORDER_NONE)||"0";return a=Blockly.JavaScript.valueToCode(a,"TO",Blockly.JavaScript.ORDER_NONE)||"0",[Blockly.JavaScript.provideFunction_("mathRandomInt",["function "+Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(a, b) {"," if (a > b) {"," // Swap a and b to ensure a is smaller."," var c = a;"," a = b;"," b = c;"," }"," return Math.floor(Math.random() * (b - a + 1) + a);","}"])+"("+b+", "+a+")",Blockly.JavaScript.ORDER_FUNCTION_CALL]},Blockly.JavaScript.math_random_float=function(a){return["Math.random()",Blockly.JavaScript.ORDER_FUNCTION_CALL]},Blockly.JavaScript.math_atan2=function(a){var b=Blockly.JavaScript.valueToCode(a,"X",Blockly.JavaScript.ORDER_NONE)||"0";return["Math.atan2("+(Blockly.JavaScript.valueToCode(a,"Y",Blockly.JavaScript.ORDER_NONE)||"0")+", "+b+") / Math.PI * 180",Blockly.JavaScript.ORDER_DIVISION]},Blockly.JavaScript.procedures={},Blockly.JavaScript.procedures_defreturn=function(a){var b=Blockly.JavaScript.variableDB_.getName(a.getFieldValue("NAME"),Blockly.PROCEDURE_CATEGORY_NAME),c="";Blockly.JavaScript.STATEMENT_PREFIX&&(c+=Blockly.JavaScript.injectId(Blockly.JavaScript.STATEMENT_PREFIX,a)),Blockly.JavaScript.STATEMENT_SUFFIX&&(c+=Blockly.JavaScript.injectId(Blockly.JavaScript.STATEMENT_SUFFIX,a));var c=c&&Blockly.JavaScript.prefixLines(c,Blockly.JavaScript.INDENT),d="";Blockly.JavaScript.INFINITE_LOOP_TRAP&&(d=Blockly.JavaScript.prefixLines(Blockly.JavaScript.injectId(Blockly.JavaScript.INFINITE_LOOP_TRAP,a),Blockly.JavaScript.INDENT));for(var e=Blockly.JavaScript.statementToCode(a,"STACK"),f=Blockly.JavaScript.valueToCode(a,"RETURN",Blockly.JavaScript.ORDER_NONE)||"",g=e&&f?c:"",f=f&&Blockly.JavaScript.INDENT+"return "+f+";\n",h=[],l=a.getVars(),k=0;k{const block=itemProcessor.call(thisArg,i);return block.next=acc,block};items.reduceRight(linearise,null)&&this.statements.set(name,items.reduceRight(linearise,null))}asDom(document){const blockElement=document.createElement("block");blockElement.setAttribute("type",`sparql11_${this.type}`);for(var[name,value]of this.values){const valueElement=document.createElement("value");valueElement.setAttribute("name",name);var valueDom=value.asDom(document);valueElement.appendChild(valueDom),blockElement.appendChild(valueElement)}for(var[name,value]of this.fields){const valueElement=document.createElement("field");valueElement.setAttribute("name",name),valueElement.textContent=value,blockElement.appendChild(valueElement)}for(var[name,statementDom]of this.statements){const statementElement=document.createElement("statement");statementElement.setAttribute("name",name),statementDom=statementDom.asDom(document),statementElement.appendChild(statementDom),blockElement.appendChild(statementElement)}if(this.next){const nextElement=document.createElement("next");var nextDom=this.next.asDom(document);nextElement.appendChild(nextDom),blockElement.appendChild(nextElement)}return blockElement}}},{}],31:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const aliases_1=require("./aliases"),SparqlJS=require("sparqljs"),Block_1=require("./Block"),StringifiedMap_1=require("./StringifiedMap"),TermSet=require("@rdfjs/term-set"),TermMap=require("@rdfjs/term-map");class BlockGenerator{constructor(){this.prefixes=new Map}visit(query){switch(query.type){case"query":return this.query(query);case"update":return this.update(query)}}query(query){const block=new Block_1.Block("query");return block.addItems("prologue",BlockGenerator.getPrologueItems(query),this.prologueItem,this),block.addValue("value",this[query.queryType.toLowerCase()](query)),query.values&&block.addValue("values",this.values(query.values)),block}select(query){const block=new Block_1.Block("selectquery");return block.addValue("select",this.selectClause(query)),block.addValue("where",this.queryCommon(query)),block}construct(query){var template=BlockGenerator.normalisePatterns([{triples:query.template,type:"bgp"}]);if(BlockGenerator.isSimpleConstruct(query)){const block=new Block_1.Block("simpleconstructquery");return block.addValue("modifiers",this.solutionModifiers(query)),block.addItems("where",[...template],this.triplesSameSubjectItem,this),query.from&&this.dataset(block,query.from),block}{const block=new Block_1.Block("constructquery");return block.addValue("where",this.queryCommon(query)),block.addItems("template",[...template],this.triplesSameSubjectItem,this),block}}describe(query){var variables=query.variables;const block=new Block_1.Block("describequery");return query.where&&block.addValue("where",this.queryCommon(query)),BlockGenerator.isWildcard(variables)?block.addField("star","*"):block.addItems("template",variables,this.varOrIriItem,this),block}ask(query){return new Block_1.Block("askquery",this.queryCommon(query))}update(query){const block=new Block_1.Block("update");return block.addItems("prologue",BlockGenerator.getPrologueItems(query),this.prologueItem,this),block.addItems("items",query.updates,this.updateItem,this),block}updateItem(update){return"type"in update?new Block_1.Block("updateitem",this.managementOperation(update)):new Block_1.Block("updateitem",this.insertDeleteOperation(update))}managementOperation(update){switch(update.type){case"clear":case"drop":return this.clearDrop(update);case"add":case"move":case"copy":return this.addMoveCopy(update);case"load":return this.load(update);case"create":return this.create(update)}}insertDeleteOperation(update){switch(update.updateType){case"insert":case"delete":case"deletewhere":return this.insertDeleteWhere(update);case"insertdelete":return this.modify(update)}}clearDrop(update){const block=new Block_1.Block("cleardrop");return block.addValue("graph",this.graphRefAll(update.graph)),block.addField("operator",update.type.toUpperCase()),update.silent&&block.addField("silent","SILENT"),block}addMoveCopy(update){const block=new Block_1.Block("addmovecopy");return block.addValue("source",this.graphRefAll(update.source)),block.addValue("destination",this.graphRefAll(update.destination)),block.addField("operator",update.type.toUpperCase()),update.silent&&block.addField("silent","SILENT"),block}load(update){const block=new Block_1.Block("load");return block.addValue("source",this.namedNode(update.source)),update.destination&&block.addValue("destination",this.graphRef(update.destination)),update.silent&&block.addField("silent","silent"),block}create(update){const block=new Block_1.Block("create");return block.addValue("graph",this.graphRef(update.graph.name)),update.silent&&block.addField("silent","silent"),block}insertDeleteWhere(update){var _a;const block=new Block_1.Block("insertdeletewhere");return block.addValue("pattern",this.quadPattern(null!==(_a=update.insert)&&void 0!==_a?_a:update.delete)),block.addField("operator",update.updateType.replace("insert","INSERT DATA").replace("deletewhere","DELETE WHERE").replace("delete","DELETE DATA")),block}quadPattern(items){const block=new Block_1.Block("quadpattern");return block.addItems("items",[...BlockGenerator.normaliseQuads(items)],this.quadPatternItem,this),block}quadPatternItem(item){return"triplesSameSubject"===item.type?new Block_1.Block("quadpatternitem",this.triplesSameSubject(item)):new Block_1.Block("quadpatternitem",this.quadsNotTriples(item))}quadsNotTriples(item){const results=[];for(var[subject,predicates]of BlockGenerator.toTriplesSameSubject(item.triples))results.push({type:"triplesSameSubject",subject:subject,predicates:predicates});const block=new Block_1.Block("quadsnottriples");return block.addValue("name",this.term(item.name)),block.addItems("triples",results,this.triplesSameSubjectItem,this),block}modify(update){const block=new Block_1.Block("modify");return update.graph&&block.addValue("iri",this.namedNode(update.graph)),update.delete.length&&block.addValue("delete",this.quadPattern(update.delete)),update.insert.length&&block.addValue("insert",this.quadPattern(update.insert)),block.addValue("where",this.group(update.where)),update.using&&this.usings(block,update.using),block}graphRefAll(graph){return graph.name?this.graphRef(graph.name):graph.all?new Block_1.Block("graphrefallall"):graph.default?new Block_1.Block("graphordefault"):graph.named?new Block_1.Block("graphrefallnamed"):void 0}graphRef(iri){return new Block_1.Block("graphref",this.namedNode(iri))}usings(block,from){var convert=(isNamed,iri)=>[isNamed,iri],namedGraphs=from.named.map(convert.bind(null,!0));const iris=from.default.map(convert.bind(null,!1));block.addItems("using",iris.concat(namedGraphs),this.using,this)}using([isNamed,iri]){return isNamed?new Block_1.Block("usingclause",this.named(iri)):new Block_1.Block("usingclause",this.namedNode(iri))}pattern(pattern){if("queryType"in pattern)return this.subSelect(pattern);switch(pattern.type){case"group":return this.group(pattern.patterns);case"values":return this.values(pattern.values);default:return this[pattern.type](pattern)}}group(normalisedPatterns){normalisedPatterns=BlockGenerator.normalisePatterns(normalisedPatterns);return 0===normalisedPatterns.size?new Block_1.Block("groupgraphpattern"):isSingle(normalisedPatterns)?new Block_1.Block("groupgraphpattern",this.pattern(first(normalisedPatterns))):1","<=",">=","in","notin","!","+","UMINUS","*","/"].includes(pattern.expression.operator)?new Block_1.Block("filter",this.bracketted(pattern.expression)):new Block_1.Block("filter",this.expression(pattern.expression))}minus(pattern){return new Block_1.Block("minusgraphpattern",this.group(pattern.patterns))}union(pattern){const block=new Block_1.Block("grouporuniongraphpattern");return block.addItems("items",pattern.patterns,this.groupItem,this),block}triplesSameSubject(pattern){const block=new Block_1.Block("triplessamesubject");return block.addValue("subject",this.term(pattern.subject)),block.addItems("predicates",[...pattern.predicates.entries()],this.propertyList,this),block}subSelect(query){const block=new Block_1.Block("subselect");return block.addValue("select",this.selectClause(query)),block.addValue("pattern",this.group(query.where)),query.values&&block.addValue("values",this.values(query.values)),block.addValue("modifiers",this.solutionModifiers(query)),block}solutionModifiers(query){if(query.group||query.having||query.order||"limit"in query||"offset"in query){const block=new Block_1.Block("solutionmodifier");return"limit"in query&&block.addValue("limit",this.numeric(query.limit.toString())),"offset"in query&&block.addValue("offset",this.numeric(query.offset.toString())),query.group&&block.addItems("group",query.group,this.groupingItem,this),query.having&&block.addItems("having",query.having,this.havingItem,this),query.order&&block.addItems("order",query.order,this.orderItem,this),block}}collection(pattern){const block=new Block_1.Block("collection");return block.addItems("items",pattern.items,this.graphNodeItem,this),block}verb(verb){return"pathType"in verb?this.path(verb):verb.value===aliases_1.RDF.type?new Block_1.Block("a"):this.term(verb)}path(path){switch(path.pathType){case"|":return this.pathAlternative(path);case"/":return this.pathSequence(path);case"^":return this.pathInverse(path);case"?":case"+":case"*":return this.pathModifier(path);case"!":return this.pathNegated(path)}}pathAlternative(path){const block=new Block_1.Block("pathalternative");return block.addItems("items",path.items,this.pathAlternativeItem,this),block}pathSequence(path){const block=new Block_1.Block("pathsequence");return block.addItems("items",path.items,this.pathSequenceItem,this),block}pathModifier(path){const block=new Block_1.Block("pathwithmodifier");var verb=first(path.items);return"pathType"in verb&&["/","|","^"].includes(verb.pathType)?block.addValue("value",this.brackettedPath(verb)):block.addValue("value",this.verb(verb)),block.addField("modifier",path.pathType),block}pathInverse(verb){const block=new Block_1.Block("inversepath");verb=first(verb.items);return"pathType"in verb&&["/","|"].includes(verb.pathType)?block.addValue("value",this.brackettedPath(verb)):block.addValue("value",this.verb(verb)),block}pathNegated(path){var verb=first(path.items);if(!("pathType"in verb))return this.verb(verb);switch(verb.pathType){case"|":return new Block_1.Block("negatedpath",this.pathOneInPropertySetAlternative(verb));case"^":return new Block_1.Block("negatedpath",this.inversePathOneInPropertySet(verb))}}inversePathOneInPropertySet(verb){return new Block_1.Block("inversepathoneinpropertyset",this.verb(first(verb.items)))}pathOneInPropertySetAlternative(verb){const block=new Block_1.Block("pathoneinpropertysetalternative");return block.addItems("items",verb.items,this.pathOneInPropertySetAlternativeItem,this),block}brackettedPath(verb){return new Block_1.Block("bracketedpath",this.verb(verb))}prefix([prefix,namespace]){return this.prefixes.set(namespace,prefix),prefix?this.prefixDecl(prefix,namespace):this.prefixDeclDefault(namespace)}prefixDecl(prefix,value){const block=new Block_1.Block("prefixdecl",this.iriref(value));return block.addField("prefix",prefix),block}prefixDeclDefault(value){return new Block_1.Block("prefixdecldefault",this.iriref(value))}base(value){return this.baseUri=value,new Block_1.Block("base",this.iriref(value))}queryCommon(query){const block=new Block_1.Block("querycommon");return block.addValue("pattern",this.group(query.where)),block.addValue("modifiers",this.solutionModifiers(query)),query.from&&this.dataset(block,query.from),block}dataset(block,from){var convert=(isNamed,iri)=>[isNamed,iri],namedGraphs=from.named.map(convert.bind(null,!0));const iris=from.default.map(convert.bind(null,!1));block.addItems("datasets",iris.concat(namedGraphs),this.from,this)}from([isNamed,iri]){return isNamed?new Block_1.Block("datasetclause",this.named(iri)):new Block_1.Block("datasetclause",this.namedNode(iri))}named(iri){return new Block_1.Block("namedgraphclause",this.namedNode(iri))}selectClause(variables){const block=new Block_1.Block("selectclause");variables.distinct&&block.addField("distinctOrReduced","DISTINCT"),variables.reduced&&block.addField("distinctOrReduced","REDUCED");variables=variables.variables;return BlockGenerator.isWildcard(variables)?block.addField("star","*"):block.addItems("vars",variables,this.varOrExpressionAsVarItem,this),block}values(rows){var variables=rows.reduce((a,b)=>Object.keys(b),[]).map(stringToVariable);const values=rows.map(Object.values);return isSingle(variables)?new Block_1.Block("inlinedata",this.inlineDataOneVar(first(variables),values.flat())):new Block_1.Block("inlinedata",this.inlineDataFull(variables,values))}inlineDataOneVar(variable,values){const block=new Block_1.Block("inlinedataonevar");return block.addValue("variable",this.variable(variable)),block.addItems("values",values.flat(),this.dataBlockValueItem,this),block}inlineDataFull(variables,values){const block=new Block_1.Block("inlinedatafull");return block.addItems("variables",variables,this.variableItem,this),block.addItems("values",values,this.dataBlockValuesItem,this),block}expressionAsVar(expression,variable){const block=new Block_1.Block("expressionasvar",this.expression(expression));return block.addValue("name",this.variable(variable)),block}descending(expression){const block=new Block_1.Block("ordercondition",this.bracketted(expression));return block.addField("operator","DESC"),block}expression(expression){return"type"in expression?this[expression.type](expression):"termType"in expression?this.term(expression):void 0}operation(expression){switch(expression.operator){case"||":case"&&":case"=":case"!=":case"<":case">":case"<=":case">=":case"+":case"-":case"*":case"/":case"!":case"UMINUS":return this.unibinary(expression);case"notin":case"in":return this.in(expression);case"bound":return this.bound(expression);case"exists":case"notexists":return this.exists(expression);case"concat":case"coalesce":return this.builtInCallN(expression);default:return this[`builtInCall${expression.args.length}`](expression)}}functionCall(expression){const block=new Block_1.Block("iriorfunction");return block.addValue("iri",this.namedNode(expression.function)),expression.distinct&&block.addField("distinct","DISTINCT"),block.addItems("args",expression.args,this.expressionListItem,this),block}aggregate(expression){switch(expression.aggregation){case"sum":case"min":case"max":case"avg":case"sample":return this.aggregateCommon(expression);default:return this[expression.aggregation](expression)}}exists(expression){const block=new Block_1.Block("exists");var arg=first(expression.args);return"group"===arg.type?block.addValue("value",this.pattern(arg)):block.addValue("value",this.group(expression.args)),block.addField("operator",expression.operator.toUpperCase().replace("NOTEXISTS","NOT EXISTS")),block}builtInCall0(expression){const block=new Block_1.Block("builtincall0");return block.addField("operator",expression.operator.toUpperCase()),block}builtInCall1(expression){const block=new Block_1.Block("builtincall1");return block.addValue("arg1",this.expression(first(expression.args))),block.addField("operator",expression.operator.toUpperCase()),block}builtInCall2(expression){const block=new Block_1.Block("builtincall2");return block.addValue("arg1",this.expression(expression.args[0])),block.addValue("arg2",this.expression(expression.args[1])),block.addField("operator",expression.operator.toUpperCase()),block}builtInCall3(expression){const block=new Block_1.Block("builtincall3");return block.addValue("arg1",this.expression(expression.args[0])),block.addValue("arg2",this.expression(expression.args[1])),block.addValue("arg3",this.expression(expression.args[2])),block.addField("operator",expression.operator.toUpperCase()),block}builtInCall4(expression){const block=new Block_1.Block("builtincall4");return block.addValue("arg1",this.expression(expression.args[0])),block.addValue("arg2",this.expression(expression.args[1])),block.addValue("arg3",this.expression(expression.args[2])),block.addValue("arg4",this.expression(expression.args[3])),block.addField("operator",expression.operator.toUpperCase()),block}builtInCallN(expression){const block=new Block_1.Block("builtincalln");return block.addField("operator",expression.operator.toUpperCase()),block.addItems("args",expression.args,this.expressionListItem,this),block}bound(expression){return new Block_1.Block("bound",this.expression(first(expression.args)))}bracketted(expression){return new Block_1.Block("brackettedexpression",this.expression(expression))}unibinary(expression,hierarchy=BlockGenerator.hierarchy){const[name,definition]=deconstruct(hierarchy);if(definition.operators.includes(expression.operator)){const block=new Block_1.Block(name);return block.addValue("left",this.bracketArgument(expression.args[0],definition)),1items.push(entry)),items}static isWildcard(variables){return variables[0]instanceof SparqlJS.Wildcard}static toTriplesSameSubject(triples){return triples.reduce((subjects,triple)=>{subjects.has(triple.subject)||subjects.set(triple.subject,new StringifiedMap_1.StringifiedMap);const subject=subjects.get(triple.subject);subject.has(triple.predicate)||subject.set(triple.predicate,new TermSet);const predicate=subject.get(triple.predicate);return predicate.add(triple.object),subjects},new TermMap)}static normalisePatterns(patterns){return Array.from(patterns).reduce((results,pattern)=>{var _a,subject,predicates;if("bgp"===pattern.type)for([subject,predicates]of this.toTriplesSameSubject(null!==(_a=pattern.triples)&&void 0!==_a?_a:[]))results.add({type:"triplesSameSubject",subject:subject,predicates:predicates});else results.add(pattern);return results},new Set)}static normaliseQuads(quads){return quads.reduce((results,pattern)=>{var subject,predicates;if("bgp"===pattern.type)for([subject,predicates]of this.toTriplesSameSubject(pattern.triples))results.add({type:"triplesSameSubject",subject:subject,predicates:predicates});else results.add(pattern);return results},new Set)}}function stringToVariable(s){return{value:s.replace("?",""),termType:null,equals:null}}function isSingle(collection){return collection instanceof Array?1===collection.length:1===collection.size}function first(collection){return collection instanceof Array?collection[0]:collection.values().next().value}function deconstruct(hierarchy){return first(Object.entries(hierarchy))}exports.default=BlockGenerator,BlockGenerator.hierarchy={unaryexpression:{operators:["UMINUS","!"],higher:{multiplicativeexpression:{operators:["*","/"],higher:{additiveexpression:{operators:["+","-"],higher:{relationalexpression:{operators:["=","!=","<",">","<=",">="],higher:{conditionalandexpression:{operators:["&&"],higher:{conditionalorexpression:{operators:["||"]}}}}}}}}}}}}},{"./Block":30,"./StringifiedMap":33,"./aliases":34,"@rdfjs/term-map":1,"@rdfjs/term-set":2,sparqljs:40}],32:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const aliases_1=require("./aliases");function codeTuple(code){return[code,aliases_1.Order.None]}function join(delimiter,...clauses){return clauses.filter(Boolean).join(delimiter)}function joinO(delimiter,...clauses){return clauses.filter(clause=>clause instanceof Array?clause[0]:clause).map(clause=>clause instanceof Array?clause[1]:clause).join(delimiter)}function prefixedName(prefix,localName){return codeTuple(`${prefix}:${localName}`)}function iriref(value=""){return codeTuple(`<${value}>`)}class CodeGenerator extends require("blockly").Generator{constructor(){super("SPARQL 1.1"),this.INDENT="",this.addCodeGeneratorProperties()}addCodeGeneratorProperties(){const toWrappedGenerator=generatorName=>block=>this[generatorName](block);Object.getOwnPropertyNames(CodeGenerator.prototype).filter(name=>name.startsWith("sparql")).map(generatorName=>[generatorName.replace("sparql","sparql11_").toLowerCase(),generatorName]).map(([propertyName,generatorName])=>[propertyName,toWrappedGenerator(generatorName)]).forEach(([propertyName,generatorFunction])=>this[propertyName]=generatorFunction)}sparqlQuery(block){return join("\n\n",this.statementToCode(block,"prologue"),join("\n",this.valueToCode(block,"value"),this.valueToCode(block,"values")))}sparqlSelectQuery(block){return codeTuple(join("\n",this.valueToCode(block,"select"),this.valueToCode(block,"where")))}sparqlDescribeQuery(where){var star=where.getFieldValue("star"),subject=this.statementToCode(where,"subject"),where=this.valueToCode(where,"where");return codeTuple(join("\n",join(" ","DECRIBE",star,subject),where))}sparqlAskQuery(block){return codeTuple(join(" ","ASK",this.valueToCode(block,"value")))}sparqlSimpleConstructquery(modifiers){var datasets=this.statementToCode(modifiers,"datasets"),where=this.statementToCode(modifiers,"where"),modifiers=this.valueToCode(modifiers,"modifiers");return codeTuple(join("\n","CONSTRUCT",datasets,join("\n","WHERE {",this.indent(where),"}"),modifiers))}sparqlConstructQuery(where){var template=this.statementToCode(where,"template"),where=this.valueToCode(where,"where");return codeTuple(join("\n",join("\n","CONSTRUCT {",this.indent(template),"}"),where))}sparqlUpdate(block){return join("\n\n",this.statementToCode(block,"prologue"),this.statementToCode(block,"items"))}sparqlLoad(destination){var source=this.valueToCode(destination,"source"),silent=destination.getFieldValue("silent"),destination=this.valueToCode(destination,"destination");return codeTuple(joinO(" ",[!0,join(" ","LOAD",silent,source)],[destination,join(" ","INTO",destination)]))}sparqlGraphRef(block){return codeTuple(join(" ","GRAPH",this.valueToCode(block,"value")))}sparqlCreate(block){return codeTuple(join(" ","CREATE",block.getFieldValue("silent"),this.valueToCode(block,"graph")))}sparqlAddMoveCopy(block){return codeTuple(join(" ",block.getFieldValue("operator"),block.getFieldValue("silent"),this.valueToCode(block,"source"),"TO",this.valueToCode(block,"destination")))}sparqlClearDrop(block){return codeTuple(join(" ",block.getFieldValue("operator"),block.getFieldValue("silent"),this.valueToCode(block,"graph")))}sparqlQuadPattern(items){items=this.statementToCode(items,"items");return codeTuple(join("\n","{",this.indent(items),"}"))}sparqlInsertDeleteWhere(block){return codeTuple(join(" ",block.getFieldValue("operator"),this.valueToCode(block,"pattern")))}sparqlModify(where){var iri=this.valueToCode(where,"iri"),deleteClause=this.valueToCode(where,"delete"),insert=this.valueToCode(where,"insert"),using=this.statementToCode(where,"using"),where=this.valueToCode(where,"where");return codeTuple(joinO("\n",[iri,join(" ","WITH",iri)],[deleteClause,join(" ","DELETE",deleteClause)],[insert,join(" ","INSERT",insert)],using,join(" ","WHERE",where)))}sparqlUsingClause(block){var code=join(" ","USING",this.valueToCode(block,"value"));return this.generateNext(block,code,"\n")}sparqlGraphOrDefault(){return codeTuple("DEFAULT")}sparqlQuadsNotTriples(triples){var name=this.valueToCode(triples,"name"),triples=this.statementToCode(triples,"triples");return codeTuple(join(" ","GRAPH",name,join("\n","{",this.indent(triples),"}")))}sparqlSelectClause(block){return codeTuple(join(" ","SELECT",block.getFieldValue("distinctOrReduced"),block.getFieldValue("star"),this.statementToCode(block,"vars")))}sparqlExpressionAsVar(block){return codeTuple(`(${this.valueToCode(block,"value")} AS ${this.valueToCode(block,"name")})`)}sparqlQueryCommon(modifiers){var datasets=this.statementToCode(modifiers,"datasets"),pattern=this.valueToCode(modifiers,"pattern"),modifiers=this.valueToCode(modifiers,"modifiers");return codeTuple(join("\n",datasets,join(" ","WHERE",pattern),modifiers))}sparqlGroupGraphPattern(value){value=this.valueToCode(value,"value");return codeTuple(join("\n","{",this.indent(value),"}"))}sparqlSubSelect(block){var select=this.valueToCode(block,"select"),pattern=this.valueToCode(block,"pattern"),values=this.valueToCode(block,"values");return codeTuple(join("\n",select,`WHERE ${pattern}`,this.valueToCode(block,"modifiers"),values))}sparqlTriplesSameSubject(_a){var subject=this.valueToCode(_a,"subject"),predicates=this.statementToCode(_a,"predicates");let code;return code=null!==(_a=_a.getInputTargetBlock("predicates"))&&void 0!==_a&&_a.getNextBlock()?join("\n",subject,this.indent(predicates)):join(" ",subject,predicates),codeTuple(code)}sparqlPropertyListNotEmpty(block){var code=join(" ",this.valueToCode(block,"predicate"),this.statementToCode(block,"objects"));return this.generateNext(block,code," ;\n")}sparqlGroupGraphPatternSub(block){return codeTuple(this.statementToCode(block,"items"))}sparqlBlankNodePropertyList(predicates){const p=predicates.getInputTargetBlock("predicates");predicates=this.blockToCode(p);let code;return code=p&&p.getNextBlock()?join("\n","[",this.indent(predicates),"]"):join(" ","[",predicates,"]"),codeTuple(code)}sparqlCollection(block){return codeTuple(join("","(",this.statementToCode(block,"items"),")"))}sparqlOptionalGraphPattern(block){return codeTuple(join(" ","OPTIONAL",this.valueToCode(block,"value")))}sparqlGraphGraphPattern(block){return codeTuple(join(" ","GRAPH",this.valueToCode(block,"iri"),this.valueToCode(block,"patterns")))}sparqlServiceGraphPattern(block){var iri=this.valueToCode(block,"iri");return codeTuple(join(" ","SERVICE",block.getFieldValue("silent"),iri,this.valueToCode(block,"patterns")))}sparqlMinusGraphPattern(block){return codeTuple(join(" ","MINUS",this.valueToCode(block,"value")))}sparqlFilter(block){return codeTuple(join(" ","FILTER",this.valueToCode(block,"value")))}sparqlBind(block){return codeTuple(join(" ","BIND",this.valueToCode(block,"value")))}sparqlGroupOrUnionGraphPattern(block){return codeTuple(join("",...this.statementToCode(block,"items")))}sparqlPrefixDecl(block){return codeTuple(`PREFIX ${block.getFieldValue("prefix")}: ${this.valueToCode(block,"value")}`)}sparqlPrefixDeclDefault(block){return codeTuple(`PREFIX : ${this.valueToCode(block,"value")}`)}sparqlBase(block){return codeTuple(`BASE ${this.valueToCode(block,"value")}`)}sparqlNamedGraphClause(block){return codeTuple(`NAMED ${this.valueToCode(block,"value")}`)}sparqlSolutionModifier(offset){var group=this.statementToCode(offset,"group"),having=this.statementToCode(offset,"having"),order=this.statementToCode(offset,"order"),limit=this.valueToCode(offset,"limit"),offset=this.valueToCode(offset,"offset");return codeTuple(joinO("\n",[group,`GROUP BY ${group}`],[having,`HAVING ${having}`],[order,`ORDER BY ${order}`],[limit,`LIMIT ${limit}`],[offset,`OFFSET ${offset}`]))}sparqlOrdercondition(block){return codeTuple(join("",block.getFieldValue("operator"),this.valueToCode(block,"value")))}sparqlInlineData(block){return codeTuple(join(" ","VALUES",this.valueToCode(block,"value")))}sparqlInlineDataOneVar(block){return codeTuple(join(" ",this.valueToCode(block,"variable"),join(" ","{",this.statementToCode(block,"values")," }")))}sparqlInlineDataFull(values){var variables=this.statementToCode(values,"variables"),values=this.statementToCode(values,"values");return codeTuple(join(" ",join("","(",variables,")"),join("\n","{",this.indent(values),"}")))}sparqlA(){return codeTuple("a")}sparqlNegatedPath(block){return codeTuple(join("","!",this.valueToCode(block,"value")))}sparqlBracketedPath(block){return codeTuple(join("","(",this.valueToCode(block,"value"),")"))}sparqlPathWithModifier(block){var modifier=block.getFieldValue("modifier");return codeTuple(join("",this.valueToCode(block,"value"),modifier))}sparqlInversePath(block){return codeTuple(join("","^",this.valueToCode(block,"value")))}sparqlPathAlternative(block){return codeTuple(this.statementToCode(block,"items"))}sparqlPathSequence(block){return codeTuple(this.statementToCode(block,"items"))}sparqlInversePathOneInPropertySet(block){return codeTuple(join("","^",this.valueToCode(block,"value")))}sparqlPathOneInPropertySetAlternative(block){return codeTuple(join("","(",this.statementToCode(block,"items"),")"))}sparqlIrirefDefault(){return iriref()}sparqlIriref(block){return iriref(block.getFieldValue("value"))}sparqlPrefixedName(){return prefixedName("","")}sparqlPrefixedNamePrefix(block){return prefixedName(block.getFieldValue("prefix"),"")}sparqlPrefixedNameLocalName(block){return prefixedName("",block.getFieldValue("localName"))}sparqlPrefixedNamePrefixLocalName(block){return prefixedName(block.getFieldValue("prefix"),block.getFieldValue("localName"))}sparqlString(block){let value=block.getFieldValue("value"),delimiter="'";return-1delimiter).join("")),codeTuple(`${delimiter}${value}${delimiter}`)}sparqlTypedLiteral(block){return codeTuple(`${this.valueToCode(block,"value")}^^${this.valueToCode(block,"datatype")}`)}sparqlLangString(block){return codeTuple(`${this.valueToCode(block,"value")}@${block.getFieldValue("language")}`)}sparqlNumericLiteral(block){const value=block.getFieldValue("value");return codeTuple(value.toString())}sparqlBooleanLiteral(block){return codeTuple(("TRUE"===block.getFieldValue("value")).toString())}sparqlVar1(block){return this.var(block,"?")}sparqlVar2(block){return this.var(block,"$")}sparqlUndef(){return codeTuple("UNDEF")}sparqlNil(){return codeTuple("()")}sparqlAnon(){return codeTuple("[]")}sparqlBlankNodeLabel(block){return codeTuple(`_:${block.getFieldValue("value")}`)}sparqlGraphRefAllDefault(){return codeTuple("DEFAULT")}sparqlGraphRefAllNamed(){return codeTuple("NAMED")}sparqlGraphRefAllAll(){return codeTuple("ALL")}sparqlBrackettedExpression(block){return codeTuple(`(${this.valueToCode(block,"value")})`)}sparqlBuiltinCall1(block){return codeTuple(`${block.getFieldValue("operator")}(${this.valueToCode(block,"arg1")})`)}sparqlBuiltinCall0(block){return codeTuple(`${block.getFieldValue("operator")}()`)}sparqlBuiltinCall2(block){return codeTuple(`${block.getFieldValue("operator")}(${this.valueToCode(block,"arg1")}, ${this.valueToCode(block,"arg2")})`)}sparqlBuiltinCall4(block){return codeTuple(`${block.getFieldValue("operator")}(${this.valueToCode(block,"arg1")}, ${this.valueToCode(block,"arg2")}, ${this.valueToCode(block,"arg3")}, ${this.valueToCode(block,"arg4")})`)}sparqlBuiltinCall3(block){return codeTuple(`${block.getFieldValue("operator")}(${this.valueToCode(block,"arg1")}, ${this.valueToCode(block,"arg2")}, ${this.valueToCode(block,"arg3")})`)}sparqlBuiltinCallN(block){return codeTuple(`${block.getFieldValue("operator")}(${this.statementToCode(block,"args")})`)}sparqlAdditiveExpression(block){var left=this.valueToCode(block,"left"),right=this.valueToCode(block,"right");return codeTuple(join(" ",left,block.getFieldValue("operator"),right))}sparqlMultiplicativeExpression(block){var left=this.valueToCode(block,"left"),right=this.valueToCode(block,"right");return codeTuple(join(" ",left,block.getFieldValue("operator"),right))}sparqlRelationalExpression(block){var left=this.valueToCode(block,"left"),right=this.valueToCode(block,"right");return codeTuple(join(" ",left,block.getFieldValue("operator"),right))}sparqlConditionalAndExpression(block){return codeTuple(join(" ",this.valueToCode(block,"left"),"&&",this.valueToCode(block,"right")))}sparqlConditionalOrExpression(block){return codeTuple(join(" ",this.valueToCode(block,"left"),"||",this.valueToCode(block,"right")))}sparqlRelationalExpressionIn(block){var left=this.valueToCode(block,"left"),right=this.statementToCode(block,"right");return codeTuple(join(" ",left,join("",block.getFieldValue("operator")," (",right,")")))}sparqlUnaryexpression(left){const operator=left.getFieldValue("operator");left=this.valueToCode(left,"left");return codeTuple(join("",operator.replace("UMINUS","-"),left))}sparqlIriOrFunction(block){return codeTuple(join("",this.valueToCode(block,"iri"),"(",join(" ",block.getFieldValue("distinct"),this.statementToCode(block,"args")),")"))}sparqlBound(block){return codeTuple(join("","BOUND(",this.valueToCode(block,"value"),")"))}sparqlExists(block){return codeTuple(join(" ",block.getFieldValue("operator"),this.valueToCode(block,"value")))}sparqlAggregate(block){return codeTuple(join("",block.getFieldValue("operator"),"(",join(" ",block.getFieldValue("distinct"),this.valueToCode(block,"arg1")),")"))}sparqlCount(block){var arg1=this.valueToCode(block,"arg1");return codeTuple(join("","COUNT(",join(" ",block.getFieldValue("distinct"),block.getFieldValue("star"),arg1),")"))}sparqlGroup_Concat(separator){var arg1=this.valueToCode(separator,"arg1"),distinct=separator.getFieldValue("distinct"),separator=this.valueToCode(separator,"separator");return codeTuple(joinO("","GROUP_CONCAT(",join(" ",distinct,arg1),["' '"!==separator,join(" ","; SEPARATOR =",separator)],")"))}sparqlEmbTp(block){return codeTuple(joinO(" ","<<",this.valueToCode(block,"subject"),this.valueToCode(block,"predicate"),this.valueToCode(block,"object"),">>"))}sparqlObjectListItemAnootationPattern(block){var value=this.valueToCode(block,"value"),code=this.statementToCode(block,"annotations"),code=join(" ",value,join("\n","{|",this.indent(code),"|}"));return this.generateNext(block,code,", ")}sparqlVarOrExpressionAsVarItem(block){return this.item(" ",block)}sparqlObjectListItem(block){return this.item(", ",block)}sparqlGroupGraphPatternSubItem(block){return this.item(" .\n",block)}sparqlPrologueItem(block){return this.item("\n",block)}sparqlVarOrIriItem(block){return this.item(" ",block)}sparqlDatasetClause(block){var value=this.valueToCode(block,"value");return this.generateNext(block,`FROM ${value}`,"\n")}sparqlExpressionListItem(block){return this.item(", ",block)}sparqlGroupConditionItem(block){return this.item(" ",block)}sparqlHavingConditionItem(block){return this.item(" ",block)}sparqlOrderConditionItem(block){return this.item(" ",block)}sparqlGraphNodeItem(block){return this.item(" ",block)}sparqlUnaryExpressionItem(block){return this.item("",block)}sparqlConditionalAndExpressionItem(block){return this.item("",block)}sparqlMultiplicativeExpressionItem(block){return this.item("",block)}sparqlGroupGraphPatternItem(block){return this.item("\nUNION\n",block)}sparqlPathSequencItem(block){return this.item("/",block)}sparqlPathAlternativeItem(block){return this.item("|",block)}sparqlPathOneInPropertySetAlternativeItem(block){return this.item("|",block)}sparqlDataBlockValuesItem(block){var code=join("","(",join(" ",this.statementToCode(block,"items")),")");return this.generateNext(block,code,"\n")}sparqlDataBlockValueItem(block){return this.item(" ",block)}sparqlVarItem(block){return this.item(" ",block)}sparqlTriplesSameSubjectItem(block){return this.item(" .\n",block)}sparqlUpdateItem(block){return this.item(" ;\n\n",block)}sparqlQuadPatternItem(block){return this.item(" .\n",block)}valueToCode(block,name){return super.valueToCode(block,name,aliases_1.Order.Atomic)}indent(code){if(code)return this.prefixLines(code,"\t")}var(block,prefix){return codeTuple(`${prefix}${block.getFieldValue("value")}`)}item(delimiter,block){var value=this.valueToCode(block,"value");return this.generateNext(block,value,delimiter)}generateNext(next,code,delimiter){next=this.blockToCode(next.getNextBlock());return next&&(code+=delimiter+next),code}}exports.default=CodeGenerator},{"./aliases":34,blockly:17}],33:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.StringifiedMap=void 0;class StringifiedMap extends Map{constructor(){super(...arguments),this.keyMap=new Map}set(key,value){var keyString=JSON.stringify(key);return this.keyMap.set(keyString,key),super.set(keyString,value),this}get(key){return super.get(JSON.stringify(key))}has(key){return super.has(JSON.stringify(key))}keys(){return this.keyMap.values()}entries(){return this[Symbol.iterator]()}*[Symbol.iterator](){for(var[key,value]of super[Symbol.iterator]())yield[this.keyMap.get(key),value]}}exports.StringifiedMap=StringifiedMap},{}],34:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Order=exports.XSD=exports.RDF=void 0,function(RDF){RDF.type="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",RDF.langString="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",RDF.nil="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil",RDF.first="http://www.w3.org/1999/02/22-rdf-syntax-ns#first",RDF.rest="http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"}(exports.RDF||(exports.RDF={})),function(XSD){XSD.string="http://www.w3.org/2001/XMLSchema#string",XSD.integer="http://www.w3.org/2001/XMLSchema#integer",XSD.decimal="http://www.w3.org/2001/XMLSchema#decimal",XSD.double="http://www.w3.org/2001/XMLSchema#double",XSD.boolean="http://www.w3.org/2001/XMLSchema#boolean"}(exports.XSD||(exports.XSD={})),function(Order){Order[Order.None=0]="None",Order[Order.Atomic=1]="Atomic"}(exports.Order||(exports.Order={}))},{}],35:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const Blockly=require("blockly");Blockly.Blocks.sparql11_embtp={init:function(){this.appendValueInput("subject").appendField("<<").setCheck("EmbSubjectOrObject"),this.appendValueInput("predicate").setCheck("Verb"),this.appendValueInput("object").setCheck("EmbSubjectOrObject"),this.appendDummyInput().appendField(">>"),this.setOutput(!0,["GraphNode","GraphNodePath","VarOrTermOrEmbTP","EmbSubjectOrObject","EmbTP","DataBlockValue"]),this.setColour(0),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_objectlistitemanootationpattern={init:function(){this.appendValueInput("value").appendField("{|").setCheck("GraphNode"),this.appendStatementInput("annotations").setCheck("PropertyListNotEmpty"),this.appendDummyInput().appendField("|}"),this.setPreviousStatement(!0,"ObjectListItem"),this.setNextStatement(!0,"ObjectListItem"),this.setColour(294),this.setTooltip("ObjectListItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_selectclause={init:function(){this.appendStatementInput("vars").setCheck("VarOrExpressionAsVarItem").appendField(new Blockly.FieldDropdown([["",""],["DISTINCT","DISTINCT"],["REDUCED","REDUCED"]]),"distinctOrReduced").appendField(new Blockly.FieldDropdown([["",""],["*","*"]]),"star"),this.setOutput(!0,"SelectClause"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_expressionasvar={init:function(){this.appendValueInput("value").setCheck(["Expression","EmbTP"]).appendField("("),this.appendDummyInput().appendField("AS"),this.appendValueInput("name").setCheck("Var"),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["ExpressionAsVar","GroupCondition"]),this.setColour(98),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_selectquery={init:function(){this.appendValueInput("select").setCheck("SelectClause").appendField("SELECT"),this.appendValueInput("where").setCheck("QueryCommon"),this.setInputsInline(!1),this.setOutput(!0,"SelectQuery"),this.setColour(196),this.setTooltip("SelectQuery"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_describequery={init:function(){this.appendStatementInput("subject").setCheck("VarOrIriItem").appendField("DESCRIBE").appendField(new Blockly.FieldDropdown([["",""],["*","*"]]),"star"),this.appendValueInput("where").setCheck("QueryCommon"),this.setOutput(!0,"DescribeQuery"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_prefixedname={init:function(){this.appendDummyInput().appendField(":"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","iri","VarOrIri","GraphNode","VarOrTerm","GraphTerm","Verb","DataBlockValue","PathPrimary","PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath","PathOneInPropertySet","PathNegatedPropertySet","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression","iriOrFunction","GraphOrDefault"]),this.setColour(326),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_prefixednameprefix={init:function(){this.appendDummyInput().appendField(new Blockly.FieldTextInput(""),"prefix").appendField(":"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","iri","VarOrIri","GraphNode","VarOrTerm","GraphTerm","Verb","DataBlockValue","PathPrimary","PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath","PathOneInPropertySet","PathNegatedPropertySet","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression","iriOrFunction","GraphOrDefault"]),this.setColour(326),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_prefixednamelocalname={init:function(){this.appendDummyInput().appendField(":").appendField(new Blockly.FieldTextInput(""),"localName"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","iri","VarOrIri","GraphNode","VarOrTerm","GraphTerm","Verb","DataBlockValue","PathPrimary","PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath","PathOneInPropertySet","PathNegatedPropertySet","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression","iriOrFunction","GraphOrDefault"]),this.setColour(326),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_prefixednameprefixlocalname={init:function(){this.appendDummyInput().appendField(new Blockly.FieldTextInput(""),"prefix").appendField(":").appendField(new Blockly.FieldTextInput(""),"localName"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","iri","VarOrIri","GraphNode","VarOrTerm","GraphTerm","Verb","DataBlockValue","PathPrimary","PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath","PathOneInPropertySet","PathNegatedPropertySet","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression","iriOrFunction","GraphOrDefault"]),this.setColour(326),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_iriref={init:function(){this.appendDummyInput().appendField("<").appendField(new Blockly.FieldTextInput(""),"value").appendField(">"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","IRIREF","iri","VarOrIri","GraphNode","VarOrTerm","GraphTerm","Verb","DataBlockValue","PathPrimary","PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath","PathOneInPropertySet","PathNegatedPropertySet","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression","iriOrFunction","GraphOrDefault"]),this.setColour(326),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_irirefdefault={init:function(){this.appendDummyInput().appendField("<>"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","IRIREF","iri","VarOrIri","GraphNode","VarOrTerm","GraphTerm","Verb","DataBlockValue","PathPrimary","PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath","PathOneInPropertySet","PathNegatedPropertySet","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression","iriOrFunction","GraphOrDefault"]),this.setColour(326),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_solutionmodifier={init:function(){this.appendStatementInput("group").setCheck("GroupConditionItem").appendField("GROUP BY"),this.appendStatementInput("having").setCheck("HavingConditionItem").appendField("HAVING"),this.appendStatementInput("order").setCheck("OrderConditionItem").appendField("ORDER BY"),this.appendValueInput("limit").setCheck("NumericLiteral").appendField("LIMIT"),this.appendValueInput("offset").setCheck("NumericLiteral").appendField("OFFSET"),this.setOutput(!0,"SolutionModifier"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_subselect={init:function(){this.appendValueInput("select").setCheck("SelectClause").appendField("SELECT"),this.appendValueInput("pattern").setCheck("GroupGraphPattern").appendField("WHERE"),this.appendValueInput("modifiers").setCheck("SolutionModifier"),this.appendValueInput("values").setCheck("ValuesClause"),this.setOutput(!0,"SubSelect"),this.setColour(65),this.setTooltip("SubSelect"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_typedliteral={init:function(){this.appendValueInput("value").setCheck("string"),this.appendValueInput("datatype").appendField("^^").setCheck("iri"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","RDFLiteral","GraphNode","VarOrTerm","GraphTerm","DataBlockValue","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression"]),this.setColour(163),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_langstring={init:function(){const language=new Blockly.FieldTextInput("");language.setValidator(value=>/^[a-zA-Z]+(-[a-zA-Z0-9]+)*$/.test(value)?value:null),this.appendValueInput("value").setCheck("string"),this.appendDummyInput().appendField("@").appendField(language,"language"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","RDFLiteral","GraphNode","VarOrTerm","GraphTerm","DataBlockValue","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression"]),this.setColour(163),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_a={init:function(){this.appendDummyInput().appendField("a"),this.setOutput(!0,["a","PathPrimary","PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath","PathOneInPropertySet","PathNegatedPropertySet","Verb"]),this.setColour(228),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_blanknodepropertylist={init:function(){this.appendDummyInput().appendField("["),this.appendStatementInput("predicates").setCheck("PropertyListNotEmpty"),this.appendDummyInput().appendField("]"),this.setOutput(!0,["BlankNodePropertyList","TriplesNode","TriplesSameSubject","GraphNode","Object","TriplesBlock"]),this.setColour(0),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_collection={init:function(){this.appendDummyInput().appendField("("),this.appendStatementInput("items").setCheck("GraphNodeItem"),this.appendDummyInput().appendField(")"),this.setOutput(!0,["Collection","TriplesNode","TriplesSameSubject","GraphNode","Object","TriplesBlock"]),this.setColour(0),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_anon={init:function(){this.appendDummyInput().appendField("[]"),this.setOutput(!0,["EmbSubjectOrObject","VarOrTermOrEmbTP","BlankNode","GraphTerm","VarOrTerm","GraphNode","Object"]),this.setColour(98),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_blanknodelabel={init:function(){this.appendDummyInput().appendField("_:").appendField(new Blockly.FieldTextInput(""),"value"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","VarOrTermOrEmbTP","BlankNode","GraphTerm","VarOrTerm","GraphNode"]),this.setColour(98),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_nil={init:function(){this.appendDummyInput().appendField("()"),this.setOutput(!0,["VarOrTermOrEmbTP","NIL","GraphTerm","VarOrTerm","GraphNode","Object"]),this.setColour(98),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_var1={init:function(){this.appendDummyInput().appendField("?").appendField(new Blockly.FieldTextInput("s"),"value"),this.setInputsInline(!1),this.setOutput(!0,["EmbSubjectOrObject","VarOrTermOrEmbTP","Var","VarOrIri","Verb","VarOrTerm","GraphNode","Object","GroupCondition","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression"]),this.setColour(33),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_var2={init:function(){this.appendDummyInput().appendField("$").appendField(new Blockly.FieldTextInput("s"),"value"),this.setInputsInline(!1),this.setOutput(!0,["EmbSubjectOrObject","VarOrTermOrEmbTP","Var","VarOrIri","Verb","VarOrTerm","GraphNode","Object","GroupCondition","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression"]),this.setColour(33),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_groupconditionitem={init:function(){this.appendValueInput("value").setCheck("GroupCondition"),this.setPreviousStatement(!0,"GroupConditionItem"),this.setNextStatement(!0,"GroupConditionItem"),this.setColour(196),this.setTooltip("GroupConditionItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_groupgraphpattern={init:function(){this.appendDummyInput().appendField("{"),this.appendValueInput("value").setCheck(["SubSelect","GroupGraphPatternSub","TriplesNode","TriplesSameSubject","GraphPatternNotTriples","GroupGraphPattern"]),this.appendDummyInput().appendField("}"),this.setInputsInline(!1),this.setOutput(!0,"GroupGraphPattern"),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_groupgraphpatternsub={init:function(){this.appendStatementInput("items").setCheck("GroupGraphPatternSubItem"),this.setOutput(!0,"GroupGraphPatternSub"),this.setColour(65),this.setTooltip("GroupGraphPatternSub"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_groupgraphpatternsubitem={init:function(){this.appendValueInput("value").setCheck(["GroupGraphPattern","TriplesNode","TriplesSameSubject","GraphPatternNotTriples"]),this.setPreviousStatement(!0,"GroupGraphPatternSubItem"),this.setNextStatement(!0,"GroupGraphPatternSubItem"),this.setColour(65),this.setTooltip("GroupGraphPatternSubItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_optionalgraphpattern={init:function(){this.appendValueInput("value").setCheck("GroupGraphPattern").appendField("OPTIONAL"),this.setOutput(!0,"GraphPatternNotTriples"),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_graphgraphpattern={init:function(){this.appendValueInput("iri").setCheck("VarOrIri").appendField("GRAPH"),this.appendValueInput("patterns").setCheck("GroupGraphPattern"),this.setInputsInline(!1),this.setOutput(!0,["GraphGraphPattern","GraphPatternNotTriples"]),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_servicegraphpattern={init:function(){this.appendValueInput("iri").setCheck("VarOrIri").appendField("SERVICE").appendField(new Blockly.FieldDropdown([["",""],["SILENT","SILENT"]]),"silent"),this.appendValueInput("patterns").setCheck("GroupGraphPattern"),this.setOutput(!0,["ServiceGraphPattern","GraphPatternNotTriples"]),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_bind={init:function(){this.appendValueInput("value").setCheck("ExpressionAsVar").appendField("BIND"),this.setOutput(!0,["Bind","GraphPatternNotTriples"]),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_minusgraphpattern={init:function(){this.appendValueInput("value").setCheck("GroupGraphPattern").appendField("MINUS"),this.setOutput(!0,["MinusGraphPattern","GraphPatternNotTriples"]),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_grouporuniongraphpattern={init:function(){this.appendStatementInput("items").setCheck("GroupGraphPatternItem").appendField("UNION"),this.setInputsInline(!1),this.setOutput(!0,["GroupOrUnionGraphPattern","GraphPatternNotTriples"]),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_filter={init:function(){this.appendValueInput("value").setCheck("Constraint").appendField("FILTER"),this.setOutput(!0,["Filter","GraphPatternNotTriples"]),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_inlinedata={init:function(){this.appendValueInput("value").setCheck("DataBlock").appendField("VALUES"),this.setOutput(!0,["InlineData","GraphPatternNotTriples","ValuesClause"]),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_inlinedataonevar={init:function(){this.appendValueInput("variable").setCheck("Var"),this.appendDummyInput().appendField("{"),this.appendStatementInput("values").setCheck("DataBlockValueItem"),this.appendDummyInput().appendField("}"),this.setOutput(!0,"DataBlock"),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_inlinedatafull={init:function(){this.appendDummyInput().appendField("("),this.appendStatementInput("variables").setCheck("VarItem"),this.appendDummyInput().appendField(")"),this.appendDummyInput().appendField("{"),this.appendStatementInput("values").setCheck("DataBlockValuesItem"),this.appendDummyInput().appendField("}"),this.setOutput(!0,["InlineDataFull","DataBlock"]),this.setColour(65),this.setTooltip("InlineDataFull"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_datablockvaluesitem={init:function(){this.appendDummyInput().appendField("("),this.appendStatementInput("items").setCheck("DataBlockValueItem"),this.appendDummyInput().appendField(")"),this.setPreviousStatement(!0,"DataBlockValuesItem"),this.setNextStatement(!0,"DataBlockValuesItem"),this.setColour(65),this.setTooltip("DataBlockValuesItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_datablockvalueitem={init:function(){this.appendValueInput("value").setCheck("DataBlockValue"),this.setPreviousStatement(!0,"DataBlockValueItem"),this.setNextStatement(!0,"DataBlockValueItem"),this.setColour(65),this.setTooltip("DataBlockValueItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_undef={init:function(){this.appendDummyInput().appendField("UNDEF"),this.setOutput(!0,"DataBlockValue"),this.setColour(65),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_negatedpath={init:function(){this.appendValueInput("value").setCheck("PathNegatedPropertySet").appendField("!"),this.setInputsInline(!0),this.setOutput(!0,["PathPrimary","PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath"]),this.setColour(228),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_bracketedpath={init:function(){this.appendValueInput("value").setCheck("Path").appendField("("),this.appendDummyInput().appendField(")"),this.setOutput(!0,["PathPrimary","PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath"]),this.setColour(228),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_pathwithmodifier={init:function(){this.appendValueInput("value").setCheck("PathPrimary").appendField(""),this.appendDummyInput().appendField(new Blockly.FieldDropdown([["",""],["?","?"],["*","*"],["+","+"]]),"modifier"),this.setInputsInline(!0),this.setOutput(!0,["PathElt","PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath"]),this.setColour(228),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_inversepath={init:function(){this.appendValueInput("value").setCheck("PathElt").appendField("^"),this.setInputsInline(!1),this.setInputsInline(!0),this.setOutput(!0,["PathEltOrInverse","PathSequence","PathAlternative","Path","VerbPath"]),this.setColour(228),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_pathalternative={init:function(){this.appendDummyInput().appendField("|"),this.appendStatementInput("items").setCheck("PathAlternativeItem"),this.setInputsInline(!0),this.setOutput(!0,["PathAlternative","Path","VerbPath"]),this.setColour(228),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_pathsequencitem={init:function(){this.appendValueInput("value").setCheck("PathEltOrInverse"),this.setInputsInline(!1),this.setPreviousStatement(!0,"PathSequenceItem"),this.setNextStatement(!0,"PathSequenceItem"),this.setColour(228),this.setTooltip("PathSequenceItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_pathalternativeitem={init:function(){this.appendValueInput("value").setCheck("PathSequence"),this.setInputsInline(!1),this.setPreviousStatement(!0,"PathAlternativeItem"),this.setNextStatement(!0,"PathAlternativeItem"),this.setColour(228),this.setTooltip("PathAlternativeItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_pathsequence={init:function(){this.appendDummyInput().appendField("/"),this.appendStatementInput("items").setCheck("PathSequenceItem"),this.setInputsInline(!0),this.setOutput(!0,["PathSequence","PathAlternative","Path","VerbPath"]),this.setColour(228),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_inversepathoneinpropertyset={init:function(){this.appendValueInput("value").setCheck(["iri","a"]).appendField("^"),this.setInputsInline(!0),this.setOutput(!0,["PathOneInPropertySet","PathNegatedPropertySet"]),this.setColour(228),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_pathoneinpropertysetalternative={init:function(){this.appendDummyInput().appendField("(|)"),this.appendStatementInput("items").setCheck("PathOneInPropertySetAlternativeItem"),this.setInputsInline(!0),this.setOutput(!0,"PathNegatedPropertySet"),this.setColour(228),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_pathoneinpropertysetalternativeitem={init:function(){this.appendValueInput("value").setCheck("PathOneInPropertySet"),this.setPreviousStatement(!0,"PathOneInPropertySetAlternativeItem"),this.setNextStatement(!0,"PathOneInPropertySetAlternativeItem"),this.setColour(228),this.setTooltip("PathOneInPropertySetAlternativeItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_varitem={init:function(){this.appendValueInput("value").setCheck("Var"),this.setInputsInline(!1),this.setPreviousStatement(!0,"VarItem"),this.setNextStatement(!0,"VarItem"),this.setColour(65),this.setTooltip("VarItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_askquery={init:function(){this.appendValueInput("value").setCheck("QueryCommon").appendField("ASK"),this.setOutput(!0,"AskQuery"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_simpleconstructquery={init:function(){this.appendDummyInput().appendField("CONSTRUCT"),this.appendStatementInput("datasets").setCheck("DatasetClause"),this.appendStatementInput("where").setCheck("TriplesSameSubjectItem").appendField("WHERE {"),this.appendValueInput("modifiers").setCheck("SolutionModifier").appendField("}"),this.setOutput(!0,"ConstructQuery"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_triplessamesubjectitem={init:function(){this.appendValueInput("value").setCheck("TriplesSameSubject"),this.setPreviousStatement(!0,"TriplesSameSubjectItem"),this.setNextStatement(!0,"TriplesSameSubjectItem"),this.setColour(196),this.setTooltip("TriplesSameSubjectItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_constructquery={init:function(){this.appendStatementInput("template").setCheck("TriplesSameSubjectItem").appendField("CONSTRUCT {"),this.appendValueInput("where").setCheck("QueryCommon").appendField("}"),this.setOutput(!0,"ConstructQuery"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_query={init:function(){this.appendStatementInput("prologue").setCheck("PrologueItem"),this.appendValueInput("value").setCheck(["SelectQuery","ConstructQuery","DescribeQuery","AskQuery"]),this.appendValueInput("values").setCheck("ValuesClause"),this.setColour(196),this.setTooltip("Query"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_base={init:function(){this.appendValueInput("value").setCheck("IRIREF").appendField("BASE"),this.setInputsInline(!1),this.setOutput(!0,"BaseDecl"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_prefixdecl={init:function(){this.appendValueInput("value").setCheck("IRIREF").appendField("PREFIX").appendField(new Blockly.FieldTextInput(""),"prefix").appendField(":"),this.setOutput(!0,"PrefixDecl"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_prologueitem={init:function(){this.appendValueInput("value").setCheck(["BaseDecl","PrefixDecl"]),this.setInputsInline(!1),this.setPreviousStatement(!0,"PrologueItem"),this.setNextStatement(!0,"PrologueItem"),this.setColour(196),this.setTooltip("PrologueItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_varorexpressionasvaritem={init:function(){this.appendValueInput("value").setCheck(["Var","ExpressionAsVar"]),this.setInputsInline(!1),this.setPreviousStatement(!0,"VarOrExpressionAsVarItem"),this.setNextStatement(!0,"VarOrExpressionAsVarItem"),this.setColour(196),this.setTooltip("VarOrExpressionAsVarItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_numericliteral={init:function(){const valueField=new Blockly.FieldTextInput("");valueField.setValidator(value=>isNaN(parseFloat(value))||!isFinite(value)?null:value),this.appendDummyInput().appendField(valueField,"value"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","NumericLiteral","RDFLiteral","GraphNode","VarOrTerm","GraphTerm","DataBlockValue","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression"]),this.setColour(163),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_booleanliteral={init:function(){this.appendDummyInput().appendField(new Blockly.FieldCheckbox("TRUE"),"value"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","RDFLiteral","GraphNode","VarOrTerm","GraphTerm","DataBlockValue","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression"]),this.setColour(163),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_brackettedexpression={init:function(){this.appendValueInput("value").setCheck("Expression").appendField("("),this.appendDummyInput().appendField(")"),this.setOutput(!0,["BrackettedExpression","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_multiplicativeexpression={init:function(){this.appendValueInput("left").setCheck("UnaryExpression"),this.appendValueInput("right").setCheck("UnaryExpression").appendField(new Blockly.FieldDropdown([["*","*"],["/","/"]]),"operator"),this.setInputsInline(!0),this.setOutput(!0,["MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_additiveexpression={init:function(){this.appendValueInput("left").setCheck("MultiplicativeExpression"),this.appendValueInput("right").setCheck("MultiplicativeExpression").appendField(new Blockly.FieldDropdown([["+","+"],["-","-"]]),"operator"),this.setInputsInline(!0),this.setOutput(!0,["AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_relationalexpression={init:function(){this.appendValueInput("left").setCheck("NumericExpression"),this.appendValueInput("right").setCheck("NumericExpression").appendField(new Blockly.FieldDropdown([["=","="],["!=","!="],["<","<"],[">",">"],["<=","<="],[">=",">="]]),"operator"),this.setInputsInline(!0),this.setOutput(!0,["RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_relationalexpressionin={init:function(){this.appendValueInput("left").setCheck("NumericExpression"),this.appendStatementInput("right").setCheck("ExpressionListItem").appendField(new Blockly.FieldDropdown([["IN","IN"],["NOT IN","NOT IN"]]),"operator"),this.setInputsInline(!0),this.setOutput(!0,["RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_expressionlistitem={init:function(){this.appendValueInput("value").setCheck("Expression"),this.setPreviousStatement(!0,"ExpressionListItem"),this.setNextStatement(!0,"ExpressionListItem"),this.setColour(261),this.setTooltip("ExpressionListItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_conditionalandexpression={init:function(){this.appendValueInput("left").setCheck("ValueLogical"),this.appendValueInput("right").setCheck("ValueLogical").appendField("&&"),this.setInputsInline(!0),this.setOutput(!0,["ConditionalAndExpression","ConditionalOrExpression","Expression"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_conditionalorexpression={init:function(){this.appendValueInput("left").setCheck("ConditionalAndExpression"),this.appendValueInput("right").setCheck("ConditionalAndExpression").appendField("||"),this.setInputsInline(!0),this.setOutput(!0,["ConditionalOrExpression","Expression"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_string={init:function(){this.appendDummyInput().appendField(new Blockly.FieldMultilineInput(""),"value"),this.setInputsInline(!0),this.setOutput(!0,["EmbSubjectOrObject","DataValueTerm","VarOrTermOrEmbTP","string","RDFLiteral","GraphNode","VarOrTerm","GraphTerm","DataBlockValue","Expression","ConditionalOrExpression","ConditionalAndExpression","ValueLogical","RelationalExpression","NumericExpression","AdditiveExpression","MultiplicativeExpression","UnaryExpression","PrimaryExpression"]),this.setColour(163),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_havingconditionitem={init:function(){this.appendValueInput("value").setCheck("Constraint"),this.setPreviousStatement(!0,"HavingConditionItem"),this.setNextStatement(!0,"HavingConditionItem"),this.setColour(196),this.setTooltip("HavingConditionItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_triplessamesubject={init:function(){this.appendValueInput("subject").setCheck(["VarOrTermOrEmbTP","TriplesNode"]),this.appendStatementInput("predicates").setCheck("PropertyListNotEmpty"),this.setOutput(!0,"TriplesSameSubject"),this.setColour(0),this.setTooltip("TriplesSameSubject"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_varoririitem={init:function(){this.appendValueInput("value").setCheck("VarOrIri"),this.setPreviousStatement(!0,"VarOrIriItem"),this.setNextStatement(!0,"VarOrIriItem"),this.setColour(196),this.setTooltip("VarOrIriItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_graphnodeitem={init:function(){this.appendValueInput("value").setCheck("GraphNode"),this.setPreviousStatement(!0,"GraphNodeItem"),this.setNextStatement(!0,"GraphNodeItem"),this.setColour(294),this.setTooltip("GraphNodeItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_objectlistitem={init:function(){this.appendValueInput("value").setCheck("GraphNode"),this.setPreviousStatement(!0,"ObjectListItem"),this.setNextStatement(!0,"ObjectListItem"),this.setColour(294),this.setTooltip("ObjectListItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_propertylistnotempty={init:function(){this.appendValueInput("predicate").setCheck(["Verb","Path"]),this.appendStatementInput("objects").setCheck("ObjectListItem"),this.setPreviousStatement(!0,"PropertyListNotEmpty"),this.setNextStatement(!0,"PropertyListNotEmpty"),this.setColour(131),this.setTooltip("PropertyListNotEmpty"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_querycommon={init:function(){this.appendStatementInput("datasets").setCheck("DatasetClause"),this.appendValueInput("pattern").setCheck("GroupGraphPattern").appendField("WHERE"),this.appendValueInput("modifiers").setCheck("SolutionModifier"),this.setOutput(!0,"QueryCommon"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_datasetclause={init:function(){this.appendValueInput("value").setCheck(["iri","NamedGraphClause"]).appendField("FROM"),this.setInputsInline(!1),this.setPreviousStatement(!0,"DatasetClause"),this.setNextStatement(!0,"DatasetClause"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_namedgraphclause={init:function(){this.appendValueInput("value").setCheck("iri").appendField("NAMED"),this.setOutput(!0,"NamedGraphClause"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_builtincall0={init:function(){this.appendDummyInput().appendField(new Blockly.FieldDropdown([["BNODE","BNODE"],["RAND","RAND"],["NOW","NOW"],["UUID","UUID"],["STRUUID","STRUUID"]]),"operator").appendField("()"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_builtincall1={init:function(){this.appendValueInput("arg1").setCheck("Expression").appendField(new Blockly.FieldDropdown([["STR","STR"],["LANG","LANG"],["DATATYPE","DATATYPE"],["IRI","IRI"],["URI","URI"],["BNODE","BNODE"],["ABS","ABS"],["CEIL","CEIL"],["FLOOR","FLOOR"],["ROUND","ROUND"],["STRLEN","STRLEN"],["UCASE","UCASE"],["LCASE","LCASE"],["ENCODE_FOR_URI","ENCODE_FOR_URI"],["YEAR","YEAR"],["MONTH","MONTH"],["DAY","DAY"],["HOURS","HOURS"],["MINUTES","MINUTES"],["SECONDS","SECONDS"],["TIMEZONE","TIMEZONE"],["TZ","TZ"],["MD5","MD5"],["SHA1","SHA1"],["SHA256","SHA256"],["SHA384","SHA384"],["SHA512","SHA512"],["ISIRI","ISIRI"],["ISURI","ISURI"],["ISBLANK","ISBLANK"],["ISLITERAL","ISLITERAL"],["ISNUMERIC","ISNUMERIC"],["SUBJECT","SUBJECT"],["PREDICATE","PREDICATE"],["OBJECT","OBJECT"],["ISTRIPLE","ISTRIPLE"]]),"operator").appendField("("),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_builtincall2={init:function(){this.appendValueInput("arg1").setCheck("Expression").appendField(new Blockly.FieldDropdown([["LANGMATCHES","LANGMATCHES"],["SUBSTR","SUBSTR"],["CONTAINS","CONTAINS"],["STRSTARTS","STRSTARTS"],["STRENDS","STRENDS"],["STRBEFORE","STRBEFORE"],["STRAFTER","STRAFTER"],["STRLANG","STRLANG"],["STRDT","STRDT"],["SAMETERM","SAMETERM"],["REGEX","REGEX"]]),"operator").appendField("("),this.appendValueInput("arg2").setCheck("Expression").appendField(","),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_builtincall3={init:function(){this.appendValueInput("arg1").setCheck("Expression").appendField(new Blockly.FieldDropdown([["REGEX","REGEX"],["SUBSTR","SUBSTR"],["REPLACE","REPLACE"],["IF","IF"],["TRIPLE","TRIPLE"]]),"operator").appendField("("),this.appendValueInput("arg2").setCheck("Expression").appendField(","),this.appendValueInput("arg3").setCheck("Expression").appendField(","),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_builtincall4={init:function(){this.appendValueInput("arg1").setCheck("Expression").appendField(new Blockly.FieldDropdown([["REPLACE","REPLACE"]]),"operator").appendField("("),this.appendValueInput("arg2").setCheck("Expression").appendField(","),this.appendValueInput("arg3").setCheck("Expression").appendField(","),this.appendValueInput("arg4").setCheck("Expression").appendField(","),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_builtincalln={init:function(){this.appendStatementInput("args").setCheck("ExpressionListItem").appendField(new Blockly.FieldDropdown([["CONCAT","CONCAT"],["COALESCE","COALESCE"]]),"operator").appendField("("),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_iriorfunction={init:function(){this.appendValueInput("iri").setCheck("iri"),this.appendDummyInput().appendField("(").appendField(new Blockly.FieldDropdown([["",""],["DISTINCT","DISTINCT"]]),"distinct"),this.appendStatementInput("args").setCheck("ExpressionListItem"),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","Constraint","GroupCondition"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_exists={init:function(){this.appendValueInput("value").setCheck("GroupGraphPattern").appendField(new Blockly.FieldDropdown([["EXISTS","EXISTS"],["NOT EXISTS","NOT EXISTS"]]),"operator"),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_bound={init:function(){this.appendValueInput("value").setCheck("Var").appendField("BOUND ("),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_unaryexpression={init:function(){this.appendValueInput("left").setCheck("PrimaryExpression").appendField(new Blockly.FieldDropdown([["!","!"],["+","+"],["-","UMINUS"]]),"operator"),this.setInputsInline(!0),this.setOutput(!0,["UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_aggregate={init:function(){this.appendValueInput("arg1").setCheck("Expression").appendField(new Blockly.FieldDropdown([["SUM","SUM"],["MIN","MIN"],["MAX","MAX"],["AVG","AVG"],["SAMPLE","SAMPLE"]]),"operator").appendField("(").appendField(new Blockly.FieldDropdown([["",""],["DISTINCT","DISTINCT"]]),"distinct"),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_count={init:function(){this.appendValueInput("arg1").setCheck("Expression").appendField("COUNT(").appendField(new Blockly.FieldDropdown([["",""],["DISTINCT","DISTINCT"]]),"distinct").appendField(new Blockly.FieldDropdown([["",""],["*","*"]]),"star"),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_group_concat={init:function(){this.appendValueInput("arg1").setCheck("Expression").appendField("GROUP_CONCAT(").appendField(new Blockly.FieldDropdown([["",""],["DISTINCT","DISTINCT"]]),"distinct"),this.appendValueInput("separator").appendField("; SEPARATOR =").setCheck("string"),this.appendDummyInput().appendField(")"),this.setInputsInline(!0),this.setOutput(!0,["BuiltInCall","PrimaryExpression","UnaryExpression","MultiplicativeExpression","AdditiveExpression","NumericExpression","RelationalExpression","ValueLogical","ConditionalAndExpression","ConditionalOrExpression","Expression","GroupCondition","Constraint"]),this.setColour(261),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_prefixdecldefault={init:function(){this.appendValueInput("value").setCheck("IRIREF").appendField("PREFIX :"),this.setOutput(!0,"PrefixDecl"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_groupgraphpatternitem={init:function(){this.appendValueInput("value").setCheck("GroupGraphPattern"),this.setPreviousStatement(!0,"GroupGraphPatternItem"),this.setNextStatement(!0,"GroupGraphPatternItem"),this.setColour(65),this.setTooltip("GroupGraphPatternItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_orderconditionitem={init:function(){this.appendValueInput("value").setCheck(["OrderCondition","Constraint","Var"]),this.setPreviousStatement(!0,"OrderConditionItem"),this.setNextStatement(!0,"OrderConditionItem"),this.setColour(196),this.setTooltip("OrderConditionItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_ordercondition={init:function(){this.appendValueInput("value").setCheck("BrackettedExpression").appendField(new Blockly.FieldDropdown([["ASC","ASC"],["DESC","DESC"]]),"operator"),this.setOutput(!0,"OrderCondition"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_update={init:function(){this.appendStatementInput("prologue").setCheck("PrologueItem"),this.appendStatementInput("items").setCheck("UpdateItem"),this.setColour(196),this.setTooltip("Update"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_updateitem={init:function(){this.appendValueInput("value").setCheck(["Update1"]),this.setPreviousStatement(!0,"UpdateItem"),this.setNextStatement(!0,"UpdateItem"),this.setColour(196),this.setTooltip("UpdateItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_load={init:function(){this.appendValueInput("source").setCheck("iri").appendField("LOAD").appendField(new Blockly.FieldDropdown([["",""],["SILENT","silent"]]),"silent"),this.appendValueInput("destination").setCheck("GraphRef").appendField("INTO"),this.setOutput(!0,"Update1"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_graphref={init:function(){this.appendValueInput("value").setCheck("iri").appendField("GRAPH"),this.setOutput(!0,["GraphRef","GraphRefAll","GraphOrDefault"]),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_graphrefallnamed={init:function(){this.appendDummyInput().appendField("NAMED"),this.setOutput(!0,"GraphRefAll"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_graphrefallall={init:function(){this.appendDummyInput().appendField("ALL"),this.setOutput(!0,"GraphRefAll"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_graphordefault={init:function(){this.appendDummyInput().appendField("DEFAULT"),this.setOutput(!0,["GraphRefAll","GraphOrDefault"]),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_create={init:function(){this.appendValueInput("graph").setCheck("GraphRef").appendField("CREATE").appendField(new Blockly.FieldDropdown([["",""],["SILENT","silent"]]),"silent"),this.setOutput(!0,"Update1"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_addmovecopy={init:function(){this.appendValueInput("source").setCheck("GraphOrDefault").appendField(new Blockly.FieldDropdown([["ADD","ADD"],["MOVE","MOVE"],["COPY","COPY"]]),"operator").appendField(new Blockly.FieldDropdown([["",""],["SILENT","SILENT"]]),"silent"),this.appendValueInput("destination").setCheck("GraphOrDefault").appendField("TO"),this.setOutput(!0,"Update1"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_cleardrop={init:function(){this.appendValueInput("graph").setCheck("GraphRefAll").appendField(new Blockly.FieldDropdown([["CLEAR","CLEAR"],["DROP","DROP"]]),"operator").appendField(new Blockly.FieldDropdown([["",""],["SILENT","SILENT"]]),"silent"),this.setOutput(!0,"Update1"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_quadpattern={init:function(){this.appendDummyInput().appendField("{"),this.appendStatementInput("items").setCheck("QuadPatternItem"),this.appendDummyInput().appendField("}"),this.setInputsInline(!1),this.setOutput(!0,"QuadPattern"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_quadpatternitem={init:function(){this.appendValueInput("value").setCheck(["TriplesSameSubject","QuadsNotTriples"]),this.setInputsInline(!1),this.setPreviousStatement(!0,"QuadPatternItem"),this.setNextStatement(!0,"QuadPatternItem"),this.setColour(196),this.setTooltip("QuadPatternItem"),this.setHelpUrl("")}},Blockly.Blocks.sparql11_insertdeletewhere={init:function(){this.appendValueInput("pattern").setCheck("QuadPattern").appendField(new Blockly.FieldDropdown([["INSERT DATA","INSERT DATA"],["DELETE DATA","DELETE DATA"],["DELETE WHERE","DELETE WHERE"]]),"operator"),this.setOutput(!0,"Update1"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_quadsnottriples={init:function(){this.appendValueInput("name").setCheck("VarOrIri").appendField("GRAPH {"),this.appendStatementInput("triples").setCheck("TriplesSameSubjectItem"),this.appendDummyInput().appendField("}"),this.setInputsInline(!1),this.setOutput(!0,"QuadsNotTriples"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_modify={init:function(){this.appendValueInput("iri").setCheck("iri").appendField("WITH"),this.appendValueInput("delete").setCheck("QuadPattern").appendField("DELETE"),this.appendValueInput("insert").setCheck("QuadPattern").appendField("INSERT"),this.appendStatementInput("using").setCheck("UsingClause"),this.appendValueInput("where").setCheck("GroupGraphPattern").appendField("WHERE"),this.setInputsInline(!1),this.setOutput(!0,"Update1"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}},Blockly.Blocks.sparql11_usingclause={init:function(){this.appendValueInput("value").setCheck(["iri","NamedGraphClause"]).appendField("USING"),this.setInputsInline(!1),this.setPreviousStatement(!0,"UsingClause"),this.setNextStatement(!0,"UsingClause"),this.setColour(196),this.setTooltip(""),this.setHelpUrl("")}}},{blockly:17}],36:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.blocklyToSparql=exports.sparqlToBlockly=void 0,require("./blocks");const BlockGenerator_1=require("./BlockGenerator"),CodeGenerator_1=require("./CodeGenerator");exports.sparqlToBlockly=function(_a){return null===(_a=(new BlockGenerator_1.default).visit(_a))||void 0===_a?void 0:_a.xml},exports.blocklyToSparql=function(block){return(new CodeGenerator_1.default).blockToCode(block)}},{"./BlockGenerator":31,"./CodeGenerator":32,"./blocks":35}],37:[function(require,module,exports){function Generator(options){this._options=options=options||{};var prefixes=options.prefixes||{};this._prefixByIri={};var prefix,prefixIris=[];for(prefix in prefixes){var iri=prefixes[prefix];isString(iri)&&(this._prefixByIri[iri]=prefix,prefixIris.push(iri))}var iriList=prefixIris.join("|").replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&");this._prefixRegex=new RegExp("^("+iriList+")([a-zA-Z][\\-_a-zA-Z0-9]*)$"),this._usedPrefixes={},this._sparqlStar=options.sparqlStar,this._indent=isString(options.indent)?options.indent:" ",this._newline=isString(options.newline)?options.newline:"\n",this._explicitDatatype=Boolean(options.explicitDatatype)}Generator.prototype.toQuery=function(q){var query="";return q.queryType&&(query+=q.queryType.toUpperCase()+" "),q.reduced&&(query+="REDUCED "),q.distinct&&(query+="DISTINCT "),q.variables?query+=mapJoin(q.variables,void 0,function(variable){return isTerm(variable)?this.toEntity(variable):"("+this.toExpression(variable.expression)+" AS ?"+variable.variable.value+")"},this)+" ":q.template&&(query+=this.group(q.template,!0)+this._newline),q.from&&(query+=this.graphs("FROM ",q.from.default)+this.graphs("FROM NAMED ",q.from.named)),q.where&&(query+="WHERE "+this.group(q.where,!0)+this._newline),q.updates&&(query+=mapJoin(q.updates,";"+this._newline,this.toUpdate,this)),q.group&&(query+="GROUP BY "+mapJoin(q.group,void 0,function(it){var result=isString(it.expression)?it.expression:"("+this.toExpression(it.expression)+")";return it.variable?"("+result+" AS ?"+it.variable.value+")":result},this)+this._newline),q.having&&(query+="HAVING ("+mapJoin(q.having,void 0,this.toExpression,this)+")"+this._newline),q.order&&(query+="ORDER BY "+mapJoin(q.order,void 0,function(it){var expr="("+this.toExpression(it.expression)+")";return it.descending?"DESC "+expr:expr},this)+this._newline),q.offset&&(query+="OFFSET "+q.offset+this._newline),q.limit&&(query+="LIMIT "+q.limit+this._newline),q.values&&(query+=this.values(q)),(query=this.baseAndPrefixes(q)+query).trim()},Generator.prototype.baseAndPrefixes=function(q){var key,base=q.base?"BASE <"+q.base+">"+this._newline:"",prefixes="";for(key in q.prefixes)(this._options.allPrefixes||this._usedPrefixes[key])&&(prefixes+="PREFIX "+key+": <"+q.prefixes[key]+">"+this._newline);return base+prefixes},Generator.prototype.toPattern=function(pattern){var type=pattern.type||pattern instanceof Array&&"array"||(pattern.subject&&pattern.predicate&&pattern.object?"triple":"");if(!(type in this))throw new Error("Unknown entry type: "+type);return this[type](pattern)},Generator.prototype.triple=function(t){return this.toEntity(t.subject)+" "+this.toEntity(t.predicate)+" "+this.toEntity(t.object)+"."},Generator.prototype.array=function(items){return mapJoin(items,this._newline,this.toPattern,this)},Generator.prototype.bgp=function(bgp){return this.encodeTriples(bgp.triples)},Generator.prototype.encodeTriples=function(triples){if(!triples.length)return"";for(var parts=[],subject=void 0,predicate=void 0,i=0;i":case">=":case"<=":case"&&":case"||":case"=":case"!=":case"+":case"-":case"*":case"/":return(isTerm(args[0])?this.toEntity(args[0]):"("+this.toExpression(args[0])+")")+" "+operator+" "+(isTerm(args[1])?this.toEntity(args[1]):"("+this.toExpression(args[1])+")");case"!":return"!("+this.toExpression(args[0])+")";case"uminus":return"-("+this.toExpression(args[0])+")";case"notin":operator="NOT IN";case"in":return this.toExpression(args[0])+" "+operator+"("+(isString(args[1])?args[1]:mapJoin(args[1],", ",this.toExpression,this))+")";case"notexists":operator="NOT EXISTS";case"exists":return operator+" "+this.group(args[0],!0);default:return operator+"("+mapJoin(args,", ",this.toExpression,this)+")"}default:throw new Error("Unknown expression type: "+expr.type)}},Generator.prototype.toEntity=function(value){if(isTerm(value))switch(value.termType){case"Wildcard":return"*";case"Variable":return"?"+value.value;case"BlankNode":return"_:"+value.value;case"Literal":var lexical=value.value||"",language=value.language||"",datatype=value.datatype;if(value='"'+lexical.replace(escape,escapeReplacer)+'"',language)value+="@"+language;else if(datatype){if(!this._explicitDatatype)switch(datatype.value){case"http://www.w3.org/2001/XMLSchema#string":return value;case"http://www.w3.org/2001/XMLSchema#integer":if(/^\d+$/.test(lexical))return lexical+" "}value+="^^"+this.encodeIRI(datatype.value)}return value;case"Quad":if(!this._sparqlStar)throw new Error("SPARQL* support is not enabled");return value.graph&&"DefaultGraph"!==value.graph.termType?"<< GRAPH "+this.toEntity(value.graph)+" { "+this.toEntity(value.subject)+" "+this.toEntity(value.predicate)+" "+this.toEntity(value.object)+" } >>":"<< "+this.toEntity(value.subject)+" "+this.toEntity(value.predicate)+" "+this.toEntity(value.object)+" >>";default:return this.encodeIRI(value.value)}else{var items=value.items.map(this.toEntity,this),path=value.pathType;switch(path){case"^":case"!":return path+items[0];case"*":case"+":case"?":return"("+items[0]+path+")";default:return"("+items.join(path)+")"}}};var escape=/["\\\t\n\r\b\f]/g,escapeReplacer=function(c){return escapeReplacements[c]},escapeReplacements={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};function isString(object){return"string"==typeof object}function isTerm(object){return"string"==typeof object.termType}function equalTerms(term1,term2){if(!term1||!isTerm(term1))return!1;if(!term2||!isTerm(term2))return!1;if(term1.termType!==term2.termType)return!1;switch(term1.termType){case"Literal":return term1.value===term2.value&&term1.language===term2.language&&equalTerms(term1.datatype,term2.datatype);case"Quad":return equalTerms(term1.subject,term2.subject)&&equalTerms(term1.predicate,term2.predicate)&&equalTerms(term1.object,term2.object)&&equalTerms(term1.graph,term2.graph);default:return term1.value===term2.value}}function mapJoin(array,sep,func,self){return array.map(func,self).join(isString(sep)?sep:" ")}Generator.prototype.encodeIRI=function(iri){var prefixMatch=this._prefixRegex.exec(iri);if(prefixMatch){var prefix=this._prefixByIri[prefixMatch[1]];return this._usedPrefixes[prefix]=!0,prefix+":"+prefixMatch[2]}return"<"+iri+">"},Generator.prototype.toUpdate=function(update){switch(update.type||update.updateType){case"load":return"LOAD"+(update.source?" "+this.toEntity(update.source):"")+(update.destination?" INTO GRAPH "+this.toEntity(update.destination):"");case"insert":return"INSERT DATA "+this.group(update.insert,!0);case"delete":return"DELETE DATA "+this.group(update.delete,!0);case"deletewhere":return"DELETE WHERE "+this.group(update.delete,!0);case"insertdelete":return(update.graph?"WITH "+this.toEntity(update.graph)+this._newline:"")+(update.delete.length?"DELETE "+this.group(update.delete,!0)+this._newline:"")+(update.insert.length?"INSERT "+this.group(update.insert,!0)+this._newline:"")+(update.using?this.graphs("USING ",update.using.default):"")+(update.using?this.graphs("USING NAMED ",update.using.named):"")+"WHERE "+this.group(update.where,!0);case"add":case"copy":case"move":return update.type.toUpperCase()+(update.source.default?" DEFAULT ":" ")+"TO "+this.toEntity(update.destination.name);case"create":case"clear":case"drop":return update.type.toUpperCase()+(update.silent?" SILENT ":" ")+(update.graph.default?"DEFAULT":update.graph.named?"NAMED":update.graph.all?"ALL":"GRAPH "+this.toEntity(update.graph.name));default:throw new Error("Unknown update query type: "+update.type)}},Generator.prototype.indent=function(text){return text.replace(/^/gm,this._indent)},module.exports=function(options={}){return{stringify:function(query){var currentOptions=Object.create(options);return currentOptions.prefixes=query.prefixes,new Generator(currentOptions).toQuery(query)},createGenerator:function(){return new Generator(options)}}}},{}],38:[function(require,module,exports){!function(process){!function(){var SparqlParser=function(){var parser=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[6,12,15,28,41,50,55,107,117,120,122,123,132,133,138,320,321,322,323,324],$V1=[2,208],$V2=[107,117,120,122,123,132,133,138,320,321,322,323,324],$V3=[1,20],$V4=[1,29],$V5=[6,90],$V6=[45,46,58],$V7=[45,58],$V8=[1,58],$V9=[1,60],$Va=[1,56],$Vb=[1,59],$Vc=[1,65],$Vd=[1,66],$Ve=[26,34,35],$Vf=[13,16,310],$Vg=[119,141,318,325],$Vh=[13,16,119,141,310],$Vi=[1,88],$Vj=[1,92],$Vk=[1,94],$Vl=[119,141,318,319,325],$Vm=[13,16,119,141,310,319],$Vn=[1,100],$Vo=[2,250],$Vp=[1,99],$Vq=[13,16,34,35,87,93,224,229,243,244,297,298,299,300,301,302,303,304,305,306,307,308,309,310],$Vr=[6,45,46,58,68,75,78,86,88,90],$Vs=[6,13,16,34,45,46,58,68,75,78,86,88,90,310],$Vt=[6,13,16,26,34,35,37,38,45,46,48,58,68,75,78,86,87,88,90,93,100,116,119,132,133,135,140,167,168,170,173,174,191,195,217,222,224,225,229,233,243,244,248,252,256,271,276,293,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326,328,329,331,332,333,334,335,336,337,338],$Vu=[34,35,45,46,58],$Vv=[13,16,34,35,87,273,274,275,277,279,280,282,283,286,288,297,298,299,300,301,302,303,304,305,306,307,308,309,310,338,339,340,341,342,343],$Vw=[2,451],$Vx=[1,123],$Vy=[1,117],$Vz=[1,124],$VA=[1,125],$VB=[6,13,16,34,35,46,48,87,90,93,119,167,168,170,173,174,224,229,243,244,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326],$VC=[2,309],$VD=[1,142],$VE=[1,140],$VF=[6,191],$VG=[2,326],$VH=[2,314],$VI=[45,135],$VJ=[6,48,78,86,88,90],$VK=[2,254],$VL=[1,156],$VM=[1,158],$VN=[6,48,75,78,86,88,90],$VO=[2,252],$VP=[1,164],$VQ=[1,176],$VR=[1,174],$VS=[1,184],$VT=[1,182],$VU=[1,175],$VV=[1,180],$VW=[1,181],$VX=[1,185],$VY=[1,186],$VZ=[1,189],$V_=[1,190],$V$=[1,191],$V01=[1,192],$V11=[1,193],$V21=[1,194],$V31=[1,195],$V41=[1,196],$V51=[1,197],$V61=[1,198],$V71=[1,199],$V81=[6,68,75,78,86,88,90],$V91=[37,38,191,248,276],$Va1=[37,38,191,248,252,276],$Vb1=[37,38,191,248,252,256,271,276,293,304,305,306,307,308,309,332,333,334,335,336,337,338],$Vc1=[26,37,38,191,248,252,256,271,276,293,304,305,306,307,308,309,329,332,333,334,335,336,337,338],$Vd1=[1,229],$Ve1=[1,230],$Vf1=[1,232],$Vg1=[1,233],$Vh1=[1,234],$Vi1=[1,235],$Vj1=[1,237],$Vk1=[1,238],$Vl1=[2,458],$Vm1=[1,240],$Vn1=[1,241],$Vo1=[1,242],$Vp1=[1,248],$Vq1=[1,243],$Vr1=[1,244],$Vs1=[1,245],$Vt1=[1,246],$Vu1=[1,247],$Vv1=[13,16,48,87,100,229,297,298,299,300,301,302,303,304,305,306,307,308,309,310],$Vw1=[48,93],$Vx1=[34,38],$Vy1=[6,116,191],$Vz1=[48,119],$VA1=[6,48,86,88,90],$VB1=[2,338],$VC1=[2,330],$VD1=[1,293],$VE1=[1,295],$VF1=[48,119,326],$VG1=[13,16,34,195,310],$VH1=[13,16,34,35,38,46,48,87,90,93,119,167,168,170,173,174,191,195,217,222,224,225,229,233,243,244,276,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326],$VI1=[13,16,26,34,35,37,38,46,48,87,90,93,100,119,167,168,170,173,174,191,195,217,222,224,225,229,233,243,244,248,252,256,271,276,293,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326,329,332,333,334,335,336,337,338],$VJ1=[13,16,26,34,35,37,38,46,48,87,90,93,100,119,167,168,170,173,174,191,195,217,222,224,225,229,233,243,244,248,252,256,271,276,293,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326,329,332,333,334,335,336,337,338],$VK1=[13,16,34,35,87,217,271,273,274,275,277,279,280,282,283,286,288,297,298,299,300,301,302,303,304,305,306,307,308,309,310,332,338,339,340,341,342,343],$VL1=[1,329],$VM1=[1,330],$VN1=[1,332],$VO1=[1,331],$VP1=[6,13,16,26,34,35,37,38,46,48,75,78,81,83,86,87,88,90,93,119,167,168,170,173,174,191,224,229,243,244,248,252,256,271,273,274,275,276,277,279,280,282,283,286,288,293,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326,329,332,333,334,335,336,337,338,339,340,341,342,343],$VQ1=[1,340],$VR1=[1,339],$VS1=[35,93],$VT1=[1,353],$VU1=[1,354],$VV1=[1,367],$VW1=[6,48,90],$VX1=[6,13,16,35,48,78,86,88,90,273,274,275,277,279,280,282,283,286,288,310,338,339,340,341,342,343],$VY1=[6,13,16,34,35,46,48,78,81,83,86,87,88,90,93,119,167,168,170,173,174,224,229,243,244,273,274,275,277,279,280,282,283,286,288,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326,338,339,340,341,342,343],$VZ1=[46,48,90,119,167,168,170,173,174],$V_1=[1,386],$V$1=[1,387],$V02=[1,393],$V12=[1,392],$V22=[48,119,191,225,326],$V32=[2,370],$V42=[13,16,34,35,38,87,93,224,229,243,244,297,298,299,300,301,302,303,304,305,306,307,308,309,310],$V52=[13,16,34,35,38,46,48,87,90,93,119,167,168,170,173,174,191,224,225,229,243,244,276,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326],$V62=[13,16,26,34,35,87,217,271,273,274,275,277,279,280,282,283,286,288,297,298,299,300,301,302,303,304,305,306,307,308,309,310,332,338,339,340,341,342,343],$V72=[13,16,38,48,87,100,229,297,298,299,300,301,302,303,304,305,306,307,308,309,310],$V82=[35,48],$V92=[2,329],$Va2=[1,451],$Vb2=[1,448],$Vc2=[1,449],$Vd2=[6,13,16,26,34,35,37,38,46,48,68,75,78,81,83,86,87,88,90,93,119,167,168,170,173,174,191,224,229,243,244,248,252,256,271,273,274,275,276,277,279,280,282,283,286,288,293,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326,327,329,332,333,334,335,336,337,338,339,340,341,342,343],$Ve2=[13,16,35,195,217,222,310],$Vf2=[2,384],$Vg2=[1,469],$Vh2=[46,48,90,119,167,168,170,173,174,326],$Vi2=[13,16,34,35,195,217,222,310],$Vj2=[6,13,16,34,35,48,75,78,86,88,90,273,274,275,277,279,280,282,283,286,288,310,338,339,340,341,342,343],$Vk2=[13,16,34,35,38,46,48,87,90,93,119,167,168,170,173,174,191,195,224,225,229,243,244,276,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326],$Vl2=[6,13,16,34,35,48,81,83,86,88,90,273,274,275,277,279,280,282,283,286,288,310,338,339,340,341,342,343],$Vm2=[13,16,34,35,46,48,87,90,93,119,167,168,170,173,174,224,229,243,244,297,298,299,300,301,302,303,304,305,306,307,308,309,310],$Vn2=[13,16,34,310],$Vo2=[13,16,34,35,46,48,87,90,93,119,167,168,170,173,174,224,229,243,244,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326],$Vp2=[2,341],$Vq2=[46,48,90,119,167,168,170,173,174,191,225,326],$Vr2=[13,16,34,35,37,38,46,48,87,90,93,119,167,168,170,173,174,191,195,217,222,224,225,229,233,243,244,276,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326],$Vs2=[2,336],$Vt2=[13,16,35,195,217,310],$Vu2=[13,16,34,35,38,46,48,87,90,93,119,167,168,170,173,174,191,195,217,222,224,225,229,243,244,276,297,298,299,300,301,302,303,304,305,306,307,308,309,310,326],$Vv2=[13,16,38,87,100,229,297,298,299,300,301,302,303,304,305,306,307,308,309,310],$Vw2=[13,16,34,38,48,87,100,195,229,233,297,298,299,300,301,302,303,304,305,306,307,308,309,310],$Vx2=[13,16,34,35,48,87,93,119,224,229,243,244,297,298,299,300,301,302,303,304,305,306,307,308,309,310],$Vy2=[13,16,34,35,38,87,93,224,229,243,244,297,298,299,300,301,302,303,304,305,306,307,308,309,310,328,329],$Vz2=[13,16,26,34,35,38,87,93,224,229,243,244,297,298,299,300,301,302,303,304,305,306,307,308,309,310,328,329,331,332],$VA2=[1,630],$VB2=[1,631],$VC2=[2,324],XSD=[13,16,38,195,222,310],parser={trace:function(){},yy:{},symbols_:{error:2,QueryOrUpdate:3,Prologue:4,QueryOrUpdate_group0:5,EOF:6,Prologue_repetition0:7,Query:8,Query_group0:9,Query_option0:10,BaseDecl:11,BASE:12,IRIREF:13,PrefixDecl:14,PREFIX:15,PNAME_NS:16,SelectQuery:17,SelectClauseWildcard:18,SelectQuery_repetition0:19,WhereClause:20,SolutionModifierNoGroup:21,SelectClauseVars:22,SelectQuery_repetition1:23,SolutionModifier:24,SelectClauseBase:25,"*":26,SelectClauseVars_repetition_plus0:27,SELECT:28,SelectClauseBase_option0:29,SubSelect:30,SubSelect_option0:31,SubSelect_option1:32,SelectClauseItem:33,VAR:34,"(":35,Expression:36,AS:37,")":38,VarTriple:39,ConstructQuery:40,CONSTRUCT:41,ConstructTemplate:42,ConstructQuery_repetition0:43,ConstructQuery_repetition1:44,WHERE:45,"{":46,ConstructQuery_option0:47,"}":48,DescribeQuery:49,DESCRIBE:50,DescribeQuery_group0:51,DescribeQuery_repetition0:52,DescribeQuery_option0:53,AskQuery:54,ASK:55,AskQuery_repetition0:56,DatasetClause:57,FROM:58,DatasetClause_option0:59,iri:60,WhereClause_option0:61,GroupGraphPattern:62,SolutionModifier_option0:63,SolutionModifierNoGroup_option0:64,SolutionModifierNoGroup_option1:65,SolutionModifierNoGroup_option2:66,GroupClause:67,GROUP:68,BY:69,GroupClause_repetition_plus0:70,GroupCondition:71,BuiltInCall:72,FunctionCall:73,HavingClause:74,HAVING:75,HavingClause_repetition_plus0:76,OrderClause:77,ORDER:78,OrderClause_repetition_plus0:79,OrderCondition:80,ASC:81,BrackettedExpression:82,DESC:83,Constraint:84,LimitOffsetClauses:85,LIMIT:86,INTEGER:87,OFFSET:88,ValuesClause:89,VALUES:90,InlineData:91,InlineData_repetition0:92,NIL:93,InlineData_repetition1:94,InlineData_repetition_plus2:95,InlineData_repetition3:96,DataBlockValue:97,Literal:98,ConstTriple:99,UNDEF:100,DataBlockValueList:101,DataBlockValueList_repetition_plus0:102,Update:103,Update_repetition0:104,Update1:105,Update_option0:106,LOAD:107,Update1_option0:108,Update1_option1:109,Update1_group0:110,Update1_option2:111,GraphRefAll:112,Update1_group1:113,Update1_option3:114,GraphOrDefault:115,TO:116,CREATE:117,Update1_option4:118,GRAPH:119,INSERTDATA:120,QuadPattern:121,DELETEDATA:122,DELETEWHERE:123,Update1_option5:124,InsertClause:125,Update1_option6:126,Update1_repetition0:127,Update1_option7:128,DeleteClause:129,Update1_option8:130,Update1_repetition1:131,DELETE:132,INSERT:133,UsingClause:134,USING:135,UsingClause_option0:136,WithClause:137,WITH:138,IntoGraphClause:139,INTO:140,DEFAULT:141,GraphOrDefault_option0:142,GraphRefAll_group0:143,QuadPattern_option0:144,QuadPattern_repetition0:145,QuadsNotTriples:146,QuadsNotTriples_group0:147,QuadsNotTriples_option0:148,QuadsNotTriples_option1:149,QuadsNotTriples_option2:150,TriplesTemplate:151,TriplesTemplate_repetition0:152,TriplesSameSubject:153,TriplesTemplate_option0:154,GroupGraphPatternSub:155,GroupGraphPatternSub_option0:156,GroupGraphPatternSub_repetition0:157,GroupGraphPatternSubTail:158,GraphPatternNotTriples:159,GroupGraphPatternSubTail_option0:160,GroupGraphPatternSubTail_option1:161,TriplesBlock:162,TriplesBlock_repetition0:163,TriplesSameSubjectPath:164,TriplesBlock_option0:165,GraphPatternNotTriples_repetition0:166,OPTIONAL:167,MINUS:168,GraphPatternNotTriples_group0:169,SERVICE:170,GraphPatternNotTriples_option0:171,GraphPatternNotTriples_group1:172,FILTER:173,BIND:174,FunctionCall_option0:175,FunctionCall_repetition0:176,ExpressionList:177,ExpressionList_repetition0:178,ConstructTemplate_option0:179,ConstructTriples:180,ConstructTriples_repetition0:181,ConstructTriples_option0:182,TriplesSameSubject_group0:183,PropertyListNotEmpty:184,TriplesNode:185,PropertyList:186,PropertyList_option0:187,VerbObjectList:188,PropertyListNotEmpty_repetition0:189,SemiOptionalVerbObjectList:190,";":191,SemiOptionalVerbObjectList_option0:192,Verb:193,ObjectList:194,a:195,ObjectList_repetition0:196,GraphNode:197,TriplesSameSubjectPath_group0:198,PropertyListPathNotEmpty:199,TriplesNodePath:200,TriplesSameSubjectPath_option0:201,PropertyListPathNotEmpty_group0:202,PropertyListPathNotEmpty_repetition0:203,GraphNodePath:204,PropertyListPathNotEmpty_repetition1:205,PropertyListPathNotEmptyTail:206,PropertyListPathNotEmptyTail_group0:207,Path:208,Path_repetition0:209,PathSequence:210,PathSequence_repetition0:211,PathEltOrInverse:212,PathElt:213,PathPrimary:214,PathElt_option0:215,PathEltOrInverse_option0:216,"!":217,PathNegatedPropertySet:218,PathOneInPropertySet:219,PathNegatedPropertySet_repetition0:220,PathNegatedPropertySet_option0:221,"^":222,TriplesNode_repetition_plus0:223,"[":224,"]":225,TriplesNodePath_repetition_plus0:226,GraphNode_group0:227,GraphNodePath_group0:228,"<<":229,VarTriple_group0:230,VarTriple_group1:231,VarTriple_group2:232,">>":233,VarTriple_group3:234,VarTriple_group4:235,ConstTriple_group0:236,ConstTriple_group1:237,ConstTriple_group2:238,ConstTriple_group3:239,ConstTriple_group4:240,VarOrTerm:241,Term:242,BLANK_NODE_LABEL:243,ANON:244,ConditionalAndExpression:245,Expression_repetition0:246,ExpressionTail:247,"||":248,RelationalExpression:249,ConditionalAndExpression_repetition0:250,ConditionalAndExpressionTail:251,"&&":252,AdditiveExpression:253,RelationalExpression_group0:254,RelationalExpression_option0:255,IN:256,MultiplicativeExpression:257,AdditiveExpression_repetition0:258,AdditiveExpressionTail:259,AdditiveExpressionTail_group0:260,NumericLiteralPositive:261,AdditiveExpressionTail_repetition0:262,NumericLiteralNegative:263,AdditiveExpressionTail_repetition1:264,UnaryExpression:265,MultiplicativeExpression_repetition0:266,MultiplicativeExpressionTail:267,MultiplicativeExpressionTail_group0:268,UnaryExpression_option0:269,PrimaryExpression:270,"-":271,Aggregate:272,FUNC_ARITY0:273,FUNC_ARITY1:274,FUNC_ARITY2:275,",":276,IF:277,BuiltInCall_group0:278,BOUND:279,BNODE:280,BuiltInCall_option0:281,EXISTS:282,COUNT:283,Aggregate_option0:284,Aggregate_group0:285,FUNC_AGGREGATE:286,Aggregate_option1:287,GROUP_CONCAT:288,Aggregate_option2:289,Aggregate_option3:290,GroupConcatSeparator:291,SEPARATOR:292,"=":293,String:294,LANGTAG:295,"^^":296,DECIMAL:297,DOUBLE:298,BOOLEAN:299,STRING_LITERAL1:300,STRING_LITERAL2:301,STRING_LITERAL_LONG1:302,STRING_LITERAL_LONG2:303,INTEGER_POSITIVE:304,DECIMAL_POSITIVE:305,DOUBLE_POSITIVE:306,INTEGER_NEGATIVE:307,DECIMAL_NEGATIVE:308,DOUBLE_NEGATIVE:309,PNAME_LN:310,QueryOrUpdate_group0_option0:311,Prologue_repetition0_group0:312,SelectClauseBase_option0_group0:313,DISTINCT:314,REDUCED:315,DescribeQuery_group0_repetition_plus0_group0:316,DescribeQuery_group0_repetition_plus0:317,NAMED:318,SILENT:319,CLEAR:320,DROP:321,ADD:322,MOVE:323,COPY:324,ALL:325,".":326,UNION:327,"|":328,"/":329,PathElt_option0_group0:330,"?":331,"+":332,"!=":333,"<":334,">":335,"<=":336,">=":337,NOT:338,CONCAT:339,COALESCE:340,SUBSTR:341,REGEX:342,REPLACE:343,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",12:"BASE",13:"IRIREF",15:"PREFIX",16:"PNAME_NS",26:"*",28:"SELECT",34:"VAR",35:"(",37:"AS",38:")",41:"CONSTRUCT",45:"WHERE",46:"{",48:"}",50:"DESCRIBE",55:"ASK",58:"FROM",68:"GROUP",69:"BY",75:"HAVING",78:"ORDER",81:"ASC",83:"DESC",86:"LIMIT",87:"INTEGER",88:"OFFSET",90:"VALUES",93:"NIL",100:"UNDEF",107:"LOAD",116:"TO",117:"CREATE",119:"GRAPH",120:"INSERTDATA",122:"DELETEDATA",123:"DELETEWHERE",132:"DELETE",133:"INSERT",135:"USING",138:"WITH",140:"INTO",141:"DEFAULT",167:"OPTIONAL",168:"MINUS",170:"SERVICE",173:"FILTER",174:"BIND",191:";",195:"a",217:"!",222:"^",224:"[",225:"]",229:"<<",233:">>",243:"BLANK_NODE_LABEL",244:"ANON",248:"||",252:"&&",256:"IN",271:"-",273:"FUNC_ARITY0",274:"FUNC_ARITY1",275:"FUNC_ARITY2",276:",",277:"IF",279:"BOUND",280:"BNODE",282:"EXISTS",283:"COUNT",286:"FUNC_AGGREGATE",288:"GROUP_CONCAT",292:"SEPARATOR",293:"=",295:"LANGTAG",296:"^^",297:"DECIMAL",298:"DOUBLE",299:"BOOLEAN",300:"STRING_LITERAL1",301:"STRING_LITERAL2",302:"STRING_LITERAL_LONG1",303:"STRING_LITERAL_LONG2",304:"INTEGER_POSITIVE",305:"DECIMAL_POSITIVE",306:"DOUBLE_POSITIVE",307:"INTEGER_NEGATIVE",308:"DECIMAL_NEGATIVE",309:"DOUBLE_NEGATIVE",310:"PNAME_LN",314:"DISTINCT",315:"REDUCED",318:"NAMED",319:"SILENT",320:"CLEAR",321:"DROP",322:"ADD",323:"MOVE",324:"COPY",325:"ALL",326:".",327:"UNION",328:"|",329:"/",331:"?",332:"+",333:"!=",334:"<",335:">",336:"<=",337:">=",338:"NOT",339:"CONCAT",340:"COALESCE",341:"SUBSTR",342:"REGEX",343:"REPLACE"},productions_:[0,[3,3],[4,1],[8,2],[11,2],[14,3],[17,4],[17,4],[18,2],[22,2],[25,2],[30,4],[30,4],[33,1],[33,5],[33,5],[40,5],[40,7],[49,5],[54,4],[57,3],[20,2],[24,2],[21,3],[67,3],[71,1],[71,1],[71,3],[71,5],[71,1],[74,2],[77,3],[80,2],[80,2],[80,1],[80,1],[85,2],[85,2],[85,4],[85,4],[89,2],[91,4],[91,4],[91,6],[97,1],[97,1],[97,1],[97,1],[101,3],[103,3],[105,4],[105,3],[105,5],[105,4],[105,2],[105,2],[105,2],[105,6],[105,6],[129,2],[125,2],[134,3],[137,2],[139,3],[115,1],[115,2],[112,2],[112,1],[121,4],[146,7],[151,3],[62,3],[62,3],[155,2],[158,3],[162,3],[159,2],[159,2],[159,2],[159,3],[159,4],[159,2],[159,6],[159,6],[159,1],[84,1],[84,1],[84,1],[73,2],[73,6],[177,1],[177,4],[42,3],[180,3],[153,2],[153,2],[186,1],[184,2],[190,2],[188,2],[193,1],[193,1],[193,1],[194,2],[164,2],[164,2],[199,4],[206,1],[206,3],[208,2],[210,2],[213,2],[212,2],[214,1],[214,1],[214,2],[214,3],[218,1],[218,1],[218,4],[219,1],[219,1],[219,2],[219,2],[185,3],[185,3],[200,3],[200,3],[197,1],[197,1],[204,1],[204,1],[39,9],[39,5],[99,9],[99,5],[241,1],[241,1],[242,1],[242,1],[242,1],[242,1],[242,1],[36,2],[247,2],[245,2],[251,2],[249,1],[249,3],[249,4],[253,2],[259,2],[259,2],[259,2],[257,2],[267,2],[265,2],[265,2],[265,2],[270,1],[270,1],[270,1],[270,1],[270,1],[270,1],[82,3],[72,1],[72,2],[72,4],[72,6],[72,8],[72,2],[72,4],[72,2],[72,4],[72,3],[272,5],[272,5],[272,6],[291,4],[98,1],[98,2],[98,3],[98,1],[98,1],[98,1],[98,1],[98,1],[98,1],[294,1],[294,1],[294,1],[294,1],[261,1],[261,1],[261,1],[263,1],[263,1],[263,1],[60,1],[60,1],[60,1],[311,0],[311,1],[5,1],[5,1],[312,1],[312,1],[7,0],[7,2],[9,1],[9,1],[9,1],[9,1],[10,0],[10,1],[19,0],[19,2],[23,0],[23,2],[27,1],[27,2],[313,1],[313,1],[29,0],[29,1],[31,0],[31,1],[32,0],[32,1],[43,0],[43,2],[44,0],[44,2],[47,0],[47,1],[316,1],[316,1],[317,1],[317,2],[51,1],[51,1],[52,0],[52,2],[53,0],[53,1],[56,0],[56,2],[59,0],[59,1],[61,0],[61,1],[63,0],[63,1],[64,0],[64,1],[65,0],[65,1],[66,0],[66,1],[70,1],[70,2],[76,1],[76,2],[79,1],[79,2],[92,0],[92,2],[94,0],[94,2],[95,1],[95,2],[96,0],[96,2],[102,1],[102,2],[104,0],[104,4],[106,0],[106,2],[108,0],[108,1],[109,0],[109,1],[110,1],[110,1],[111,0],[111,1],[113,1],[113,1],[113,1],[114,0],[114,1],[118,0],[118,1],[124,0],[124,1],[126,0],[126,1],[127,0],[127,2],[128,0],[128,1],[130,0],[130,1],[131,0],[131,2],[136,0],[136,1],[142,0],[142,1],[143,1],[143,1],[143,1],[144,0],[144,1],[145,0],[145,2],[147,1],[147,1],[148,0],[148,1],[149,0],[149,1],[150,0],[150,1],[152,0],[152,3],[154,0],[154,1],[156,0],[156,1],[157,0],[157,2],[160,0],[160,1],[161,0],[161,1],[163,0],[163,3],[165,0],[165,1],[166,0],[166,3],[169,1],[169,1],[171,0],[171,1],[172,1],[172,1],[175,0],[175,1],[176,0],[176,3],[178,0],[178,3],[179,0],[179,1],[181,0],[181,3],[182,0],[182,1],[183,1],[183,1],[187,0],[187,1],[189,0],[189,2],[192,0],[192,1],[196,0],[196,3],[198,1],[198,1],[201,0],[201,1],[202,1],[202,1],[203,0],[203,3],[205,0],[205,2],[207,1],[207,1],[209,0],[209,3],[211,0],[211,3],[330,1],[330,1],[330,1],[215,0],[215,1],[216,0],[216,1],[220,0],[220,3],[221,0],[221,1],[223,1],[223,2],[226,1],[226,2],[227,1],[227,1],[228,1],[228,1],[230,1],[230,1],[231,1],[231,1],[232,1],[232,1],[234,1],[234,1],[235,1],[235,1],[236,1],[236,1],[237,1],[237,1],[238,1],[238,1],[239,1],[239,1],[240,1],[240,1],[246,0],[246,2],[250,0],[250,2],[254,1],[254,1],[254,1],[254,1],[254,1],[254,1],[255,0],[255,1],[258,0],[258,2],[260,1],[260,1],[262,0],[262,2],[264,0],[264,2],[266,0],[266,2],[268,1],[268,1],[269,0],[269,1],[278,1],[278,1],[278,1],[278,1],[278,1],[281,0],[281,1],[284,0],[284,1],[285,1],[285,1],[287,0],[287,1],[289,0],[289,1],[290,0],[290,1]],performAction:function(yytext,yyleng,yylineno,yy,yystate,$$,_$){var entity,$0=$$.length-1;switch(yystate){case 1:if($$[$0-1]=$$[$0-1]||{},Parser.base&&($$[$0-1].base=Parser.base),Parser.base="",$$[$0-1].prefixes=Parser.prefixes,Parser.prefixes=null,"update"===$$[$0-1].type){const insertBnodesAll={};for(const update of $$[$0-1].updates)if("insert"===update.updateType){const insertBnodes={};for(const operation of update.insert)if("bgp"===operation.type||"graph"===operation.type)for(const triple of operation.triples)"BlankNode"===triple.subject.termType&&(insertBnodes[triple.subject.value]=!0),"BlankNode"===triple.predicate.termType&&(insertBnodes[triple.predicate.value]=!0),"BlankNode"===triple.object.termType&&(insertBnodes[triple.object.value]=!0);for(const bnode of Object.keys(insertBnodes)){if(insertBnodesAll[bnode])throw new Error("Detected reuse blank node across different INSERT DATA clauses");insertBnodesAll[bnode]=!0}}}return $$[$0-1];case 3:this.$=extend($$[$0-1],$$[$0],{type:"query"});break;case 4:Parser.base=resolveIRI($$[$0]);break;case 5:Parser.prefixes||(Parser.prefixes={}),$$[$0-1]=$$[$0-1].substr(0,$$[$0-1].length-1),$$[$0]=resolveIRI($$[$0]),Parser.prefixes[$$[$0-1]]=$$[$0];break;case 6:this.$=extend($$[$0-3],groupDatasets($$[$0-2]),$$[$0-1],$$[$0]);break;case 7:if(!Parser.skipUngroupedVariableCheck)if(flatten($$[$0-3].variables.map(vars=>getAggregatesOfExpression(vars.expression))).some(agg=>"count"===agg.aggregation&&!(agg.expression instanceof Wildcard))||$$[$0].group)for(const selectVar of $$[$0-3].variables)if("Variable"===selectVar.termType){if(!$$[$0].group||!$$[$0].group.map(groupVar=>getExpressionId(groupVar)).includes(getExpressionId(selectVar)))throw Error("Projection of ungrouped variable (?"+getExpressionId(selectVar)+")")}else if(0===getAggregatesOfExpression(selectVar.expression).length)for(const usedVar of function(expression){const variables=new Set,visitExpression=function(expr){expr&&("Variable"===expr.termType?variables.add(expr):"operation"===expr.type&&expr.args.forEach(visitExpression))};return visitExpression(expression),variables}(selectVar.expression))if(!$$[$0].group.map(groupVar=>getExpressionId(groupVar)).includes(getExpressionId(usedVar)))throw Error("Use of ungrouped variable in projection of operation (?"+getExpressionId(usedVar)+")");const subqueries=$$[$0-1].where.filter(w=>"query"===w.type);if(0v.variable&&v.variable.value).map(v=>v.variable.value),subqueryIds=flatten(subqueries.map(sub=>sub.variables)).map(v=>v.value||v.variable.value);for(const selectedVarId of selectedVarIds)if(0<=subqueryIds.indexOf(selectedVarId))throw Error("Target id of 'AS' (?"+selectedVarId+") already used in subquery")}this.$=extend($$[$0-3],groupDatasets($$[$0-2]),$$[$0-1],$$[$0]);break;case 8:this.$=extend($$[$0-1],{variables:[new Wildcard]});break;case 9:var graph=function(array){const sortedArray=array.slice().sort(),duplicates=[];for(let i=0;iv.value||v.variable.value));if(0"bind"===el.type)){var index=$$[$0-1].indexOf(binding);const boundVars=new Set;for(const el of $$[$0-1].slice(0,index))"group"!==el.type&&"bgp"!==el.type||!function getBoundVarsFromGroupGraphPattern(pattern){{if(pattern.triples){const boundVars=[];for(const triple of pattern.triples)isVariable(triple.subject)&&boundVars.push(triple.subject.value),isVariable(triple.predicate)&&boundVars.push(triple.predicate.value),isVariable(triple.object)&&boundVars.push(triple.object.value);return boundVars}if(pattern.patterns){const boundVars=[];for(const pat of pattern.patterns)boundVars.push(...getBoundVarsFromGroupGraphPattern(pat));return boundVars}}return[]}(el).forEach(boundVar=>boundVars.add(boundVar));if(boundVars.has(binding.variable.value))throw Error("Variable used to bind is already bound (?"+binding.variable.value+")")}this.$={type:"group",patterns:$$[$0-1]};break;case 73:this.$=$$[$0-1]?unionAll([$$[$0-1]],$$[$0]):unionAll($$[$0]);break;case 74:this.$=$$[$0]?[$$[$0-2],$$[$0]]:$$[$0-2];break;case 76:$$[$0-1].length?this.$={type:"union",patterns:unionAll($$[$0-1].map(degroupSingle),[degroupSingle($$[$0])])}:this.$=$$[$0];break;case 77:this.$=extend($$[$0],{type:"optional"});break;case 78:this.$=extend($$[$0],{type:"minus"});break;case 79:this.$=extend($$[$0],{type:"graph",name:toVar($$[$0-1])});break;case 80:this.$=extend($$[$0],{type:"service",name:toVar($$[$0-1]),silent:!!$$[$0-2]});break;case 81:this.$={type:"filter",expression:$$[$0]};break;case 82:this.$={type:"bind",variable:toVar($$[$0-1]),expression:$$[$0-3]};break;case 83:this.$=ensureSparqlStar({type:"bind",variable:toVar($$[$0-1]),expression:$$[$0-3]});break;case 88:this.$={type:"functionCall",function:$$[$0-1],args:[]};break;case 89:this.$={type:"functionCall",function:$$[$0-5],args:appendTo($$[$0-2],$$[$0-1]),distinct:!!$$[$0-3]};break;case 90:case 107:case 118:case 208:case 216:case 218:case 230:case 232:case 242:case 246:case 266:case 268:case 272:case 276:case 299:case 305:case 316:case 326:case 332:case 338:case 342:case 352:case 354:case 358:case 366:case 370:case 378:case 380:case 384:case 386:case 395:case 427:case 429:case 439:case 443:case 445:case 447:this.$=[];break;case 91:this.$=appendTo($$[$0-2],$$[$0-1]);break;case 93:this.$=unionAll($$[$0-2],[$$[$0-1]]);break;case 94:case 104:this.$=$$[$0].map(function(t){return extend(triple($$[$0-1]),t)});break;case 95:this.$=appendAllTo($$[$0].map(function(t){return extend(triple($$[$0-1].entity),t)}),$$[$0-1].triples);break;case 97:this.$=unionAll([$$[$0-1]],$$[$0]);break;case 98:this.$=unionAll($$[$0]);break;case 99:this.$=objectListToTriples($$[$0-1],$$[$0]);break;case 102:case 114:case 121:this.$=Parser.factory.namedNode(RDF_TYPE);break;case 103:this.$=appendTo($$[$0-1],$$[$0]);break;case 105:this.$=$$[$0]?appendAllTo($$[$0].map(function(t){return extend(triple($$[$0-1].entity),t)}),$$[$0-1].triples):$$[$0-1].triples;break;case 106:this.$=objectListToTriples(toVar($$[$0-3]),appendTo($$[$0-2],$$[$0-1]),$$[$0]);break;case 108:this.$=objectListToTriples(toVar($$[$0-1]),$$[$0]);break;case 109:this.$=$$[$0-1].length?path("|",appendTo($$[$0-1],$$[$0])):$$[$0];break;case 110:this.$=$$[$0-1].length?path("/",appendTo($$[$0-1],$$[$0])):$$[$0];break;case 111:this.$=$$[$0]?path($$[$0],[$$[$0-1]]):$$[$0-1];break;case 112:this.$=$$[$0-1]?path($$[$0-1],[$$[$0]]):$$[$0];break;case 115:case 122:this.$=path($$[$0-1],[$$[$0]]);break;case 119:this.$=path("|",appendTo($$[$0-2],$$[$0-1]));break;case 123:this.$=path($$[$0-1],[Parser.factory.namedNode(RDF_TYPE)]);break;case 124:case 126:this.$=function(objects){var list=blank(),head=list,listItems=[],triples=[];objects.forEach(function(o){listItems.push(o.entity),appendAllTo(triples,o.triples)});for(var i=0,j=0,l=listItems.length,listTriples=Array(2*l);i>10),56320+(1023&charCode))}replacement=escapeReplacements[replacement];if(!replacement)throw new Error;return replacement})}catch(error){return""}if(partialSurrogatesWithoutEndpoint.exec(string))throw new Error("Invalid unicode codepoint of surrogate pair without corresponding codepoint in "+string);return string}function objectListToTriples(predicate,objectList,otherTriples){var objects=[],triples=[];return objectList.forEach(function(l){objects.push(triple(null,predicate,l.entity)),appendAllTo(triples,l.triples)}),unionAll(objects,otherTriples||[],triples)}function getExpressionId(expression){return expression.variable?expression.variable.value:expression.value||expression.expression.value}function getAggregatesOfExpression(expression){if(!expression)return[];if("aggregate"===expression.type)return[expression];if("operation"!==expression.type)return[];{const aggregates=[];for(const arg of expression.args)aggregates.push(...getAggregatesOfExpression(arg));return aggregates}}function flatten(input,depth=1,stack=[]){for(const item of input)0match[0].length))if(match=tempMatch,index=i,this.options.backtrack_lexer){if(!1!==(token=this.test_match(tempMatch,rules[i])))return token;if(!this._backtrack)return!1;match=!1}else if(!this.options.flex)break;return match?!1!==(token=this.test_match(match,rules[index]))&&token:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var r=this.next();return r||this.lex()},begin:function(condition){this.conditionStack.push(condition)},popState:function(){return 0>)/i,/^(?:,)/i,/^(?:a)/i,/^(?:\|)/i,/^(?:\/)/i,/^(?:\^)/i,/^(?:\?)/i,/^(?:\+)/i,/^(?:!)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:\|\|)/i,/^(?:&&)/i,/^(?:=)/i,/^(?:!=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:IN)/i,/^(?:NOT)/i,/^(?:-)/i,/^(?:BOUND)/i,/^(?:BNODE)/i,/^(?:(RAND|NOW|UUID|STRUUID))/i,/^(?:(LANG|DATATYPE|IRI|URI|ABS|CEIL|FLOOR|ROUND|STRLEN|STR|UCASE|LCASE|ENCODE_FOR_URI|YEAR|MONTH|DAY|HOURS|MINUTES|SECONDS|TIMEZONE|TZ|MD5|SHA1|SHA256|SHA384|SHA512|isIRI|isURI|isBLANK|isLITERAL|isNUMERIC))/i,/^(?:(LANGMATCHES|CONTAINS|STRSTARTS|STRENDS|STRBEFORE|STRAFTER|STRLANG|STRDT|sameTerm))/i,/^(?:CONCAT)/i,/^(?:COALESCE)/i,/^(?:IF)/i,/^(?:REGEX)/i,/^(?:SUBSTR)/i,/^(?:REPLACE)/i,/^(?:EXISTS)/i,/^(?:COUNT)/i,/^(?:SUM|MIN|MAX|AVG|SAMPLE)/i,/^(?:GROUP_CONCAT)/i,/^(?:SEPARATOR)/i,/^(?:\^\^)/i,/^(?:true|false)/i,/^(?:(<(?:[^<>\"\{\}\|\^`\\\u0000-\u0020])*>))/i,/^(?:((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:))/i,/^(?:(((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:)((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|:|[0-9]|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))*(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%)))))?)))/i,/^(?:(_:(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?))/i,/^(?:([\?\$]((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])*)))/i,/^(?:(@[a-zA-Z]+(?:-[a-zA-Z0-9]+)*))/i,/^(?:([0-9]+))/i,/^(?:([0-9]*\.[0-9]+))/i,/^(?:([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+)))/i,/^(?:(\+([0-9]+)))/i,/^(?:(\+([0-9]*\.[0-9]+)))/i,/^(?:(\+([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:(-([0-9]+)))/i,/^(?:(-([0-9]*\.[0-9]+)))/i,/^(?:(-([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:([eE][+-]?[0-9]+))/i,/^(?:('(?:(?:[^\u0027\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*'))/i,/^(?:("(?:(?:[^\u0022\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*"))/i,/^(?:('''(?:(?:'|'')?(?:[^'\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*'''))/i,/^(?:("""(?:(?:"|"")?(?:[^\"\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*"""))/i,/^(?:(\((\u0020|\u0009|\u000D|\u000A)*\)))/i,/^(?:(\[(\u0020|\u0009|\u000D|\u000A)*\]))/i,/^(?:$)/i,/^(?:.)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121],inclusive:!0}}},new((Parser.prototype=parser).Parser=Parser)}();void 0!==require&&void 0!==exports&&(exports.parser=SparqlParser,exports.Parser=SparqlParser.Parser,exports.parse=function(){return SparqlParser.parse.apply(SparqlParser,arguments)},exports.main=function(source){source[1]||(console.log("Usage: "+source[0]+" FILE"),process.exit(1));source=require("fs").readFileSync(require("path").normalize(source[1]),"utf8");return exports.parser.parse(source)},void 0!==module&&require.main===module&&exports.main(process.argv.slice(1)))}.call(this)}.call(this,require("_process"))},{"./Wildcard":39,_process:21,fs:21,path:21}],39:[function(require,module,exports){class Wildcard{constructor(){return WILDCARD||this}equals(other){return other&&this.termType===other.termType}}Object.defineProperty(Wildcard.prototype,"value",{enumerable:!0,value:"*"}),Object.defineProperty(Wildcard.prototype,"termType",{enumerable:!0,value:"Wildcard"});var WILDCARD=new Wildcard;module.exports.Wildcard=Wildcard},{}],40:[function(require,module,exports){var Parser=require("./lib/SparqlParser").Parser,Generator=require("./lib/SparqlGenerator"),Wildcard=require("./lib/Wildcard").Wildcard,{DataFactory}=require("rdf-data-factory");module.exports={Parser:function({prefixes,baseIRI,factory,sparqlStar,skipUngroupedVariableCheck}={}){var prefix,prefixesCopy={};for(prefix in prefixes||{})prefixesCopy[prefix]=prefixes[prefix];var parser=new Parser;return parser.parse=function(){return Parser.base=baseIRI||"",Parser.prefixes=Object.create(prefixesCopy),Parser.factory=factory||new DataFactory,Parser.sparqlStar=Boolean(sparqlStar),Parser.skipUngroupedVariableCheck=Boolean(skipUngroupedVariableCheck),Parser.prototype.parse.apply(parser,arguments)},parser._resetBlanks=Parser._resetBlanks,parser},Generator:Generator,Wildcard:Wildcard}},{"./lib/SparqlGenerator":37,"./lib/SparqlParser":38,"./lib/Wildcard":39,"rdf-data-factory":22}],41:[function(require,module,exports){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P=P||Promise)(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):((value=result.value)instanceof P?value:new P(function(resolve){resolve(value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.AppMain=void 0;class AppMain extends HTMLElement{get sparql(){return this.querySelector("sparql-editor")}get blockly(){return this.querySelector("blockly-canvas")}connectedCallback(){return __awaiter(this,void 0,void 0,function*(){document.addEventListener("DOMContentLoaded",()=>{this.sparql.addEventListener("sparql",this.sparqlChanged.bind(this)),this.sparql.addEventListener("input",this.sparqlInput.bind(this)),this.blockly.addEventListener("blocks",this.blocksChanged.bind(this)),this.blockly.addEventListener("load",this.blocksLoaded.bind(this))})})}sparqlChanged(e){this.blockly.dom=e.detail}sparqlInput(){this.updateUrl()}blocksChanged(e){this.sparql.value=e.detail,this.updateUrl()}updateUrl(){window.location.hash=encodeURIComponent(this.sparql.value)}blocksLoaded(){var h=window.location.hash.split("#")[1];h&&this.sparql.setAndNotify(decodeURIComponent(h))}}exports.AppMain=AppMain},{}],42:[function(require,module,exports){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P=P||Promise)(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):((value=result.value)instanceof P?value:new P(function(resolve){resolve(value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.BlocklyCanvas=void 0;const Blockly=require("blockly"),SparqlBlockly=require("sparql-blockly");class BlocklyCanvas extends HTMLElement{constructor(){super(...arguments),this.typing=!1}getToolboxData(){return __awaiter(this,void 0,void 0,function*(){var url=this.getAttribute("toolbox-data");const response=yield fetch(url);return yield response.text()})}set dom(value){if(value){const workspace=Blockly.getMainWorkspace();workspace.clear(),this.typing=!0,Blockly.Xml.domToWorkspace(value,workspace)}}connectedCallback(){return __awaiter(this,void 0,void 0,function*(){var options={sounds:!1,toolbox:yield this.getToolboxData(),horizontalLayout:!0,zoom:{controls:!0,wheel:!0,startScale:1,maxScale:3,minScale:.01,scaleSpeed:1.2,pinch:!0}};const workspace=Blockly.inject(this,options);workspace.addChangeListener(this.workspaceChanged.bind(this)),window.setInterval(()=>Blockly.svgResize(workspace),1e3),this.dispatchEvent(new Event("load"))})}workspaceChanged(e){switch(e.type){case Blockly.Events.CHANGE:case Blockly.Events.DELETE:case Blockly.Events.MOVE:this.typing||this.generateCode();break;case Blockly.Events.FINISHED_LOADING:this.typing=!1}}generateCode(){const workspace=Blockly.getMainWorkspace();for(const block of workspace.getTopBlocks(!1))switch(block.type){case"sparql11_query":case"sparql11_update":this.dispatchEvent(new CustomEvent("blocks",{detail:SparqlBlockly.blocklyToSparql(block)}))}}}exports.BlocklyCanvas=BlocklyCanvas},{blockly:17,"sparql-blockly":36}],43:[function(require,module,exports){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P=P||Promise)(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):((value=result.value)instanceof P?value:new P(function(resolve){resolve(value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SparqlEditor=void 0;const SparqlJS=require("sparqljs"),SparqlBlockly=require("sparql-blockly");class SparqlEditor extends HTMLElement{connectedCallback(){return __awaiter(this,void 0,void 0,function*(){this.editorElement.addEventListener("input",this.input.bind(this))})}get editorElement(){return this.querySelector("textarea")}get errorElement(){return this.querySelector("span")}set error(value){this.errorElement.innerText=value}get value(){return this.editorElement.value}set value(value){this.editorElement.value=value,this.validate()}setAndNotify(value){this.editorElement.value=value,this.input()}input(){var query=this.validate();query&&this.dispatchEvent(new CustomEvent("sparql",{detail:SparqlBlockly.sparqlToBlockly(query)}))}validate(){this.error="",this.classList.remove("invalid"),this.classList.remove("valid");var sparql=this.value;if(sparql){const parser=new SparqlJS.Parser({sparqlStar:!0});try{var query=parser.parse(sparql);return this.classList.add("valid"),query}catch(e){this.error=e.message,this.classList.add("invalid")}}}}exports.SparqlEditor=SparqlEditor},{"sparql-blockly":36,sparqljs:40}],44:[function(SparqlEditor_1,module,BlocklyCanvas_1){"use strict";Object.defineProperty(BlocklyCanvas_1,"__esModule",{value:!0});var AppMain_1=SparqlEditor_1("./AppMain"),BlocklyCanvas_1=SparqlEditor_1("./BlocklyCanvas"),SparqlEditor_1=SparqlEditor_1("./SparqlEditor");customElements.define("app-main",AppMain_1.AppMain),customElements.define("blockly-canvas",BlocklyCanvas_1.BlocklyCanvas),customElements.define("sparql-editor",SparqlEditor_1.SparqlEditor)},{"./AppMain":41,"./BlocklyCanvas":42,"./SparqlEditor":43}]},{},[44]); diff --git a/docs/toolbox.xml b/docs/toolbox.xml index 069379dd..01b13f73 100644 --- a/docs/toolbox.xml +++ b/docs/toolbox.xml @@ -1,4 +1,4 @@ -